Skip to content

[clang][AST][NFC] Make ASTContext::UnwrapSimilar{Array,}Types const #106992

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
Sep 2, 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
6 changes: 3 additions & 3 deletions clang/include/clang/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -2722,9 +2722,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
const ObjCMethodDecl *MethodImp);

bool UnwrapSimilarTypes(QualType &T1, QualType &T2,
bool AllowPiMismatch = true);
bool AllowPiMismatch = true) const;
void UnwrapSimilarArrayTypes(QualType &T1, QualType &T2,
bool AllowPiMismatch = true);
bool AllowPiMismatch = true) const;

/// Determine if two types are similar, according to the C++ rules. That is,
/// determine if they are the same other than qualifiers on the initial
Expand All @@ -2733,7 +2733,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
///
/// Clang offers a number of qualifiers in addition to the C++ qualifiers;
/// those qualifiers are also ignored in the 'similarity' check.
bool hasSimilarType(QualType T1, QualType T2);
bool hasSimilarType(QualType T1, QualType T2) const;

/// Determine if two types are similar, ignoring only CVR qualifiers.
bool hasCvrSimilarType(QualType T1, QualType T2);
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6581,7 +6581,7 @@ QualType ASTContext::getUnqualifiedArrayType(QualType type,
/// \param AllowPiMismatch Allow the Pi1 and Pi2 to differ as described in
/// C++20 [conv.qual], if permitted by the current language mode.
void ASTContext::UnwrapSimilarArrayTypes(QualType &T1, QualType &T2,
bool AllowPiMismatch) {
bool AllowPiMismatch) const {
while (true) {
auto *AT1 = getAsArrayType(T1);
if (!AT1)
Expand Down Expand Up @@ -6632,7 +6632,7 @@ void ASTContext::UnwrapSimilarArrayTypes(QualType &T1, QualType &T2,
/// \return \c true if a pointer type was unwrapped, \c false if we reached a
/// pair of types that can't be unwrapped further.
bool ASTContext::UnwrapSimilarTypes(QualType &T1, QualType &T2,
bool AllowPiMismatch) {
bool AllowPiMismatch) const {
UnwrapSimilarArrayTypes(T1, T2, AllowPiMismatch);

const auto *T1PtrType = T1->getAs<PointerType>();
Expand Down Expand Up @@ -6668,7 +6668,7 @@ bool ASTContext::UnwrapSimilarTypes(QualType &T1, QualType &T2,
return false;
}

bool ASTContext::hasSimilarType(QualType T1, QualType T2) {
bool ASTContext::hasSimilarType(QualType T1, QualType T2) const {
while (true) {
Qualifiers Quals;
T1 = getUnqualifiedArrayType(T1, Quals);
Expand Down
Loading