[clang] [clang] Be const-correct with all uses of `Module *`. (PR #93493)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue May 28 11:50:20 PDT 2024
erichkeane wrote:
> One suggestion, if you are going to go about this problem systematically, try to tackle the hardest problems first.
>
> For example: Try to make `MultiLevelTemplateArgumentList` const correct. I would like other suggestions as well.
Right, yeah. Unfortunately const-correctness in Clang is really bad, and not really something we can fix well piecemeal without a lot of churn/issues. Our current approach is pretty pervasive to breaking const-correctness, so any iterative/piecemeal appraoch ends up having to const-cast all over the place. I am pretty sure a few dozen folks have attempted over the last few years, each ended up more annoyed than the last :)
That said, this patch Is something I think is a good direction. However, I fear(it seems?) it doesn't use any level of holistic approach to determining which functions need to mutate other than "they don't mutate today". Which is, IMO, a worse level of const-correctness to be in. We need to identify which functions/uses are conceptually modifying (see the `getSomething` examples above), and which aren't, then do the addition of const from there.
https://github.com/llvm/llvm-project/pull/93493
More information about the cfe-commits
mailing list