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.
llvm-svn: 208787
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 1f9e12b..afef700 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -4106,7 +4106,15 @@
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));
}