summaryrefslogtreecommitdiffstats
path: root/clang/test/Misc/ast-dump-invalid.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2015-10-11 17:27:29 +0000
committerOlivier Goffart <ogoffart@woboq.com>2015-10-11 17:27:29 +0000
commit122993bfd69de0501a0eff387c7468ea30f18809 (patch)
treeb4105793f25f27ed0554bc0270a12bfd77e71491 /clang/test/Misc/ast-dump-invalid.cpp
parent602b0e1f0bf1b01f59aa174703a2c691272db2a7 (diff)
downloadbcm5719-llvm-122993bfd69de0501a0eff387c7468ea30f18809.tar.gz
bcm5719-llvm-122993bfd69de0501a0eff387c7468ea30f18809.zip
Keep the IfStmt node even if the condition is invalid
This is important to keep the information in IDE or other tools even if the code contains a few errors llvm-svn: 249982
Diffstat (limited to 'clang/test/Misc/ast-dump-invalid.cpp')
-rw-r--r--clang/test/Misc/ast-dump-invalid.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Misc/ast-dump-invalid.cpp b/clang/test/Misc/ast-dump-invalid.cpp
index 3b97cc65409..7b02ba11133 100644
--- a/clang/test/Misc/ast-dump-invalid.cpp
+++ b/clang/test/Misc/ast-dump-invalid.cpp
@@ -18,3 +18,26 @@ void f(T i, T j) {
// CHECK-NEXT: `-CXXUnresolvedConstructExpr {{.*}} <col:10, col:16> 'T'
// CHECK-NEXT: |-DeclRefExpr {{.*}} <col:13> 'T' lvalue ParmVar {{.*}} 'i' 'T'
// CHECK-NEXT: `-DeclRefExpr {{.*}} <col:16> 'T' lvalue ParmVar {{.*}} 'j' 'T'
+
+
+namespace TestInvalidIf {
+int g(int i) {
+ if (invalid_condition)
+ return 4;
+ else
+ return i;
+}
+}
+// CHECK: NamespaceDecl {{.*}} <{{.*}}> {{.*}} TestInvalidIf
+// CHECK-NEXT: `-FunctionDecl
+// CHECK-NEXT: |-ParmVarDecl
+// CHECK-NEXT: `-CompoundStmt
+// CHECK-NEXT: `-IfStmt {{.*}} <line:25:3, line:28:12>
+// CHECK-NEXT: |-<<<NULL>>>
+// CHECK-NEXT: |-OpaqueValueExpr {{.*}} <<invalid sloc>> '_Bool'
+// CHECK-NEXT: |-ReturnStmt {{.*}} <line:26:5, col:12>
+// CHECK-NEXT: | `-IntegerLiteral {{.*}} <col:12> 'int' 4
+// CHECK-NEXT: `-ReturnStmt {{.*}} <line:28:5, col:12>
+// CHECK-NEXT: `-ImplicitCastExpr {{.*}} <col:12> 'int' <LValueToRValue>
+// CHECK-NEXT: `-DeclRefExpr {{.*}} <col:12> 'int' lvalue ParmVar {{.*}} 'i' 'int'
+
OpenPOWER on IntegriCloud