[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 3 08:06:58 PDT 2023
efriedma added a comment.
I'm happy with this approach.
================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4327
+ if (D && D->hasAttr<AnnotateAttr>() && isa<llvm::Function>(Entry))
+ DeferredAnnotations[cast<llvm::Function>(Entry)] = cast<ValueDecl>(D);
+
----------------
This doesn't quite seem sufficient... I'd expect you'd want to update the map when you see a new declaration. Otherwise we miss annotations on something like:
```
void foo(void);
void *xxx = (void*)foo;
void __attribute__((annotate("bar"))) foo();
```
Granted, I wouldn't expect this sort of construct to show up normally, and I'm not sure how hard this is to fix.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156172/new/
https://reviews.llvm.org/D156172
More information about the cfe-commits
mailing list