[PATCH] D77252: [OpenMP] Try to find an existing base for `omp begin/end declare variant`

Mike Rice via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 4 13:49:56 PDT 2020


mikerice added inline comments.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:5512
+
+  if (!BaseFD) {
+    // TODO: Determine if we can reuse the declarator to create a declaration
----------------
I think if you do the base lookup in ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope instead of here you might have better success using the declarator.  You would need to get the type and  constexpr/consteval info from the declarator and declspec but if the lookup fails you can just use ActOnDeclarator to get a base declaration like you were before.  I tried this in my sandbox and it seems to work (AST tests fail I'm guessing that is just order change).  If that works we could get rid of these hacky bits.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:5551
+  BaseFD->addAttr(OMPDeclareVariantA);
   BaseFD->setImplicit(true);
 }
----------------
BaseFD is only implicit now if you created it, not when one was found in the lookup case right? 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77252/new/

https://reviews.llvm.org/D77252





More information about the cfe-commits mailing list