[PATCH] Fix PR20495: correct inference of the CUDA target for implicit members

Eli Bendersky eliben at google.com
Fri Sep 19 15:27:03 PDT 2014


Thank you for the review, Peter. PTAL

================
Comment at: include/clang/Basic/Attr.td:545
@@ +544,3 @@
+def CUDAInvalidTarget : InheritableAttr {
+  let Spellings = [GNU<"invalid_target">];
+  let Subjects = SubjectList<[Function]>;
----------------
pcc wrote:
> This doesn't seem like it should have a spelling.
Done

================
Comment at: lib/Sema/SemaCUDA.cpp:101
@@ +100,3 @@
+  assert((Target1 != Sema::CFT_Global && Target2 != Sema::CFT_Global) &&
+         "Special members cannot be marked global");
+
----------------
pcc wrote:
> Is there anything preventing a special member from being manually marked as global? (Apparently not; this parses without errors with a recent clang:)
> 
>     struct A {
>       __attribute__((global)) A() {}
>     };
Right. I think this should be detected earlier (when a method is constructed) with an appropriate error. I'll change the assertion to a runtime test for now - but am also adding a TODO to have a more descriptive error earlier.

================
Comment at: lib/Sema/SemaDeclCXX.cpp:10438
@@ -10402,1 +10437,3 @@
   CopyConstructor->setDefaulted();
+  CopyConstructor->setImplicit();
+
----------------
pcc wrote:
> It looks like this is already set by the `/*isImplicitlyDeclared=*/true` parameter passed to `CXXConstructorDecl::Create`.
This was cargo-culted from the creation of implicit default ctor and dtor. Fixed now - I've also fixed the source of the carto-culting :) Thanks for noticing this

================
Comment at: lib/Sema/SemaDeclCXX.cpp:10611
@@ -10567,1 +10610,3 @@
   MoveConstructor->setDefaulted();
+  MoveConstructor->setImplicit();
+
----------------
pcc wrote:
> Likewise.
Fixed

http://reviews.llvm.org/D5199






More information about the cfe-commits mailing list