[PATCH] D96109: Refactor implementation of -funique-internal-linkage-names.

Sriraman Tallam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 12:39:57 PST 2021


tmsriram added inline comments.


================
Comment at: clang/include/clang/Basic/Attr.td:2159
 
+def UniqueInternalLinkageSuffix : Attr {
+  // This attribute has no spellings as it is only ever created implicitly.
----------------
aaron.ballman wrote:
> tmsriram wrote:
> > aaron.ballman wrote:
> > > Should this attribute be inherited by redeclarations?
> > The attribute is added in EmitTopLevelDecl in CodeGenModule which happens after  ActOnDeclarator in SemaDecl.cpp.  I dont think this needs to be inherited but I am not sure. Is there an example I can use to check if this is fine?
> I was thinking of something along these lines, where the initial declaration is explicitly marked static and the definition is not:
> ```
> static int foo(void);
> int foo(void) { return 12; }
> 
> int main() {
>   return foo();
> }
> ```
> However, I realize now that it shouldn't matter because the attribute isn't attached until codegen time. FWIW, this means the attribute won't appear in the AST, which means things like clang-tidy or third-parties that consume the AST won't have access to this information.
Ack. I will make sure I check for this case and also see if I can avoid using the attribute in some manner.


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

https://reviews.llvm.org/D96109



More information about the llvm-commits mailing list