[clang] [clang][NFC] Pass const ASTContext& to CXXTypeidExpr API (PR #113083)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 20 05:00:09 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/113083.diff
2 Files Affected:
- (modified) clang/include/clang/AST/ExprCXX.h (+2-2)
- (modified) clang/lib/AST/ExprCXX.cpp (+2-2)
``````````diff
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index 975bcdac5069b9..cfe3938f83847b 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -876,13 +876,13 @@ class CXXTypeidExpr : public Expr {
/// Best-effort check if the expression operand refers to a most derived
/// object. This is not a strong guarantee.
- bool isMostDerived(ASTContext &Context) const;
+ bool isMostDerived(const ASTContext &Context) const;
bool isTypeOperand() const { return Operand.is<TypeSourceInfo *>(); }
/// Retrieves the type operand of this typeid() expression after
/// various required adjustments (removing reference types, cv-qualifiers).
- QualType getTypeOperand(ASTContext &Context) const;
+ QualType getTypeOperand(const ASTContext &Context) const;
/// Retrieve source information for the type operand.
TypeSourceInfo *getTypeOperandSourceInfo() const {
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index 83ce404add5f50..a2c0c60d43dd14 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -147,7 +147,7 @@ bool CXXTypeidExpr::isPotentiallyEvaluated() const {
return false;
}
-bool CXXTypeidExpr::isMostDerived(ASTContext &Context) const {
+bool CXXTypeidExpr::isMostDerived(const ASTContext &Context) const {
assert(!isTypeOperand() && "Cannot call isMostDerived for typeid(type)");
const Expr *E = getExprOperand()->IgnoreParenNoopCasts(Context);
if (const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
@@ -159,7 +159,7 @@ bool CXXTypeidExpr::isMostDerived(ASTContext &Context) const {
return false;
}
-QualType CXXTypeidExpr::getTypeOperand(ASTContext &Context) const {
+QualType CXXTypeidExpr::getTypeOperand(const ASTContext &Context) const {
assert(isTypeOperand() && "Cannot call getTypeOperand for typeid(expr)");
Qualifiers Quals;
return Context.getUnqualifiedArrayType(
``````````
</details>
https://github.com/llvm/llvm-project/pull/113083
More information about the cfe-commits
mailing list