[clang] [clang][deps] Optimize command line generation (PR #65412)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 5 15:20:44 PDT 2023
jansvoboda11 wrote:
I did, but decided against it. There are places in Clang where we store the result of the const function in some kind of long-lived data structure, and someplace else modify the result of the non-const function, expecting the change to be reflected.
I wanted to make the semantic difference clear on both ends in case someone was inclined to swap `CompilerInvocation` for `CowCompilerInvocation`. I'm not sure this is the best way to prevent misuse of the API, so I'm open to alternatives.
Note that you can use `CompilerInvocationBase` to get the behavior you're describing. I use it to implement `generateCC1CommandLine()`, but it's supposed to be used sparingly. Maybe putting it into some kind of `detail` namespace would communicate this even better, but that pollutes the `friend` declarations.
https://github.com/llvm/llvm-project/pull/65412
More information about the cfe-commits
mailing list