]> granicus.if.org Git - clang/commitdiff
Modern objcective-C translator. When doing rewriting, Do not
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 28 Sep 2012 19:05:17 +0000 (19:05 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 28 Sep 2012 19:05:17 +0000 (19:05 +0000)
use the integrated pre-processor, preprocess in objective-c++ mode.
// rdar://12189793.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164836 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp
lib/Driver/Tools.cpp
test/Driver/rewrite-objc.m

index afdc2a3bbbbbf69e65bd67d60945f9c1bfbf3655..918bc971d66816ae3590b6fc5494d6b2918e9424 100644 (file)
@@ -1392,6 +1392,7 @@ static const Tool &SelectToolForJob(Compilation &C, const ToolChain *TC,
       !C.getArgs().hasArg(options::OPT_no_integrated_cpp) &&
       !C.getArgs().hasArg(options::OPT_traditional_cpp) &&
       !C.getArgs().hasArg(options::OPT_save_temps) &&
+      !C.getArgs().hasArg(options::OPT_rewrite_objc) &&
       ToolForJob->hasIntegratedCPP())
     Inputs = &(*Inputs)[0]->getInputs();
 
index 12564b43f6c9c990c0ae7e01a91cdc11882d379e..3d1c9f4e8cf09d38bf25169ab2ccc8ffe4eb0546 100644 (file)
@@ -2852,7 +2852,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
          it = Inputs.begin(), ie = Inputs.end(); it != ie; ++it) {
     const InputInfo &II = *it;
     CmdArgs.push_back("-x");
-    CmdArgs.push_back(types::getTypeName(II.getType()));
+    if (Args.hasArg(options::OPT_rewrite_objc))
+      CmdArgs.push_back(types::getTypeName(types::TY_PP_ObjCXX));
+    else
+      CmdArgs.push_back(types::getTypeName(II.getType()));
     if (II.isFilename())
       CmdArgs.push_back(II.getFilename());
     else
index 669679772203395409f357815c29928981b3de78..9ed322fb404adafa6c561ea65b2578fe158c8637 100644 (file)
@@ -4,7 +4,6 @@
 // TEST0: "-rewrite-objc"
 // FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
 // TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
-// TEST0: rewrite-objc.m"
 
 // RUN: not %clang -ccc-no-clang -target unknown -rewrite-objc %s -o - -### 2>&1 | \
 // RUN:   FileCheck -check-prefix=TEST1 %s