r177311 - Objective-C modern translator. Don't put line info
Fariborz Jahanian
fjahanian at apple.com
Mon Mar 18 12:41:18 PDT 2013
Author: fjahanian
Date: Mon Mar 18 14:41:18 2013
New Revision: 177311
URL: http://llvm.org/viewvc/llvm-project?rev=177311&view=rev
Log:
Objective-C modern translator. Don't put line info
into the pre-preprocessed file to be passed to
modern translator when compiling in no debug mode.
// rdar://13138170
Added:
cfe/trunk/test/Rewriter/rewrite-line-directive.m
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=177311&r1=177310&r2=177311&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Mar 18 14:41:18 2013
@@ -1777,8 +1777,12 @@ void Clang::ConstructJob(Compilation &C,
} else if (isa<PreprocessJobAction>(JA)) {
if (Output.getType() == types::TY_Dependencies)
CmdArgs.push_back("-Eonly");
- else
+ else {
CmdArgs.push_back("-E");
+ if (Args.hasArg(options::OPT_rewrite_objc) &&
+ !Args.hasArg(options::OPT_g_Group))
+ CmdArgs.push_back("-P");
+ }
} else if (isa<AssembleJobAction>(JA)) {
CmdArgs.push_back("-emit-obj");
Added: cfe/trunk/test/Rewriter/rewrite-line-directive.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-line-directive.m?rev=177311&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-line-directive.m (added)
+++ cfe/trunk/test/Rewriter/rewrite-line-directive.m Mon Mar 18 14:41:18 2013
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -E %s -o %t.mm
+// RUN: %clang -fms-extensions -rewrite-objc %t.mm -o %t-rw.cpp
+// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
+// RUN: %clang -g -fms-extensions -rewrite-objc %t.mm -o %t-rw.cpp
+// RUN: FileCheck -check-prefix LPG --input-file=%t-rw.cpp %s
+// rdar://13138170
+
+int z();
+
+int x() {
+ id foo;
+ for (id y in foo) {
+ z();
+ }
+ return 0;
+}
+// CHECK-LP-NOT: #line
+// CHECK-LPG: #line
More information about the cfe-commits
mailing list