[clang] [clang] Be const-correct with all uses of `Module *`. (PR #93493)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue May 28 10:38:51 PDT 2024
================
@@ -817,11 +817,11 @@ class alignas(8) Decl {
"owned local decl but no local module storage");
return reinterpret_cast<Module *const *>(this)[-1];
}
- void setLocalOwningModule(Module *M) {
+ void setLocalOwningModule(const Module *M) {
----------------
AaronBallman wrote:
This is an example where it's not clear to me that it's correct -- the caller assumes "this will never be mutated" but that's not a safe assumption given `Module *getLocalOwningModule() const;` (which itself is not const correct! that should be a pair of functions where the `const` variant returns a `const Module *` and the non-`const` variant returns a `Module *`)
https://github.com/llvm/llvm-project/pull/93493
More information about the cfe-commits
mailing list