diff options
author | David Blaikie <dblaikie@gmail.com> | 2021-09-21 20:25:13 -0700 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2021-09-22 11:11:49 -0700 |
commit | 38c09ea2d279eddddabe3602e2002f8cdfcc5380 (patch) | |
tree | 7688d1f0a7b739e1523b2e5198b108b16e23c4e5 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 43552651319e1c39c09ce0f61b588813414cebda (diff) | |
download | llvm-38c09ea2d279eddddabe3602e2002f8cdfcc5380.zip llvm-38c09ea2d279eddddabe3602e2002f8cdfcc5380.tar.gz llvm-38c09ea2d279eddddabe3602e2002f8cdfcc5380.tar.bz2 |
DebugInfo: Add (initially no-op) -gsimple-template-names={simple,mangled}
This is to build the foundation of a new debug info feature to use only
the base name of template as its debug info name (eg: "t1" instead of
the full "t1<int>"). The intent being that a consumer can still retrieve
all that information from the DW_TAG_template_*_parameters.
So gno-simple-template-names is business as usual/previously ("t1<int>")
=simple is the simplified name ("t1")
=mangled is a special mode to communicate the full information, but
also indicate that the name should be able to be simplified. The data
is encoded as "_STNt1|<int>" which will be matched with an
llvm-dwarfdump --verify feature to deconstruct this name, rebuild the
original name, and then try to rebuild the simple name via the DWARF
tags - then compare the latter and the former to ensure that all the
data necessary to fully rebuild the name is present.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 10b2e96..2368e68 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1411,6 +1411,14 @@ void CompilerInvocation::GenerateCodeGenArgs( llvm::DICompileUnit::DebugNameTableKind::Default)) GenerateArg(Args, OPT_gpubnames, SA); + auto TNK = Opts.getDebugSimpleTemplateNames(); + if (TNK != codegenoptions::DebugTemplateNamesKind::Full) { + if (TNK == codegenoptions::DebugTemplateNamesKind::Simple) + GenerateArg(Args, OPT_gsimple_template_names_EQ, "simple", SA); + if (TNK == codegenoptions::DebugTemplateNamesKind::Mangled) + GenerateArg(Args, OPT_gsimple_template_names_EQ, "mangled", SA); + + } // ProfileInstrumentUsePath is marshalled automatically, no need to generate // it or PGOUseInstrumentor. @@ -1685,6 +1693,12 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, : Args.hasArg(OPT_gpubnames) ? llvm::DICompileUnit::DebugNameTableKind::Default : llvm::DICompileUnit::DebugNameTableKind::None); + if (const Arg *A = Args.getLastArg(OPT_gsimple_template_names_EQ)) { + Opts.setDebugSimpleTemplateNames( + StringRef(A->getValue()) == "simple" + ? codegenoptions::DebugTemplateNamesKind::Simple + : codegenoptions::DebugTemplateNamesKind::Mangled); + } if (!Opts.ProfileInstrumentUsePath.empty()) setPGOUseInstrumentor(Opts, Opts.ProfileInstrumentUsePath); |