diff options
author | Abid Qadeer <haqadeer@amd.com> | 2024-07-11 16:31:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-11 16:31:11 +0100 |
commit | dab36b288a1566d7b41154751e547c555ad43358 (patch) | |
tree | 8cd380ae44357d0706eb0f62540914ad6b0bc6e6 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | fff8b3236ab8ce8f99ea83a4de7c0e88687fc09d (diff) | |
download | llvm-dab36b288a1566d7b41154751e547c555ad43358.zip llvm-dab36b288a1566d7b41154751e547c555ad43358.tar.gz llvm-dab36b288a1566d7b41154751e547c555ad43358.tar.bz2 |
[mlir][debug] Allow global with local scope. (#98358)
Currently, only those global variables in debug info are allowed which
have a compile unit or module scope. But global variable with function
scope are used in debug info to represent certain type of variables. One
example will be static local variables in C. Here the variable is
represented as global variable with parent function as its scope. See
the code and debug metadata as generated by clang below. You can see
that scope of `DIGlobalVariable` is `DISubprogram`.
```
int test() {
static int a = 0;
return a++;
}
!0 = !DIGlobalVariableExpression(var: !1...)
!1 = !DIGlobalVariable(name: "a", scope: !2 ...)
!2 = !DISubprogram(name: "test" ...)
!7 = !DICompileUnit(... globals: !8...)
!8 = !{!0}
```
Similar issue exist in fortran where global variable with function scope
are used to represent local variable with save attribute.
This PR will allows such variables during module translation.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions