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: 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: <> +// 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: tools/clang-import-test/clang-import-test.cpp =================================================================== --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -196,6 +196,8 @@ Inv->getLangOpts()->DollarIdents = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; + Inv->getLangOpts()->Exceptions = true; + Inv->getLangOpts()->CXXExceptions = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple();