[Lldb-commits] [clang] [lldb] [clang][AST] fix ast-print of extern <lang> with >=2 declarators, fixed (PR #93913)
Artem Yurchenko via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 17 12:32:05 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,
----------------
temyurchenko wrote:
> 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
I may be wrong to rely on cppreference, but the following page tells that indeed a function at a block scope has implicit `extern`, which could also be made explicit: https://en.cppreference.com/w/c/language/storage_duration.
I also checked your example locally by compiling (via clang) `main.c` with an additional `defs.c`:
main.c:
```c
int main(void) {
void f();
extern void g();
f();
g();
return 0;
}
```
defs.c:
```c
#include <stdio.h>
void f() {
printf("f\n");
}
void g() {
printf("g\n");
}
```
The executable works as expected.
I will also take a look at the C99 standard draft.
https://github.com/llvm/llvm-project/pull/93913
More information about the lldb-commits
mailing list