[CUDA] Accept -x cu to indicate language is CUDA, transfer CUDA language flag to...
authorADRA <plugin2adra@gmail.com>
Thu, 9 Apr 2020 20:02:38 +0000 (13:02 -0700)
committerArtem Belevich <tra@google.com>
Thu, 9 Apr 2020 20:08:41 +0000 (13:08 -0700)
Summary:
* accept -x cu to indicate language is CUDA
* transfer CUDA language flag to header-file arguments

Differential Revision: https://reviews.llvm.org/D77451

clang/lib/Driver/Types.cpp
clang/lib/Tooling/InterpolatingCompilationDatabase.cpp

index 7d83be2..df98835 100644 (file)
@@ -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;
 }
 
index db4efc0..64a9c12 100644 (file)
@@ -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;
   }