dexonsmith added a subscriber: aprantl. dexonsmith added a comment. In D94472#3052604 <https://reviews.llvm.org/D94472#3052604>, @dexonsmith wrote:
> Looking at `CommandLineArgs`, and its eventual forward to `MCTargetInfo`, the > existing design looks like a reference leak, which would also block freeing > Clang memory when LLVM is still running. Given that > 89ea0b05207d45c145fb525df554b3b986ae379b > <https://reviews.llvm.org/rG89ea0b05207d45c145fb525df554b3b986ae379b> has no > in-tree users, I'd suggest reverting it and creating a different mechanism to > pass the command-line through to https://reviews.llvm.org/D80833 that doesn't > make MCTargetInfo depend on the lifetime of CompilerInvocation. The current > mechanism doesn't look like it'll work correctly for `clang -save-temps` > either. > > E.g., Clang could create a global metadata node with the flattened > command-line args on the targets / for the users that want this: if and only > if requested, CompilerInvocation creates a `std::string FlattenedCommandLine` > that it stores in CodeGenOptions, clang/CodeGen creates a `!llvm.commandline` > metadata node, and llvm/PDB reads the metadata node and creates the entry. > (Note that I don't think that should be done by default (certainly not for > all targets); I'm a bit skeptical that https://reviews.llvm.org/D80833 is a > good idea; see my comment there.) @aprantl helped me dig up how this feature is implemented for DWARF on Darwin. Note that it's off-by-default because it's horrible for reproducible builds. - Driver argument `-grecord-command-line` causes the driver to send its args to `-cc1` in a flattened string via `-dwarf-debug-flags`. - That winds up in the std::string in CodeGenOptions::DwarfDebugFlags. - Environment variable RC_DEBUG_INFO triggers the same code path. Seems like you could use the same `-grecord-command-line` logic on Windows? (Off-by-default I hope...) You could either rename DwarfDebugFlags to DebugFlags or create a separate PDBDebugFlags... Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D94472/new/ https://reviews.llvm.org/D94472 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits