if (Args.hasArg(options::OPT__SLASH_fallback) &&
Output.getType() == types::TY_Object &&
(InputType == types::TY_C || InputType == types::TY_CXX)) {
- tools::visualstudio::Compile CL(getToolChain());
- Command *CLCommand = CL.GetCommand(C, JA, Output, Inputs, Args,
- LinkingOutput);
+ Command *CLCommand = getCLFallback()->GetCommand(C, JA, Output, Inputs,
+ Args, LinkingOutput);
// 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.
}
}
+visualstudio::Compile *Clang::getCLFallback() const {
+ if (!CLFallback)
+ CLFallback.reset(new visualstudio::Compile(getToolChain()));
+ return CLFallback.get();
+}
+
void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
}
namespace tools {
+
+namespace visualstudio {
+ class Compile;
+}
+
using llvm::opt::ArgStringList;
/// \brief Clang compiler tool.
void AddClangCLArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;
+ visualstudio::Compile *getCLFallback() const;
+
+ mutable std::unique_ptr<visualstudio::Compile> CLFallback;
+
public:
Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC) {}
};
} // end namespace dragonfly
- /// Visual studio tools.
+/// Visual studio tools.
namespace visualstudio {
class LLVM_LIBRARY_VISIBILITY Link : public Tool {
public: