[PATCH] D133088: [Clang] Fix wrong diagnostic for scope identifier with internal linkage

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 10 05:19:32 PDT 2022


aaron.ballman added a comment.

In D133088#3782126 <https://reviews.llvm.org/D133088#3782126>, @pmor13 wrote:

> @aaron.ballman
>
>> block scope variable to have *internal* linkage instead of *no* linkage
>
>   static int x;
>   
>   void f(void)
>   {
>       extern int x;  // block scope, internal linkage 
>   }

No, I understood that, I meant in terms of the semantics. I'm not 100% convinced there's a way to *observe* the difference between no and internal linkage, but I *think* you might be able to observe it regarding an inline function returning the address of an internal linkage variable. If it's internal linkage, every copy of the function shares the same object but if it had no linkage, the linker wouldn't have to collapse them all down to the same object (maybe?).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133088



More information about the cfe-commits mailing list