[PATCH] D25541: [CUDA] Emit deferred diagnostics during Sema rather than during codegen.

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 13 09:58:27 PDT 2016


rnk added a comment.

Nice! Looks like this wasn't too bad.



================
Comment at: clang/lib/Sema/SemaCUDA.cpp:546
+  // Externally-visible and similar functions are always emitted.
+  if (S.getASTContext().GetGVALinkageForFunction(FD) > GVA_DiscardableODR)
+    return true;
----------------
There are two other instances of conditions equivalent to this in `ASTContext::DeclMustBeEmitted`. You should add a predicate like `isDiscardableGVALinkage(GVALinkage)` to Linkage.h and call it in `DeclMustBeEmitted`.


================
Comment at: clang/lib/Sema/SemaCUDA.cpp:654
+
+    for (FunctionDecl *Callee : CGIt->second) {
+      if (Seen.count(Callee) || IsKnownEmitted(S, Callee))
----------------
This is iterating a DenseSet of pointers, so it'll be non-determinstic. Use SetVector to get a determinstically ordered set.


https://reviews.llvm.org/D25541





More information about the cfe-commits mailing list