summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-10-24 13:52:55 +0000
committerOlivier Goffart <ogoffart@woboq.com>2014-10-24 13:52:55 +0000
commitdf6d7b1564d292a339f07b17c7e38511e589be3d (patch)
tree98660b12129568e65f8d9daf6cdd2df84a221ab3 /clang/unittests/Tooling
parent8d69aedbd5de2aaf2b2dcbdb2e01aff319c32812 (diff)
downloadbcm5719-llvm-df6d7b1564d292a339f07b17c7e38511e589be3d.tar.gz
bcm5719-llvm-df6d7b1564d292a339f07b17c7e38511e589be3d.zip
Fix initializing TypeOfTypeLoc
This fixes a crash in the RecursiveASTVisitor on such code __typeof__(struct F*) var[invalid]; The UnderlyingTInfo of a TypeOfTypeLoc was left uninitialized when created from ASTContext::getTrivialTypeSourceInfo This lead to a crash in RecursiveASTVisitor when trying to access it. llvm-svn: 220562
Diffstat (limited to 'clang/unittests/Tooling')
-rw-r--r--clang/unittests/Tooling/RecursiveASTVisitorTestTypeLocVisitor.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTestTypeLocVisitor.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTestTypeLocVisitor.cpp
index 22c58836570..63e2e8b6024 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTestTypeLocVisitor.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTestTypeLocVisitor.cpp
@@ -79,4 +79,15 @@ TEST(RecursiveASTVisitor, VisitsObjCPropertyType) {
TypeLocVisitor::Lang_OBJC));
}
+TEST(RecursiveASTVisitor, VisitInvalidType) {
+ TypeLocVisitor Visitor;
+ // FIXME: It would be nice to have information about subtypes of invalid type
+ //Visitor.ExpectMatch("typeof(struct F *) []", 1, 1);
+ // Even if the full type is invalid, it should still find sub types
+ //Visitor.ExpectMatch("struct F", 1, 19);
+ EXPECT_FALSE(Visitor.runOver(
+ "__typeof__(struct F*) var[invalid];\n",
+ TypeLocVisitor::Lang_C));
+}
+
} // end anonymous namespace
OpenPOWER on IntegriCloud