diff options
author | Yaxun Liu <Yaxun.Liu@amd.com> | 2019-01-29 13:20:23 +0000 |
---|---|---|
committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2019-01-29 13:20:23 +0000 |
commit | 248e5bf6ef4ecf292928b99bf755b26b6ebd3c6f (patch) | |
tree | 0ea91671921306e520582076fc8c527bab9d04eb /lib/Sema/SemaType.cpp | |
parent | d507ee11ead38846eec05eae085c6935abcead47 (diff) | |
download | clang-248e5bf6ef4ecf292928b99bf755b26b6ebd3c6f.tar.gz |
[CUDA][HIP] Do not diagnose use of _Float16
r352221 caused regressions in CUDA/HIP since device function may use _Float16 whereas host does not support it.
In this case host compilation should not diagnose usage of _Float16 in device functions or variables.
For now just do not diagnose _Float16 for CUDA/HIP. In the future we should have more precise check.
Differential Revision: https://reviews.llvm.org/D57369
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 321bed63d9..090d9431be 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -1442,7 +1442,10 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { Result = Context.Int128Ty; break; case DeclSpec::TST_float16: - if (!S.Context.getTargetInfo().hasFloat16Type()) + // CUDA host and device may have different _Float16 support, therefore + // do not diagnose _Float16 usage to avoid false alarm. + // ToDo: more precise diagnostics for CUDA. + if (!S.Context.getTargetInfo().hasFloat16Type() && !S.getLangOpts().CUDA) S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_unsupported) << "_Float16"; Result = Context.Float16Ty; |