[clang] Change `ASTUnit::getASTContext() const` to return a non-const `ASTContext` (PR #130096)
Boaz Brickner via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 6 04:52:36 PST 2025
https://github.com/bricknerb created https://github.com/llvm/llvm-project/pull/130096
Also, remove the non-const `ASTUnit::getASTContext()` since it's no longer necessary.
This would make it similar to `Decl::getAstContext() const` for a more consistent and flexible API.
>From be1b384568aab7af00ffb96f0aef11f0f81f8f69 Mon Sep 17 00:00:00 2001
From: Boaz Brickner <brickner at google.com>
Date: Thu, 6 Mar 2025 13:51:24 +0100
Subject: [PATCH] Change `ASTUnit::getASTContext() const` to return a non-const
`ASTContext` Also, remove the non-const `ASTUnit::getASTContext()` since it's
no longer necessary. This would make it similar to `Decl::getAstContext()
const` for a more consistent and flexible API.
---
clang/include/clang/Frontend/ASTUnit.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h
index 1f98c6ab328ba..bd55c8b627941 100644
--- a/clang/include/clang/Frontend/ASTUnit.h
+++ b/clang/include/clang/Frontend/ASTUnit.h
@@ -439,8 +439,7 @@ class ASTUnit {
Preprocessor &getPreprocessor() { return *PP; }
std::shared_ptr<Preprocessor> getPreprocessorPtr() const { return PP; }
- const ASTContext &getASTContext() const { return *Ctx; }
- ASTContext &getASTContext() { return *Ctx; }
+ ASTContext &getASTContext() const { return *Ctx; }
void setASTContext(ASTContext *ctx) { Ctx = ctx; }
void setPreprocessor(std::shared_ptr<Preprocessor> pp);
More information about the cfe-commits
mailing list