jhuber6 added a comment.

In D153369#4451993 <https://reviews.llvm.org/D153369#4451993>, @ABataev wrote:

> Did you try instead fix the OMPDeclareTargetDeclAttr::getActiveAttr() 
> function to make it look through all the declarations and return the 
> attribute from the first found instead of adding a new attribute?

I originally tried that but found that once we've found a canonical 
declaration, nothing will really bind to the new non-canonical definition. So 
the only way to do it would be to scan the entire file with the source manager 
as far as I could tell. I could be wrong though, I'm not as familiar with Clang 
here.



================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23105-23112
+        // If this was not a canonical definition we need to update it as well.
+        if (auto *CD = dyn_cast<NamedDecl>(D->getCanonicalDecl())) {
+          if (!CD->hasAttr<OMPDeclareTargetDeclAttr>()) {
+            CD->addAttr(A);
+            if (ASTMutationListener *ML = Context.getASTMutationListener())
+              ML->DeclarationMarkedOpenMPDeclareTarget(CD, A);
+          }
----------------
ABataev wrote:
> Here it would be better to reconstruct the attribute and make it implicit 
> attribute
I thought it was already implcit since we use 
`OMPDeclareTargetDeclAttr::CreateImplicit` above, what would be different in 
the new version?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153369

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to