[PATCH] D25845: [CUDA] Ignore implicit target attributes during function template instantiation.

Justin Lebar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 8 10:09:18 PST 2016


jlebar accepted this revision.
jlebar added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Sema/SemaDecl.cpp:8415
+    // specialization inherits its target attributes from its template
+    // in CheckFunctionTemplateSpecialization() call below.
+    if (getLangOpts().CUDA & !isFunctionTemplateSpecialization)
----------------
"the Foo() call below", or "in Foo() below".  (I guess "Foo()" is like a proper name. :)


================
Comment at: lib/Sema/SemaTemplate.cpp:7048
       // target attributes into account, we perform target match check
       // here and reject candidates that have different target.
       if (LangOpts.CUDA &&
----------------
tra wrote:
> jlebar wrote:
> > Missing some articles:
> > 
> >   Target attributes are part of the cuda function signature, so the deduced template's cuda target must match XXX [1].  Given that regular template deduction [2] does not take target attributes into account, we reject candidates here that have a different target.
> > 
> > [1] I am not sure what XXX should be.  The deduced template's cuda target must match what, exactly?
> > 
> > [2] What is "regular template deduction"?
> [1] it must match the target of its template.
> [2] "C++ template deduction"
> Rephrased the comment based on  IRL conversation w/ jlebar at .
It's not showing a rephrased comment above; maybe you forgot to commit before arc diff?


================
Comment at: test/SemaCUDA/function-template-overload.cu:73
+
+// These should work, because template matching ignores implicit HD
+// attributes compiler gives to constexpr functions/templates so
----------------
"the implicit HD attributes the compiler gives"  :)


================
Comment at: test/SemaCUDA/function-template-overload.cu:74
+// These should work, because template matching ignores implicit HD
+// attributes compiler gives to constexpr functions/templates so
+// 'overload_ce_implicit_hd' template will match __host__ functions
----------------
comma before "so" (conjunction joining independent clauses)


https://reviews.llvm.org/D25845





More information about the cfe-commits mailing list