[PATCH] D23242: [CUDA] Raise an error if a wrong-side call is codegen'ed.
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 8 14:09:11 PDT 2016
tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.
Few nits, but looks good otherwise.
Should be add few tests for calling device functions from host-side global initializers? Perhaps for device->host, too, as there may be unexpected interplay with constructor emptiness checks.
================
Comment at: clang/include/clang/Sema/Sema.h:9162
@@ -9161,1 +9161,3 @@
+ /// Check whether we're allowed to call Callee from the current context.
+ ///
----------------
\p Callee
================
Comment at: clang/lib/Sema/SemaCUDA.cpp:493
@@ +492,3 @@
+ if (Pref == Sema::CFP_Never) {
+ Diag(Loc, diag::err_ref_bad_target) << IdentifyCUDATarget(Callee) << Callee
+ << IdentifyCUDATarget(Caller);
----------------
Perhaps we should add assert(Callee) before we use it.
================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:11510-11511
@@ -11509,1 +11509,4 @@
MarkFunctionReferenced(ConstructLoc, Constructor);
+ if (getLangOpts().CUDA)
+ if (!CheckCUDACall(ConstructLoc, Constructor))
+ return ExprError();
----------------
Single `if` would do here.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:5119
@@ -5126,8 +5118,3 @@
-/// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
-/// This provides the location of the left/right parens and a list of comma
-/// locations.
-ExprResult
-Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
- MultiExprArg ArgExprs, SourceLocation RParenLoc,
- Expr *ExecConfig, bool IsExecConfig) {
+ExprResult ActOnCallExprImpl(Sema &S, Scope *Scope, Expr *Fn,
+ SourceLocation LParenLoc, MultiExprArg ArgExprs,
----------------
static?
https://reviews.llvm.org/D23242
More information about the cfe-commits
mailing list