[clang] [lldb] [clang][AST] fix ast-print of extern <lang> with >=2 declarators, fixed (PR #93913)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 17 12:21:00 PDT 2024
================
@@ -2380,7 +2380,7 @@ FunctionDecl *Sema::CreateBuiltin(IdentifierInfo *II, QualType Type,
}
FunctionDecl *New = FunctionDecl::Create(Context, Parent, Loc, Loc, II, Type,
- /*TInfo=*/nullptr, SC_Extern,
+ /*TInfo=*/nullptr, SC_None,
----------------
AaronBallman wrote:
> You are right, I also paid attention to that issue. However, when a storage class specifier is omitted for a function, it's storage class is implicitly supposed to be extern. Thus, it's fine.
That's not actually correct -- the declaration of a function at block scope should definitely *not* be extern, it should have no linkage: https://godbolt.org/z/81fMaPaTq
> Furthermore, the meaning of this field according to the documentation comments is not for the actual storage duration or linkage, but for the storage-class specifier as present in the source code. Since builtins aren't really present in the source code, it seems further reasonable to omit a specifier.
Builtins should behave as-if they were declared in a header file that was included in the TU, and so they typically would be marked as `extern`.
https://github.com/llvm/llvm-project/pull/93913
More information about the cfe-commits
mailing list