[cfe-commits] r67641 - in /cfe/trunk: include/clang/Basic/DiagnosticDriverKinds.td lib/Driver/Driver.cpp

Daniel Dunbar daniel at zuster.org
Tue Mar 24 12:14:56 PDT 2009


Author: ddunbar
Date: Tue Mar 24 14:14:56 2009
New Revision: 67641

URL: http://llvm.org/viewvc/llvm-project?rev=67641&view=rev
Log:
Driver: Warn when 'clang' is used to compile a source file we could
conceivably handle, but are defaulting to not using clang for.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
    cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=67641&r1=67640&r2=67641&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Tue Mar 24 14:14:56 2009
@@ -40,5 +40,11 @@
   "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">;
 
 }

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=67641&r1=67640&r2=67641&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Mar 24 14:14:56 2009
@@ -998,19 +998,25 @@
 
   // 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;
 }





More information about the cfe-commits mailing list