[PATCH] D15858: Warn undeclared identifiers in CUDA kernel calls

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 6 14:11:59 PST 2016


rsmith added inline comments.

================
Comment at: include/clang/AST/ExprCXX.h:181
@@ +180,3 @@
+    assert(
+        !IsConfigSet &&
+        "CUDAKernelCallExpr.setConfig can only be called once per instance.");
----------------
Perhaps `assert(!getPreArg(CONFIG))` instead of storing a separate flag?

================
Comment at: test/SemaCUDA/kernel-call.cu:27
@@ -26,1 +26,3 @@
+
+  g1<<<undeclared, 1>>>(42); // expected-error {{use of undeclared identifier 'undeclared'}}
 }
----------------
Your approach for that testcase seems fine, but it's not a test for the right thing as it doesn't have an unexpanded pack within the kernel call args. Here's a testcase for that scenario:

  template<int ...Dimensions> void kernel_wrapper() {
    void (*fs[])() = {
      []{ kernel<<<Dimensions>>>(); } ...
    };
  }


http://reviews.llvm.org/D15858





More information about the cfe-commits mailing list