diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -2455,7 +2455,7 @@ const ObjCMethodDecl *MethodImp); bool UnwrapSimilarTypes(QualType &T1, QualType &T2); - bool UnwrapSimilarArrayTypes(QualType &T1, QualType &T2); + void UnwrapSimilarArrayTypes(QualType &T1, QualType &T2); /// 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 diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -5766,29 +5766,29 @@ /// Attempt to unwrap two types that may both be array types with the same bound /// (or both be array types of unknown bound) for the purpose of comparing the /// cv-decomposition of two types per C++ [conv.qual]. -bool ASTContext::UnwrapSimilarArrayTypes(QualType &T1, QualType &T2) { - bool UnwrappedAny = false; +void ASTContext::UnwrapSimilarArrayTypes(QualType &T1, QualType &T2) { while (true) { auto *AT1 = getAsArrayType(T1); - if (!AT1) return UnwrappedAny; + if (!AT1) + return; auto *AT2 = getAsArrayType(T2); - if (!AT2) return UnwrappedAny; + if (!AT2) + return; // If we don't have two array types with the same constant bound nor two // incomplete array types, we've unwrapped everything we can. if (auto *CAT1 = dyn_cast(AT1)) { auto *CAT2 = dyn_cast(AT2); if (!CAT2 || CAT1->getSize() != CAT2->getSize()) - return UnwrappedAny; + return; } else if (!isa(AT1) || !isa(AT2)) { - return UnwrappedAny; + return; } T1 = AT1->getElementType(); T2 = AT2->getElementType(); - UnwrappedAny = true; } }