Re: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple-template-names={simple, mangled}
On Thu, Sep 23, 2021 at 7:12 AM wrote: > Resending to cfe-commits instead of llvm-commits (doh!). > > > -Original Message- > > From: Robinson, Paul > > Sent: Thursday, September 23, 2021 10:05 AM > > To: David Blaikie ; 'llvm-comm...@lists.llvm.org' > > > > Cc: Adrian Prantl ; Jonas Devlieghere > > > > Subject: RE: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple- > > template-names={simple,mangled} > > > > -gsimple-template-names=mangled seems like a testing feature? > > That would be parseable only by llvm-dwarfdump... > > In which case it seems like it should be a -cc1 option not a > > driver option. > Yep, sounds fair - done that in 8ec7d9b8f875368a5f92596332cd05059df6bbd2 > --paulr > > > > > -Original Message- > > > From: cfe-commits On Behalf Of > > David > > > Blaikie via cfe-commits > > > Sent: Wednesday, September 22, 2021 2:12 PM > > > To: cfe-commits@lists.llvm.org > > > Subject: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple- > > > template-names={simple,mangled} > > > > > > > > > Author: David Blaikie > > > Date: 2021-09-22T11:11:49-07:00 > > > New Revision: 38c09ea2d279eabe3602e2002f8cdfcc5380 > > > > > > URL: https://urldefense.com/v3/__https://github.com/llvm/llvm- > > > > > > project/commit/38c09ea2d279eabe3602e2002f8cdfcc5380__;!!JmoZiZGBv3RvKR > > > Sx!sx4rLw3CFwdj-rfDEK1Ah3HnANZSLOpXYFIcie1Oiyili8LKwFHxFk-g0F7-Z2pXAg$ > > > DIFF: https://urldefense.com/v3/__https://github.com/llvm/llvm- > > > > > > project/commit/38c09ea2d279eabe3602e2002f8cdfcc5380.diff__;!!JmoZiZGBv > > > 3RvKRSx!sx4rLw3CFwdj-rfDEK1Ah3HnANZSLOpXYFIcie1Oiyili8LKwFHxFk- > > > g0F4WQP9bxA$ > > > > > > LOG: 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"). 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") > > >=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|" 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. > > > > > > Added: > > > > > > > > > Modified: > > > clang/include/clang/Basic/CodeGenOptions.def > > > clang/include/clang/Basic/DebugInfoOptions.h > > > clang/include/clang/Driver/Options.td > > > clang/lib/Driver/ToolChains/Clang.cpp > > > clang/lib/Frontend/CompilerInvocation.cpp > > > clang/test/Driver/debug-options.c > > > > > > Removed: > > > > > > > > > > > > > > > ## > > > ## > > > diff --git a/clang/include/clang/Basic/CodeGenOptions.def > > > b/clang/include/clang/Basic/CodeGenOptions.def > > > index 37900bf3ead1..5d1d4f9dc58e 100644 > > > --- a/clang/include/clang/Basic/CodeGenOptions.def > > > +++ b/clang/include/clang/Basic/CodeGenOptions.def > > > @@ -320,6 +320,12 @@ CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///< > > Whether > > > to emit complete > > > ///< template parameter > > > descriptions in > > > ///< forward declarations > > > (versus just > > > ///< including them in the > > > name). > > > +ENUM_CODEGENOPT(DebugSimpleTemplateNames, > > > codegenoptions::DebugTemplateNamesKind, 2, > > > codegenoptions::DebugTemplateNamesKind::Full) ///< Whether to emit > > > template parameters > > > +
RE: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple-template-names={simple,mangled}
Resending to cfe-commits instead of llvm-commits (doh!). > -Original Message- > From: Robinson, Paul > Sent: Thursday, September 23, 2021 10:05 AM > To: David Blaikie ; 'llvm-comm...@lists.llvm.org' > > Cc: Adrian Prantl ; Jonas Devlieghere > > Subject: RE: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple- > template-names={simple,mangled} > > -gsimple-template-names=mangled seems like a testing feature? > That would be parseable only by llvm-dwarfdump... > In which case it seems like it should be a -cc1 option not a > driver option. > --paulr > > > -Original Message- > > From: cfe-commits On Behalf Of > David > > Blaikie via cfe-commits > > Sent: Wednesday, September 22, 2021 2:12 PM > > To: cfe-commits@lists.llvm.org > > Subject: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple- > > template-names={simple,mangled} > > > > > > Author: David Blaikie > > Date: 2021-09-22T11:11:49-07:00 > > New Revision: 38c09ea2d279eabe3602e2002f8cdfcc5380 > > > > URL: https://urldefense.com/v3/__https://github.com/llvm/llvm- > > > project/commit/38c09ea2d279eabe3602e2002f8cdfcc5380__;!!JmoZiZGBv3RvKR > > Sx!sx4rLw3CFwdj-rfDEK1Ah3HnANZSLOpXYFIcie1Oiyili8LKwFHxFk-g0F7-Z2pXAg$ > > DIFF: https://urldefense.com/v3/__https://github.com/llvm/llvm- > > > project/commit/38c09ea2d279eabe3602e2002f8cdfcc5380.diff__;!!JmoZiZGBv > > 3RvKRSx!sx4rLw3CFwdj-rfDEK1Ah3HnANZSLOpXYFIcie1Oiyili8LKwFHxFk- > > g0F4WQP9bxA$ > > > > LOG: 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"). 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") > >=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|" 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. > > > > Added: > > > > > > Modified: > > clang/include/clang/Basic/CodeGenOptions.def > > clang/include/clang/Basic/DebugInfoOptions.h > > clang/include/clang/Driver/Options.td > > clang/lib/Driver/ToolChains/Clang.cpp > > clang/lib/Frontend/CompilerInvocation.cpp > > clang/test/Driver/debug-options.c > > > > Removed: > > > > > > > > > ## > > ## > > diff --git a/clang/include/clang/Basic/CodeGenOptions.def > > b/clang/include/clang/Basic/CodeGenOptions.def > > index 37900bf3ead1..5d1d4f9dc58e 100644 > > --- a/clang/include/clang/Basic/CodeGenOptions.def > > +++ b/clang/include/clang/Basic/CodeGenOptions.def > > @@ -320,6 +320,12 @@ CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///< > Whether > > to emit complete > > ///< template parameter > > descriptions in > > ///< forward declarations > > (versus just > > ///< including them in the > > name). > > +ENUM_CODEGENOPT(DebugSimpleTemplateNames, > > codegenoptions::DebugTemplateNamesKind, 2, > > codegenoptions::DebugTemplateNamesKind::Full) ///< Whether to emit > > template parameters > > + ///< in the textual names of > > template > > + ///< specializations. > > + ///< Implies DebugFwdTemplateNames to > > + ///< allow decorated names to be > > + ///< reconstructed when needed. > > CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize > use- > > lists. > > > > CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole- > program > > > > diff --git a/clang/
[clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple-template-names={simple,mangled}
Author: David Blaikie Date: 2021-09-22T11:11:49-07:00 New Revision: 38c09ea2d279eabe3602e2002f8cdfcc5380 URL: https://github.com/llvm/llvm-project/commit/38c09ea2d279eabe3602e2002f8cdfcc5380 DIFF: https://github.com/llvm/llvm-project/commit/38c09ea2d279eabe3602e2002f8cdfcc5380.diff LOG: 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"). 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") =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|" 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. Added: Modified: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Basic/DebugInfoOptions.h clang/include/clang/Driver/Options.td clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/test/Driver/debug-options.c Removed: diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index 37900bf3ead1..5d1d4f9dc58e 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -320,6 +320,12 @@ CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///< Whether to emit complete ///< template parameter descriptions in ///< forward declarations (versus just ///< including them in the name). +ENUM_CODEGENOPT(DebugSimpleTemplateNames, codegenoptions::DebugTemplateNamesKind, 2, codegenoptions::DebugTemplateNamesKind::Full) ///< Whether to emit template parameters + ///< in the textual names of template + ///< specializations. + ///< Implies DebugFwdTemplateNames to + ///< allow decorated names to be + ///< reconstructed when needed. CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists. CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program diff --git a/clang/include/clang/Basic/DebugInfoOptions.h b/clang/include/clang/Basic/DebugInfoOptions.h index c1259d7797db..a99a2b5903d7 100644 --- a/clang/include/clang/Basic/DebugInfoOptions.h +++ b/clang/include/clang/Basic/DebugInfoOptions.h @@ -54,6 +54,12 @@ enum DebugInfoKind { UnusedTypeInfo, }; +enum class DebugTemplateNamesKind { + Full, + Simple, + Mangled +}; + } // end namespace codegenoptions } // end namespace clang diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index f0932a0bd1de..13d740cdb0fb 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2967,6 +2967,15 @@ def gsplit_dwarf_EQ : Joined<["-"], "gsplit-dwarf=">, Group, HelpText<"Set DWARF fission mode to either 'split' or 'single'">, Values<"split,single">; def gno_split_dwarf : Flag<["-"], "gno-split-dwarf">, Group; +def gsimple_template_names : Flag<["-"], "gsimple-template-names">, Group; +def gsimple_template_names_EQ +: Joined<["-"], "gsimple-template-names=">, + Group, + HelpText<"Use simple template names in DWARF, or include the full " + "template name with a modified prefix for validation">, + Values<"simple,mangled">, Flags<[CC1Option]>; +def gno_simple_template_names : Flag<["-"], "gno-simple-template-names">, +Group; def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group, Flags<[CC1Option]>; def gno_gnu_pubnames : Flag<["-"], "gno-gnu-pubnames">, Group; def gpubnames : Flag<["-"], "gpubnames">, Group, Flags<[CC1Option]>; diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index e6742c6575b9..6c7b8bbcaad7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4128,6 +4128,29 @@ static void renderDebugOptions(const ToolChain , const Driver , options::OPT_gpubnames) ? "-gpubnames" :