Ensure canonical type is actually canonical.
ASTContext::applyObjCProtocolQualifiers will return a canonical type when given
a canonical type and an array of canonical protocols. If the protocols are not
canonical then the returned type is also not canonical. Since a canonical type is needed, canonicalize the returned type before using it. This later prevents
a type from having a non-canonical canonical type.
llvm-svn: 341013
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 098abf2..ab2a95e 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -4550,8 +4550,8 @@
if (!protocols.empty()) {
// Apply the protocol qualifers.
bool hasError;
- Canonical = applyObjCProtocolQualifiers(Canonical, protocols, hasError,
- true/*allowOnPointerType*/);
+ Canonical = getCanonicalType(applyObjCProtocolQualifiers(
+ Canonical, protocols, hasError, true /*allowOnPointerType*/));
assert(!hasError && "Error when apply protocol qualifier to bound type");
}
}