Skip to content

Commit 38ae53d

Browse files
authored
[clang][AST][NFC] Make ASTContext::UnwrapSimilar{Array,}Types const (#106992)
They don't mutate the context at all, so mark them const.
1 parent cb949b7 commit 38ae53d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clang/include/clang/AST/ASTContext.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2722,9 +2722,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
27222722
const ObjCMethodDecl *MethodImp);
27232723

27242724
bool UnwrapSimilarTypes(QualType &T1, QualType &T2,
2725-
bool AllowPiMismatch = true);
2725+
bool AllowPiMismatch = true) const;
27262726
void UnwrapSimilarArrayTypes(QualType &T1, QualType &T2,
2727-
bool AllowPiMismatch = true);
2727+
bool AllowPiMismatch = true) const;
27282728

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

27382738
/// Determine if two types are similar, ignoring only CVR qualifiers.
27392739
bool hasCvrSimilarType(QualType T1, QualType T2);

clang/lib/AST/ASTContext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6581,7 +6581,7 @@ QualType ASTContext::getUnqualifiedArrayType(QualType type,
65816581
/// \param AllowPiMismatch Allow the Pi1 and Pi2 to differ as described in
65826582
/// C++20 [conv.qual], if permitted by the current language mode.
65836583
void ASTContext::UnwrapSimilarArrayTypes(QualType &T1, QualType &T2,
6584-
bool AllowPiMismatch) {
6584+
bool AllowPiMismatch) const {
65856585
while (true) {
65866586
auto *AT1 = getAsArrayType(T1);
65876587
if (!AT1)
@@ -6632,7 +6632,7 @@ void ASTContext::UnwrapSimilarArrayTypes(QualType &T1, QualType &T2,
66326632
/// \return \c true if a pointer type was unwrapped, \c false if we reached a
66336633
/// pair of types that can't be unwrapped further.
66346634
bool ASTContext::UnwrapSimilarTypes(QualType &T1, QualType &T2,
6635-
bool AllowPiMismatch) {
6635+
bool AllowPiMismatch) const {
66366636
UnwrapSimilarArrayTypes(T1, T2, AllowPiMismatch);
66376637

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

6671-
bool ASTContext::hasSimilarType(QualType T1, QualType T2) {
6671+
bool ASTContext::hasSimilarType(QualType T1, QualType T2) const {
66726672
while (true) {
66736673
Qualifiers Quals;
66746674
T1 = getUnqualifiedArrayType(T1, Quals);

0 commit comments

Comments
 (0)