r282987 - [CUDA] Harmonize asserts in SemaCUDA, NFC.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 30 16:57:38 PDT 2016


Author: jlebar
Date: Fri Sep 30 18:57:38 2016
New Revision: 282987

URL: http://llvm.org/viewvc/llvm-project?rev=282987&view=rev
Log:
[CUDA] Harmonize asserts in SemaCUDA, NFC.

Modified:
    cfe/trunk/lib/Sema/SemaCUDA.cpp

Modified: cfe/trunk/lib/Sema/SemaCUDA.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCUDA.cpp?rev=282987&r1=282986&r2=282987&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCUDA.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCUDA.cpp Fri Sep 30 18:57:38 2016
@@ -443,7 +443,7 @@ bool Sema::isEmptyCudaDestructor(SourceL
 //    system header, in which case we leave the constexpr function unattributed.
 void Sema::maybeAddCUDAHostDeviceAttrs(Scope *S, FunctionDecl *NewD,
                                        const LookupResult &Previous) {
-  assert(getLangOpts().CUDA && "May be called only for CUDA compilations.");
+  assert(getLangOpts().CUDA && "Should only be called during CUDA compilation");
   if (!getLangOpts().CUDAHostDeviceConstexpr || !NewD->isConstexpr() ||
       NewD->isVariadic() || NewD->hasAttr<CUDAHostAttr>() ||
       NewD->hasAttr<CUDADeviceAttr>() || NewD->hasAttr<CUDAGlobalAttr>())
@@ -482,8 +482,7 @@ void Sema::maybeAddCUDAHostDeviceAttrs(S
 }
 
 bool Sema::CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee) {
-  assert(getLangOpts().CUDA &&
-         "Should only be called during CUDA compilation.");
+  assert(getLangOpts().CUDA && "Should only be called during CUDA compilation");
   assert(Callee && "Callee may not be null.");
   FunctionDecl *Caller = dyn_cast<FunctionDecl>(CurContext);
   if (!Caller)
@@ -561,6 +560,7 @@ bool Sema::CheckCUDAVLA(SourceLocation L
 }
 
 void Sema::CUDASetLambdaAttrs(CXXMethodDecl *Method) {
+  assert(getLangOpts().CUDA && "Should only be called during CUDA compilation");
   if (Method->hasAttr<CUDAHostAttr>() || Method->hasAttr<CUDADeviceAttr>())
     return;
   FunctionDecl *CurFn = dyn_cast<FunctionDecl>(CurContext);




More information about the cfe-commits mailing list