[PATCH] D94472: [clang][cli] Command line round-trip for HeaderSearch options

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 8 14:23:03 PDT 2021


dexonsmith added a comment.

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.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94472/new/

https://reviews.llvm.org/D94472



More information about the cfe-commits mailing list