[clang] [Clang][NFC] Use const ASTContext reference in Decl Create methods (PR #185401)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 20 08:12:17 PDT 2026
================
@@ -138,12 +138,12 @@ class TranslationUnitDecl : public Decl,
using redeclarable_base::redecls_begin;
using redeclarable_base::redecls_end;
- ASTContext &getASTContext() const { return Ctx; }
+ ASTContext &getASTContext() const { return const_cast<ASTContext &>(Ctx); }
----------------
AaronBallman wrote:
I would expect this interface to return a `const ASTContext &` because the member function is const, and we'd have a non-`const` overload which returns the `ASTContext &`.
https://github.com/llvm/llvm-project/pull/185401
More information about the cfe-commits
mailing list