bool Driver::ShouldUseClangCompiler(const Compilation &C, const JobAction &JA, const std::string &ArchNameStr) const { // FIXME: Remove this hack. const char *ArchName = ArchNameStr.c_str(); if (ArchNameStr == "powerpc") ArchName = "ppc"; else if (ArchNameStr == "powerpc64") ArchName = "ppc64"; // Check if user requested no clang, or clang doesn't understand // this type (we only handle single inputs for now). if (!CCCUseClang || JA.size() != 1 || !types::isAcceptedByClang((*JA.begin())->getType())) return false; // Otherwise make sure this is an action clang understands. if (isa<PreprocessJobAction>(JA)) { if (!CCCUseClangCPP) { Diag(clang::diag::warn_drv_not_using_clang_cpp); return false; } } else if (!isa<PrecompileJobAction>(JA) && !isa<CompileJobAction>(JA)) return false; // Use clang for C++? if (!CCCUseClangCXX && types::isCXX((*JA.begin())->getType())) { Diag(clang::diag::warn_drv_not_using_clang_cxx); return false; } // Always use clang for precompiling, regardless of archs. PTH is // platform independent, and this allows the use of the static // analyzer on platforms we don't have full IRgen support for. if (isa<PrecompileJobAction>(JA)) return true; // Finally, don't use clang if this isn't one of the user specified // archs to build. if (!CCCClangArchs.empty() && !CCCClangArchs.count(ArchName)) { Diag(clang::diag::warn_drv_not_using_clang_arch) << ArchName; return false; } return true; }
bool Driver::ShouldUseClangCompiler(const Compilation &C, const JobAction &JA, const llvm::Triple &Triple) const { // Check if user requested no clang, or clang doesn't understand this type (we // only handle single inputs for now). if (!CCCUseClang || JA.size() != 1 || !types::isAcceptedByClang((*JA.begin())->getType())) return false; // Otherwise make sure this is an action clang understands. if (isa<PreprocessJobAction>(JA)) { if (!CCCUseClangCPP) { Diag(clang::diag::warn_drv_not_using_clang_cpp); return false; } } else if (!isa<PrecompileJobAction>(JA) && !isa<CompileJobAction>(JA)) return false; // Use clang for C++? if (!CCCUseClangCXX && types::isCXX((*JA.begin())->getType())) { Diag(clang::diag::warn_drv_not_using_clang_cxx); return false; } // Always use clang for precompiling, AST generation, and rewriting, // regardless of archs. if (isa<PrecompileJobAction>(JA) || JA.getType() == types::TY_AST || JA.getType() == types::TY_RewrittenObjC) return true; // Finally, don't use clang if this isn't one of the user specified archs to // build. if (!CCCClangArchs.empty() && !CCCClangArchs.count(Triple.getArch())) { Diag(clang::diag::warn_drv_not_using_clang_arch) << Triple.getArchName(); return false; } return true; }