Driver: Warn when 'clang' is used to compile a source file we could

conceivably handle, but are defaulting to not using clang for.

llvm-svn: 67641
This commit is contained in:
Daniel Dunbar 2009-03-24 19:14:56 +00:00
parent 88f356e16b
commit 6b5244d600
2 changed files with 15 additions and 3 deletions

View File

@ -40,5 +40,11 @@ def warn_drv_unused_argument : Warning<
"argument unused during compilation: '%0'">;
def warn_drv_pipe_ignored_with_save_temps : Warning<
"-pipe ignored because -save-temps specified">;
def warn_drv_not_using_clang_cpp : Warning<
"not using the clang prepreprocessor due to user override">;
def warn_drv_not_using_clang_cxx : Warning<
"not using the clang compiler for C++ inputs">;
def warn_drv_not_using_clang_arch : Warning<
"not using the clang compiler the '%0' architecture">;
}

View File

@ -998,19 +998,25 @@ bool Driver::ShouldUseClangCompiler(const Compilation &C, const JobAction &JA,
// Otherwise make sure this is an action clang understands.
if (isa<PreprocessJobAction>(JA)) {
if (!CCCUseClangCPP)
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()))
if (!CCCUseClangCXX && types::isCXX((*JA.begin())->getType())) {
Diag(clang::diag::warn_drv_not_using_clang_cxx);
return false;
}
// Finally, don't use clang if this isn't one of the user specified
// archs to build.
if (!CCCClangArchs.empty() && !CCCClangArchs.count(ArchName))
if (!CCCClangArchs.empty() && !CCCClangArchs.count(ArchName)) {
Diag(clang::diag::warn_drv_not_using_clang_arch) << ArchName;
return false;
}
return true;
}