[cfe-commits] r127911 - /cfe/trunk/lib/Driver/Tools.cpp

Daniel Dunbar daniel at zuster.org
Fri Mar 18 14:23:40 PDT 2011


Author: ddunbar
Date: Fri Mar 18 16:23:40 2011
New Revision: 127911

URL: http://llvm.org/viewvc/llvm-project?rev=127911&view=rev
Log:
Driver: Forward -traditional and -traditional-cpp in preprocessing modes.
 - 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.

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=127911&r1=127910&r2=127911&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Mar 18 16:23:40 2011
@@ -1773,9 +1773,14 @@
   }
 #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);





More information about the cfe-commits mailing list