r208787 - clang-cl: Fall back immediately if /GR and /fallback were both passed
Reid Kleckner
reid at kleckner.net
Wed May 14 09:03:06 PDT 2014
Author: rnk
Date: Wed May 14 11:03:05 2014
New Revision: 208787
URL: http://llvm.org/viewvc/llvm-project?rev=208787&view=rev
Log:
clang-cl: Fall back immediately if /GR and /fallback were both passed
None of our tests use /fallback, so this lets us gradually add RTTI
support without breaking projects using /fallback.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/cl-fallback.c
Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=208787&r1=208786&r2=208787&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Wed May 14 11:03:05 2014
@@ -175,5 +175,8 @@ def err_drv_modules_validate_once_requir
"'-fbuild-session-timestamp=<seconds since Epoch>'">;
def warn_drv_invoking_fallback : Warning<"falling back to %0">,
- InGroup<DiagGroup<"fallback">>;
+ InGroup<Fallback>;
+def warn_drv_rtti_fallback :
+ Warning<"cannot compile RTTI yet, falling back to %0">,
+ InGroup<Fallback>;
}
Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=208787&r1=208786&r2=208787&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed May 14 11:03:05 2014
@@ -425,6 +425,7 @@ def Visibility : DiagGroup<"visibility">
def ZeroLengthArray : DiagGroup<"zero-length-array">;
def GNUZeroLineDirective : DiagGroup<"gnu-zero-line-directive">;
def GNUZeroVariadicMacroArguments : DiagGroup<"gnu-zero-variadic-macro-arguments">;
+def Fallback : DiagGroup<"fallback">;
// This covers both the deprecated case (in C++98)
// and the extension case (in C++11 onwards).
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=208787&r1=208786&r2=208787&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed May 14 11:03:05 2014
@@ -4106,7 +4106,15 @@ void Clang::ConstructJob(Compilation &C,
tools::visualstudio::Compile CL(getToolChain());
Command *CLCommand = CL.GetCommand(C, JA, Output, Inputs, Args,
LinkingOutput);
- C.addCommand(new FallbackCommand(JA, *this, Exec, CmdArgs, CLCommand));
+ // RTTI support in clang-cl is a work in progress. Fall back to MSVC early
+ // if we are using 'clang-cl /fallback /GR'.
+ // FIXME: Remove this when RTTI is finished.
+ if (Args.hasFlag(options::OPT_frtti, options::OPT_fno_rtti, false)) {
+ D.Diag(diag::warn_drv_rtti_fallback) << CLCommand->getExecutable();
+ C.addCommand(CLCommand);
+ } else {
+ C.addCommand(new FallbackCommand(JA, *this, Exec, CmdArgs, CLCommand));
+ }
} else {
C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
Modified: cfe/trunk/test/Driver/cl-fallback.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-fallback.c?rev=208787&r1=208786&r2=208787&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-fallback.c (original)
+++ cfe/trunk/test/Driver/cl-fallback.c Wed May 14 11:03:05 2014
@@ -54,6 +54,16 @@
// RUN: FileCheck -check-prefix=ErrWarn %s
// ErrWarn: warning: falling back to {{.*}}cl.exe
+// Don't attempt to run clang -cc1 with /fallback and /GR. It isn't ready yet.
+// RUN: %clang_cl /fallback /c /GR -### -- %s 2>&1 | \
+// RUN: FileCheck -check-prefix=RTTI %s
+// RTTI: warning: cannot compile RTTI yet, falling back to {{.*}}cl.exe
+// RUN: %clang_cl /fallback /c /GR /GR- -### -- %s 2>&1 | \
+// RUN: FileCheck -check-prefix=NO_RTTI %s
+// NO_RTTI: "-cc1"
+// NO_RTTI: ||
+// NO_RTTI: cl.exe
+
// Don't fall back on non-C or C++ files.
// RUN: %clang_cl /fallback -### -- %S/Inputs/file.ll 2>&1 | FileCheck -check-prefix=LL %s
// LL: file.ll
More information about the cfe-commits
mailing list