]> granicus.if.org Git - clang/commitdiff
Driver: Warn when 'clang' is used to compile a source file we could
authorDaniel Dunbar <daniel@zuster.org>
Tue, 24 Mar 2009 19:14:56 +0000 (19:14 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 24 Mar 2009 19:14:56 +0000 (19:14 +0000)
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

include/clang/Basic/DiagnosticDriverKinds.td
lib/Driver/Driver.cpp

index e8cfa371eeeb2ca5b3dbb78be4eb78e6f531c08d..3fb816ee63f300e2150e1368eae5b6baa5432a1b 100644 (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">;
 
 }
index 4411ac6fd20a3c48f543ba80de79ce4fbc55c71b..c8ea4f8efe221b7b1632949e4413fa6fe78ca6e2 100644 (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;
 }