diff options
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 8fc2bb8c401c..f9902a978aa3 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -3054,21 +3054,27 @@ QualType ASTContext::removeAddrSpaceQualType(QualType T) const { if (!T.hasAddressSpace()) return T; - // If we are composing extended qualifiers together, merge together - // into one ExtQuals node. QualifierCollector Quals; const Type *TypeNode; + // For arrays, strip the qualifier off the element type, then reconstruct the + // array type + if (T.getTypePtr()->isArrayType()) { + T = getUnqualifiedArrayType(T, Quals); + TypeNode = T.getTypePtr(); + } else { + // If we are composing extended qualifiers together, merge together + // into one ExtQuals node. + while (T.hasAddressSpace()) { + TypeNode = Quals.strip(T); + + // If the type no longer has an address space after stripping qualifiers, + // jump out. + if (!QualType(TypeNode, 0).hasAddressSpace()) + break; - while (T.hasAddressSpace()) { - TypeNode = Quals.strip(T); - - // If the type no longer has an address space after stripping qualifiers, - // jump out. - if (!QualType(TypeNode, 0).hasAddressSpace()) - break; - - // There might be sugar in the way. Strip it and try again. - T = T.getSingleStepDesugaredType(*this); + // There might be sugar in the way. Strip it and try again. + T = T.getSingleStepDesugaredType(*this); + } } Quals.removeAddressSpace(); @@ -6093,7 +6099,7 @@ CanQualType ASTContext::getCanonicalParamType(QualType T) const { } QualType ASTContext::getUnqualifiedArrayType(QualType type, - Qualifiers &quals) { + Qualifiers &quals) const { SplitQualType splitType = type.getSplitUnqualifiedType(); // FIXME: getSplitUnqualifiedType() actually walks all the way to @@ -6488,7 +6494,8 @@ bool ASTContext::isSameDefaultTemplateArgument(const NamedDecl *X, if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument()) return false; - return hasSameType(TTPX->getDefaultArgument(), TTPY->getDefaultArgument()); + return hasSameType(TTPX->getDefaultArgument().getArgument().getAsType(), + TTPY->getDefaultArgument().getArgument().getAsType()); } if (auto *NTTPX = dyn_cast<NonTypeTemplateParmDecl>(X)) { |
