[PATCH] clang-cl: implement /fallback mode
Reid Kleckner
rnk at google.com
Wed Sep 18 16:45:33 PDT 2013
================
Comment at: include/clang/Driver/CLCompatOptions.td:114
@@ -113,1 +113,3 @@
+def _SLASH_fallback : CLCompileFlag<"fallback">,
+ HelpText<"Fall back to cl.exe if clang-cl fails due to internal error">;
def _SLASH_Fe : CLJoined<"Fe">,
----------------
Do we want to support multiple fallback modes like fallback for internal errors or fallback for any error? I guess we can just use this and see what comes up in practice, and eventually get to a place where we only fallback on "could not compile 'foo' yet" diagnostics.
================
Comment at: lib/Driver/Tools.cpp:6721
@@ +6720,3 @@
+
+ // FIXME: If we've put clang-cl as cl.exe on the path, then we might have a problem now :/
+ const char *Exec =
----------------
That seems problematic. You could use sys::fs::equivalent() to skip a path if it's the current executable, but we'd have to sink that into GetProgramPath().
================
Comment at: test/Driver/cl-fallback.c:8
@@ +7,3 @@
+// RUN: %clang_cl /fallback /Dfoo=bar /Ubaz /Ifoo /Ox /O0 /GR /GR- /LD /LDd \
+// RUN: /MD /MDd /MTd /MT -### -- %s 2>&1 | FileCheck %s
+// CHECK: ||
----------------
I guess that's the most testing we can do here. Oh well.
================
Comment at: lib/Driver/Tools.cpp:6687
@@ +6686,3 @@
+ // Flags for which clang-cl have an alias.
+ // FIXME: Could we avoid this manual reverse translation?
+
----------------
Can you iterate over Args.getArgString(I) up to getNumInputArgStrings(), or does that fail?
================
Comment at: lib/Driver/Tools.cpp:3566
@@ +3565,3 @@
+ if (Args.hasArg(options::OPT__SLASH_fallback)) {
+ // FIXME: This is where it gets crazy :)
+ tools::visualstudio::Compile CL(getToolChain());
----------------
I don't see any better way to do it, so this is probably OK. No need for FIXME. :)
http://llvm-reviews.chandlerc.com/D1711
More information about the cfe-commits
mailing list