summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-04 23:16:01 +0000
committerChris Lattner <sabre@nondot.org>2010-09-04 23:16:01 +0000
commitedbdff64c720d143b5ae7ace2733256b51be8bb9 (patch)
tree090fa504912ee462e3bc80c9082d9a441de79725
parent313358fef92d733cdb5aa94356364f165e956a7f (diff)
downloadbcm5719-llvm-edbdff64c720d143b5ae7ace2733256b51be8bb9.tar.gz
bcm5719-llvm-edbdff64c720d143b5ae7ace2733256b51be8bb9.zip
revise r112365 to fix the actual problem: the isa<TagType>(Underlying)
check in the "typedef for anonymous type" check should have been a getAs. llvm-svn: 113085
-rw-r--r--clang/lib/AST/ASTDiagnostic.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 23f323d0286..321a139665f 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -81,10 +81,10 @@ break; \
break;
// Don't desugar through the primary typedef of an anonymous type.
- if (isa<TagType>(Underlying) && isa<TypedefType>(QT))
- if (cast<TagType>(Underlying)->getDecl()->getTypedefForAnonDecl() ==
- cast<TypedefType>(QT)->getDecl())
- break;
+ if (const TagType *UTT = Underlying->getAs<TagType>())
+ if (const TypedefType *QTT = dyn_cast<TypedefType>(QT))
+ if (UTT->getDecl()->getTypedefForAnonDecl() == QTT->getDecl())
+ break;
// Record that we actually looked through an opaque type here.
ShouldAKA = true;
@@ -94,11 +94,11 @@ break; \
// If we have a pointer-like type, desugar the pointee as well.
// FIXME: Handle other pointer-like types.
if (const PointerType *Ty = QT->getAs<PointerType>()) {
- QT = Context.getPointerType(Desugar(Context, Ty->getPointeeType(),
- ShouldAKA));
+ QT = Context.getPointerType(Desugar(Context, Ty->getPointeeType(),
+ ShouldAKA));
} else if (const LValueReferenceType *Ty = QT->getAs<LValueReferenceType>()) {
- QT = Context.getLValueReferenceType(Desugar(Context, Ty->getPointeeType(),
- ShouldAKA));
+ QT = Context.getLValueReferenceType(Desugar(Context, Ty->getPointeeType(),
+ ShouldAKA));
}
return QC.apply(QT);
@@ -151,13 +151,10 @@ ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty,
bool ShouldAKA = false;
QualType DesugaredTy = Desugar(Context, Ty, ShouldAKA);
if (ShouldAKA) {
- std::string D = DesugaredTy.getAsString(Context.PrintingPolicy);
- if (D != S) {
- S = "'" + S + "' (aka '";
- S += D;
- S += "')";
- return S;
- }
+ S = "'" + S + "' (aka '";
+ S += DesugaredTy.getAsString(Context.PrintingPolicy);
+ S += "')";
+ return S;
}
}
OpenPOWER on IntegriCloud