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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits