[flang-commits] [flang] [flang][debug] Don't generate debug for compiler-generated variables (PR #112423)
via flang-commits
flang-commits at lists.llvm.org
Wed Oct 16 02:04:07 PDT 2024
================
@@ -211,10 +211,13 @@ void AddDebugInfoPass::handleGlobalOp(fir::GlobalOp globalOp,
if (result.first != fir::NameUniquer::NameKind::VARIABLE)
return;
- // Discard entries that describe a derived type. Usually start with '.c.',
- // '.dt.' or '.n.'. It would be better if result of the deconstruct had a flag
- // for such values so that we dont have to look at string values.
- if (!result.second.name.empty() && result.second.name[0] == '.')
+ // Discard entries that describe a derived type. They start with either '.' or
+ // 'X'. We filter both of them out. Note that NameUniquer makes the name lower
+ // case so user variables should be safe. It would be better if result of the
+ // deconstruct had a flag for such values so that we dont have to look at
+ // string values.
+ if (!result.second.name.empty() &&
+ (result.second.name[0] == '.' || result.second.name[0] == 'X'))
----------------
jeanPerier wrote:
Please move the `result.second.name[0] == '.' || result.second.name[0] == 'X'` part into some `static fir::NameUniquer::isSpecialSymbol(llvm::StringRef name)` helper in `Optimizer/Support/InternalNames` so that the usages of these delimiters are better centralized and advertise.
Long term, it may be better to have some compiler generated flag attributes on the global/declare for such variables (and others) rather than relying on the names.
In semantics, these variables are tagged with the `CompilerCreated` symbol attribute, but it is currently not represented in FIR.
https://github.com/llvm/llvm-project/pull/112423
More information about the flang-commits
mailing list