From: Daniel Dunbar Date: Tue, 24 Mar 2009 19:14:56 +0000 (+0000) Subject: Driver: Warn when 'clang' is used to compile a source file we could X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6256d3654533547a7996170647c21a859cb441e1;p=clang Driver: Warn when 'clang' is used to compile a source file we could conceivably handle, but are defaulting to not using clang for. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67641 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index e8cfa371ee..3fb816ee63 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -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">; } diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 4411ac6fd2..c8ea4f8efe 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -998,19 +998,25 @@ bool Driver::ShouldUseClangCompiler(const Compilation &C, const JobAction &JA, // Otherwise make sure this is an action clang understands. if (isa(JA)) { - if (!CCCUseClangCPP) + if (!CCCUseClangCPP) { + Diag(clang::diag::warn_drv_not_using_clang_cpp); return false; + } } else if (!isa(JA) && !isa(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; }