[clang] 6ed88af - [CUDA] Accept -x cu to indicate language is CUDA, transfer CUDA language flag to header-file arguments
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 9 13:09:21 PDT 2020
Author: ADRA
Date: 2020-04-09T13:08:41-07:00
New Revision: 6ed88afd780cc2cd04e50e25c5d3ffafc07b1c1b
URL: https://github.com/llvm/llvm-project/commit/6ed88afd780cc2cd04e50e25c5d3ffafc07b1c1b
DIFF: https://github.com/llvm/llvm-project/commit/6ed88afd780cc2cd04e50e25c5d3ffafc07b1c1b.diff
LOG: [CUDA] Accept -x cu to indicate language is CUDA, transfer CUDA language flag to header-file arguments
Summary:
* accept -x cu to indicate language is CUDA
* transfer CUDA language flag to header-file arguments
Differential Revision: https://reviews.llvm.org/D77451
Added:
Modified:
clang/lib/Driver/Types.cpp
clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/Types.cpp b/clang/lib/Driver/Types.cpp
index 7d83be2521e7..df98835149e9 100644
--- a/clang/lib/Driver/Types.cpp
+++ b/clang/lib/Driver/Types.cpp
@@ -295,7 +295,10 @@ types::ID types::lookupTypeForTypeSpecifier(const char *Name) {
strcmp(Name, getInfo(Id).Name) == 0)
return Id;
}
-
+ // Accept "cu" as an alias for "cuda" for NVCC compatibility
+ if (strcmp(Name, "cu") == 0) {
+ return types::TY_CUDA;
+ }
return TY_INVALID;
}
diff --git a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
index db4efc0ed630..64a9c12220ac 100644
--- a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
+++ b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
@@ -114,6 +114,9 @@ static types::ID foldType(types::ID Lang) {
case types::TY_ObjCXX:
case types::TY_ObjCXXHeader:
return types::TY_ObjCXX;
+ case types::TY_CUDA:
+ case types::TY_CUDA_DEVICE:
+ return types::TY_CUDA:
default:
return types::TY_INVALID;
}
More information about the cfe-commits
mailing list