Skip to content

[clang][NFC] Pass const ASTContext& to CXXTypeidExpr API #113083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/include/clang/AST/ExprCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/ExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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(
Expand Down
Loading