]> granicus.if.org Git - clang/commitdiff
Driver: Forward -traditional and -traditional-cpp in preprocessing modes.
authorDaniel Dunbar <daniel@zuster.org>
Fri, 18 Mar 2011 21:23:40 +0000 (21:23 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 18 Mar 2011 21:23:40 +0000 (21:23 +0000)
 - We don't really support the majority of the horrible -traditional-cpp
   behavior, but it is unlikely that we ever will either. This allows us to
   start trying to use clang as a /usr/bin/cpp replacement and see what pieces
   of -traditional-cpp mode people actually care about.

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

lib/Driver/Tools.cpp

index ee4976ee72b482716602fc8519b3b9901e2230bc..1c3112aeca2575a8a194fc6770ac6f78b69fc3ed 100644 (file)
@@ -1773,9 +1773,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   }
 #endif
 
+  // Only allow -traditional or -traditional-cpp outside in preprocessing modes.
   if (Arg *A = Args.getLastArg(options::OPT_traditional,
-                               options::OPT_traditional_cpp))
-    D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args);
+                               options::OPT_traditional_cpp)) {
+    if (isa<PreprocessJobAction>(JA))
+      CmdArgs.push_back("-traditional-cpp");
+    else 
+      D.Diag(clang::diag::err_drv_clang_unsupported) << A->getAsString(Args);
+  }
 
   Args.AddLastArg(CmdArgs, options::OPT_dM);
   Args.AddLastArg(CmdArgs, options::OPT_dD);