teemperor updated this revision to Diff 161580.
teemperor added a comment.
- Clarified that the Exception options in LangOpts are not related to the
dynamic_cast support by moving them above the comment (Thanks Aleksei!)
https://reviews.llvm.org/D50978
Files:
test/Import/cxx-try-catch/Inputs/F.cpp
test/Import/cxx-try-catch/test.cpp
tools/clang-import-test/clang-import-test.cpp
Index: tools/clang-import-test/clang-import-test.cpp
===================================================================
--- tools/clang-import-test/clang-import-test.cpp
+++ tools/clang-import-test/clang-import-test.cpp
@@ -194,6 +194,8 @@
Inv->getLangOpts()->ThreadsafeStatics = false;
Inv->getLangOpts()->AccessControl = false;
Inv->getLangOpts()->DollarIdents = true;
+ Inv->getLangOpts()->Exceptions = true;
+ Inv->getLangOpts()->CXXExceptions = true;
// Needed for testing dynamic_cast.
Inv->getLangOpts()->RTTI = true;
Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo);
Index: test/Import/cxx-try-catch/test.cpp
===================================================================
--- /dev/null
+++ test/Import/cxx-try-catch/test.cpp
@@ -0,0 +1,39 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s |
FileCheck %s
+
+// CHECK: CXXTryStmt
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CXXCatchStmt
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: CompoundStmt
+
+// CHECK: CXXTryStmt
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CXXCatchStmt
+// CHECK-NEXT: VarDecl
+// CHECK-SAME: 'int'
+// CHECK-NEXT: CompoundStmt
+
+// CHECK: CXXTryStmt
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CXXCatchStmt
+// CHECK-NEXT: VarDecl
+// CHECK-SAME: varname
+// CHECK-SAME: 'int'
+// CHECK-NEXT: CompoundStmt
+
+// CHECK: CXXTryStmt
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CXXCatchStmt
+// CHECK-NEXT: VarDecl
+// CHECK-SAME: varname1
+// CHECK-SAME: 'int'
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CXXCatchStmt
+// CHECK-NEXT: VarDecl
+// CHECK-SAME: varname2
+// CHECK-SAME: 'long'
+// CHECK-NEXT: CompoundStmt
+
+void expr() {
+ f();
+}
Index: test/Import/cxx-try-catch/Inputs/F.cpp
===================================================================
--- /dev/null
+++ test/Import/cxx-try-catch/Inputs/F.cpp
@@ -0,0 +1,18 @@
+void f() {
+ try {
+ } catch (...) {
+ }
+
+ try {
+ } catch (int) {
+ }
+
+ try {
+ } catch (int varname) {
+ }
+
+ try {
+ } catch (int varname1) {
+ } catch (long varname2) {
+ }
+}
Index: tools/clang-import-test/clang-import-test.cpp
===================================================================
--- tools/clang-import-test/clang-import-test.cpp
+++ tools/clang-import-test/clang-import-test.cpp
@@ -194,6 +194,8 @@
Inv->getLangOpts()->ThreadsafeStatics = false;
Inv->getLangOpts()->AccessControl = false;
Inv->getLangOpts()->DollarIdents = true;
+ Inv->getLangOpts()->Exceptions = true;
+ Inv->getLangOpts()->CXXExceptions = true;
// Needed for testing dynamic_cast.
Inv->getLangOpts()->RTTI = true;
Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo);
Index: test/Import/cxx-try-catch/test.cpp
===================================================================
--- /dev/null
+++ test/Import/cxx-try-catch/test.cpp
@@ -0,0 +1,39 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s
+
+// CHECK: CXXTryStmt
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CXXCatchStmt
+// CHECK-NEXT: <<NULL>>
+// CHECK-NEXT: CompoundStmt
+
+// CHECK: CXXTryStmt
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CXXCatchStmt
+// CHECK-NEXT: VarDecl
+// CHECK-SAME: 'int'
+// CHECK-NEXT: CompoundStmt
+
+// CHECK: CXXTryStmt
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CXXCatchStmt
+// CHECK-NEXT: VarDecl
+// CHECK-SAME: varname
+// CHECK-SAME: 'int'
+// CHECK-NEXT: CompoundStmt
+
+// CHECK: CXXTryStmt
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CXXCatchStmt
+// CHECK-NEXT: VarDecl
+// CHECK-SAME: varname1
+// CHECK-SAME: 'int'
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: CXXCatchStmt
+// CHECK-NEXT: VarDecl
+// CHECK-SAME: varname2
+// CHECK-SAME: 'long'
+// CHECK-NEXT: CompoundStmt
+
+void expr() {
+ f();
+}
Index: test/Import/cxx-try-catch/Inputs/F.cpp
===================================================================
--- /dev/null
+++ test/Import/cxx-try-catch/Inputs/F.cpp
@@ -0,0 +1,18 @@
+void f() {
+ try {
+ } catch (...) {
+ }
+
+ try {
+ } catch (int) {
+ }
+
+ try {
+ } catch (int varname) {
+ }
+
+ try {
+ } catch (int varname1) {
+ } catch (long varname2) {
+ }
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits