summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp5
-rw-r--r--clang/test/Rewriter/rewrite-try-catch.m2
2 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 0a1b2572d54..b9d15ad01ab 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1663,8 +1663,11 @@ void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), *Args, Diags);
ParseCodeGenArgs(Res.getCodeGenOpts(), *Args, DashX, Diags);
ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), *Args);
- if (DashX != IK_AST && DashX != IK_LLVM_IR)
+ if (DashX != IK_AST && DashX != IK_LLVM_IR) {
ParseLangArgs(Res.getLangOpts(), *Args, DashX, Diags);
+ if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)
+ Res.getLangOpts().ObjCExceptions = 1;
+ }
// FIXME: ParsePreprocessorArgs uses the FileManager to read the contents of
// PCH file and find the original header name. Remove the need to do that in
// ParsePreprocessorArgs and remove the FileManager
diff --git a/clang/test/Rewriter/rewrite-try-catch.m b/clang/test/Rewriter/rewrite-try-catch.m
index 5e7b3cf9040..d0c6d2acf67 100644
--- a/clang/test/Rewriter/rewrite-try-catch.m
+++ b/clang/test/Rewriter/rewrite-try-catch.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -rewrite-objc -fobjc-exceptions %s -o -
+// RUN: %clang_cc1 -rewrite-objc %s -o -
@interface Foo @end
@interface GARF @end
OpenPOWER on IntegriCloud