r198711 - [analyzer] Files with .c extensions are still C++ files if the compiler is CXX.

Jordan Rose jordan_rose at apple.com
Tue Jan 7 13:39:51 PST 2014


Author: jrose
Date: Tue Jan  7 15:39:51 2014
New Revision: 198711

URL: http://llvm.org/viewvc/llvm-project?rev=198711&view=rev
Log:
[analyzer] Files with .c extensions are still C++ files if the compiler is CXX.

PR18339

Modified:
    cfe/trunk/tools/scan-build/ccc-analyzer

Modified: cfe/trunk/tools/scan-build/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/ccc-analyzer?rev=198711&r1=198710&r2=198711&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/ccc-analyzer (original)
+++ cfe/trunk/tools/scan-build/ccc-analyzer Tue Jan  7 15:39:51 2014
@@ -29,6 +29,7 @@ my $Compiler;
 my $Clang;
 my $DefaultCCompiler;
 my $DefaultCXXCompiler;
+my $IsCXX;
 
 if (`uname -a` =~ m/Darwin/) { 
   $DefaultCCompiler = 'clang';
@@ -44,6 +45,8 @@ if ($FindBin::Script =~ /c\+\+-analyzer/
   
   $Clang = $ENV{'CLANG_CXX'};
   if (!defined $Clang) { $Clang = 'clang++'; }
+
+  $IsCXX = 1
 }
 else {
   $Compiler = $ENV{'CCC_CC'};
@@ -51,6 +54,8 @@ else {
 
   $Clang = $ENV{'CLANG'};
   if (!defined $Clang) { $Clang = 'clang'; }
+
+  $IsCXX = 0
 }
 
 ##===----------------------------------------------------------------------===##
@@ -377,18 +382,19 @@ my %IgnoredOptionMap = (
 );
 
 my %LangMap = (
-  'c'   => 'c',
+  'c'   => $IsCXX ? 'c++' : 'c',
   'cp'  => 'c++',
   'cpp' => 'c++',
   'cxx' => 'c++',
   'txx' => 'c++',
   'cc'  => 'c++',
   'C'   => 'c++',
-  'ii'  => 'c++',
-  'i'   => 'c-cpp-output',
+  'ii'  => 'c++-cpp-output',
+  'i'   => $IsCXX ? 'c++-cpp-output' : 'c-cpp-output',
   'm'   => 'objective-c',
   'mi'  => 'objective-c-cpp-output',
-  'mm'  => 'objective-c++'
+  'mm'  => 'objective-c++',
+  'mii' => 'objective-c++-cpp-output',
 );
 
 my %UniqueOptions = (





More information about the cfe-commits mailing list