[clang] [clang][deps] Optimize command line generation (PR #65412)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 5 15:46:22 PDT 2023
jansvoboda11 wrote:
> > 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 would be comfortable with this, because you would still have to call a distinctly named function (getMut...) in order to do the mutation itself IIUC. If they are const-casting of course that wouldn't be enough.
Ok, if you're fine with that, I'll use the original names for the const getters on `CowCompilerInvocation`.
> > Note that you can use CompilerInvocationBase to get the behavior you're describing.
>
> I think `CompilerInvocationBase` goes a step farther than what I described, because it would give you the mutating methods with the original names, no?
No, `CompilerInvocationBase` doesn't have the mutating functions. `RefBase` and `ValBase` only expose the const getters. `CompilerInvocationBase` only adds the `generate*()` functions on top of those. The non-const getters are specific to `CompilerInvocation` and `CowCompilerInvocation`.
https://github.com/llvm/llvm-project/pull/65412
More information about the cfe-commits
mailing list