diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-04-02 08:55:10 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-04-02 08:55:10 +0000 |
commit | 07b2cfcdb817cc0790420f159a313d61e7241cb9 (patch) | |
tree | d374cdca417e76f1bf101f139dba2db1d10ee8f7 /tools | |
parent | 1e255aab650a7fa2047fd953cae65b12215280af (diff) | |
download | FreeBSD-src-07b2cfcdb817cc0790420f159a313d61e7241cb9.zip FreeBSD-src-07b2cfcdb817cc0790420f159a313d61e7241cb9.tar.gz |
Update clang to r100181.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/CIndex/CIndex.cpp | 7 | ||||
-rw-r--r-- | tools/CIndex/CIndexDiagnostic.cpp | 3 | ||||
-rw-r--r-- | tools/CIndex/CIndexUSRs.cpp | 21 | ||||
-rw-r--r-- | tools/CIndex/CMakeLists.txt | 4 | ||||
-rw-r--r-- | tools/c-index-test/c-index-test.c | 191 | ||||
-rw-r--r-- | tools/driver/Makefile | 8 | ||||
-rw-r--r-- | tools/driver/cc1_main.cpp | 53 | ||||
-rw-r--r-- | tools/driver/driver.cpp | 28 | ||||
-rwxr-xr-x | tools/scan-build/scan-build | 11 |
9 files changed, 278 insertions, 48 deletions
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp index 1000818..998fbbb 100644 --- a/tools/CIndex/CIndex.cpp +++ b/tools/CIndex/CIndex.cpp @@ -1078,9 +1078,8 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx, // stderr and stdout in the file system, all with different buffers // but writing to the same device. fflush(stderr); -#endif +#endif } - return 0; } return Unit.take(); @@ -1737,7 +1736,7 @@ CXSourceLocation clang_getCursorLocation(CXCursor C) { SourceLocation Loc = D->getLocation(); if (ObjCInterfaceDecl *Class = dyn_cast<ObjCInterfaceDecl>(D)) Loc = Class->getClassLoc(); - return cxloc::translateSourceLocation(D->getASTContext(), Loc); + return cxloc::translateSourceLocation(getCursorContext(C), Loc); } CXSourceRange clang_getCursorExtent(CXCursor C) { @@ -1800,7 +1799,7 @@ CXSourceRange clang_getCursorExtent(CXCursor C) { return clang_getNullRange(); Decl *D = getCursorDecl(C); - return cxloc::translateSourceRange(D->getASTContext(), D->getSourceRange()); + return cxloc::translateSourceRange(getCursorContext(C), D->getSourceRange()); } CXCursor clang_getCursorReferenced(CXCursor C) { diff --git a/tools/CIndex/CIndexDiagnostic.cpp b/tools/CIndex/CIndexDiagnostic.cpp index 6aed49e..0314a67 100644 --- a/tools/CIndex/CIndexDiagnostic.cpp +++ b/tools/CIndex/CIndexDiagnostic.cpp @@ -201,7 +201,7 @@ CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic, unsigned FixIt, return createCXString(""); } - const CodeModificationHint &Hint = StoredDiag->Diag.fixit_begin()[FixIt]; + const FixItHint &Hint = StoredDiag->Diag.fixit_begin()[FixIt]; if (ReplacementRange) { if (Hint.RemoveRange.isInvalid()) { // Create an empty range that refers to a single source @@ -265,6 +265,7 @@ void clang::LoadSerializedDiagnostics(const llvm::sys::Path &DiagnosticsPath, } SourceMgr.overrideFileContents(File, Buffer); + SourceMgr.createFileID(File, SourceLocation(), SrcMgr::C_User); } // Parse the diagnostics, emitting them one by one until we've diff --git a/tools/CIndex/CIndexUSRs.cpp b/tools/CIndex/CIndexUSRs.cpp index 8521971..379320c 100644 --- a/tools/CIndex/CIndexUSRs.cpp +++ b/tools/CIndex/CIndexUSRs.cpp @@ -79,7 +79,10 @@ private: USRGenerator UG; public: StringUSRGenerator() - : Out(StrBuf), UG(Out) {} + : Out(StrBuf), UG(Out) { + // Add the USR space prefix. + Out << "c:"; + } llvm::StringRef str() { return Out.str(); @@ -266,16 +269,22 @@ CXString clang_getCursorUSR(CXCursor C) { StringUSRGenerator SUG; SUG->Visit(static_cast<Decl*>(D)); - if (SUG->ignoreResults() || SUG.str().empty()) + if (SUG->ignoreResults()) return createCXString(""); // Return a copy of the string that must be disposed by the caller. return createCXString(SUG.str(), true); } +static inline llvm::StringRef extractUSRSuffix(llvm::StringRef s) { + if (!(s.size() >= 2 && s[0] == 'c' && s[1] == ':')) + return ""; + return s.substr(2); +} + CXString clang_constructUSR_ObjCIvar(const char *name, CXString classUSR) { StringUSRGenerator SUG; - SUG << clang_getCString(classUSR); + SUG << extractUSRSuffix(clang_getCString(classUSR)); SUG->GenObjCIvar(name); return createCXString(SUG.str(), true); } @@ -284,7 +293,7 @@ CXString clang_constructUSR_ObjCMethod(const char *name, unsigned isInstanceMethod, CXString classUSR) { StringUSRGenerator SUG; - SUG << clang_getCString(classUSR); + SUG << extractUSRSuffix(clang_getCString(classUSR)); SUG->GenObjCMethod(name, isInstanceMethod); return createCXString(SUG.str(), true); } @@ -302,7 +311,7 @@ CXString clang_constructUSR_ObjCProtocol(const char *name) { } CXString clang_constructUSR_ObjCCategory(const char *class_name, - const char *category_name) { + const char *category_name) { StringUSRGenerator SUG; SUG->GenObjCCategory(class_name, category_name); return createCXString(SUG.str(), true); @@ -311,7 +320,7 @@ CXString clang_constructUSR_ObjCCategory(const char *class_name, CXString clang_constructUSR_ObjCProperty(const char *property, CXString classUSR) { StringUSRGenerator SUG; - SUG << clang_getCString(classUSR); + SUG << extractUSRSuffix(clang_getCString(classUSR)); SUG->GenObjCProperty(property); return createCXString(SUG.str(), true); } diff --git a/tools/CIndex/CMakeLists.txt b/tools/CIndex/CMakeLists.txt index e94a786..6aa7a57 100644 --- a/tools/CIndex/CMakeLists.txt +++ b/tools/CIndex/CMakeLists.txt @@ -43,10 +43,10 @@ if(MSVC) # windows.h doesn't compile with /Za get_target_property(NON_ANSI_COMPILE_FLAGS CIndex COMPILE_FLAGS) string(REPLACE /Za "" NON_ANSI_COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS}) - set(NON_ANSI_COMPILE_FLAGS "${NON_ANSI_COMPILE_FLAGS} /D_CINDEX_LIB_") set_target_properties(CIndex PROPERTIES COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS}) endif(MSVC) set_target_properties(CIndex PROPERTIES - LINKER_LANGUAGE CXX) + LINKER_LANGUAGE CXX + DEFINE_SYMBOL _CINDEX_LIB_) diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 38c8811..d7f3483 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -202,14 +202,14 @@ void PrintDiagnostic(CXDiagnostic Diagnostic) { unsigned display_opts = CXDiagnostic_DisplaySourceLocation | CXDiagnostic_DisplayColumn | CXDiagnostic_DisplaySourceRanges; unsigned i, num_fixits; - + if (clang_getDiagnosticSeverity(Diagnostic) == CXDiagnostic_Ignored) return; Msg = clang_formatDiagnostic(Diagnostic, display_opts); fprintf(stderr, "%s\n", clang_getCString(Msg)); clang_disposeString(Msg); - + clang_getInstantiationLocation(clang_getDiagnosticLocation(Diagnostic), &file, 0, 0, 0); if (!file) @@ -223,7 +223,7 @@ void PrintDiagnostic(CXDiagnostic Diagnostic) { CXSourceLocation end = clang_getRangeEnd(range); unsigned start_line, start_column, end_line, end_column; CXFile start_file, end_file; - clang_getInstantiationLocation(start, &start_file, &start_line, + clang_getInstantiationLocation(start, &start_file, &start_line, &start_column, 0); clang_getInstantiationLocation(end, &end_file, &end_line, &end_column, 0); if (clang_equalLocations(start, end)) { @@ -979,6 +979,177 @@ int perform_token_annotation(int argc, const char **argv) { } /******************************************************************************/ +/* USR printing. */ +/******************************************************************************/ + +static int insufficient_usr(const char *kind, const char *usage) { + fprintf(stderr, "USR for '%s' requires: %s\n", kind, usage); + return 1; +} + +static unsigned isUSR(const char *s) { + return s[0] == 'c' && s[1] == ':'; +} + +static int not_usr(const char *s, const char *arg) { + fprintf(stderr, "'%s' argument ('%s') is not a USR\n", s, arg); + return 1; +} + +static void print_usr(CXString usr) { + const char *s = clang_getCString(usr); + printf("%s\n", s); + clang_disposeString(usr); +} + +static void display_usrs() { + fprintf(stderr, "-print-usrs options:\n" + " ObjCCategory <class name> <category name>\n" + " ObjCClass <class name>\n" + " ObjCIvar <ivar name> <class USR>\n" + " ObjCMethod <selector> [0=class method|1=instance method] " + "<class USR>\n" + " ObjCProperty <property name> <class USR>\n" + " ObjCProtocol <protocol name>\n"); +} + +int print_usrs(const char **I, const char **E) { + while (I != E) { + const char *kind = *I; + unsigned len = strlen(kind); + switch (len) { + case 8: + if (memcmp(kind, "ObjCIvar", 8) == 0) { + if (I + 2 >= E) + return insufficient_usr(kind, "<ivar name> <class USR>"); + if (!isUSR(I[2])) + return not_usr("<class USR>", I[2]); + else { + CXString x; + x.Spelling = I[2]; + x.MustFreeString = 0; + print_usr(clang_constructUSR_ObjCIvar(I[1], x)); + } + + I += 3; + continue; + } + break; + case 9: + if (memcmp(kind, "ObjCClass", 9) == 0) { + if (I + 1 >= E) + return insufficient_usr(kind, "<class name>"); + print_usr(clang_constructUSR_ObjCClass(I[1])); + I += 2; + continue; + } + break; + case 10: + if (memcmp(kind, "ObjCMethod", 10) == 0) { + if (I + 3 >= E) + return insufficient_usr(kind, "<method selector> " + "[0=class method|1=instance method] <class USR>"); + if (!isUSR(I[3])) + return not_usr("<class USR>", I[3]); + else { + CXString x; + x.Spelling = I[3]; + x.MustFreeString = 0; + print_usr(clang_constructUSR_ObjCMethod(I[1], atoi(I[2]), x)); + } + I += 4; + continue; + } + break; + case 12: + if (memcmp(kind, "ObjCCategory", 12) == 0) { + if (I + 2 >= E) + return insufficient_usr(kind, "<class name> <category name>"); + print_usr(clang_constructUSR_ObjCCategory(I[1], I[2])); + I += 3; + continue; + } + if (memcmp(kind, "ObjCProtocol", 12) == 0) { + if (I + 1 >= E) + return insufficient_usr(kind, "<protocol name>"); + print_usr(clang_constructUSR_ObjCProtocol(I[1])); + I += 2; + continue; + } + if (memcmp(kind, "ObjCProperty", 12) == 0) { + if (I + 2 >= E) + return insufficient_usr(kind, "<property name> <class USR>"); + if (!isUSR(I[2])) + return not_usr("<class USR>", I[2]); + else { + CXString x; + x.Spelling = I[2]; + x.MustFreeString = 0; + print_usr(clang_constructUSR_ObjCProperty(I[1], x)); + } + I += 3; + continue; + } + break; + default: + break; + } + break; + } + + if (I != E) { + fprintf(stderr, "Invalid USR kind: %s\n", *I); + display_usrs(); + return 1; + } + return 0; +} + +int print_usrs_file(const char *file_name) { + char line[2048]; + const char *args[128]; + unsigned numChars = 0; + + FILE *fp = fopen(file_name, "r"); + if (!fp) { + fprintf(stderr, "error: cannot open '%s'\n", file_name); + return 1; + } + + /* This code is not really all that safe, but it works fine for testing. */ + while (!feof(fp)) { + char c = fgetc(fp); + if (c == '\n') { + unsigned i = 0; + const char *s = 0; + + if (numChars == 0) + continue; + + line[numChars] = '\0'; + numChars = 0; + + if (line[0] == '/' && line[1] == '/') + continue; + + s = strtok(line, " "); + while (s) { + args[i] = s; + ++i; + s = strtok(0, " "); + } + if (print_usrs(&args[0], &args[i])) + return 1; + } + else + line[numChars++] = c; + } + + fclose(fp); + return 0; +} + +/******************************************************************************/ /* Command line processing. */ /******************************************************************************/ @@ -1006,7 +1177,9 @@ static void print_usage(void) { " c-index-test -test-annotate-tokens=<range> {<args>}*\n" " c-index-test -test-inclusion-stack-source {<args>}*\n" " c-index-test -test-inclusion-stack-tu <AST file>\n" - " c-index-test -test-print-linkage-source {<args>}*\n\n" + " c-index-test -test-print-linkage-source {<args>}*\n" + " c-index-test -print-usr [<CursorKind> {<args>}]*\n" + " c-index-test -print-usr-file <file>\n\n" " <symbol filter> values:\n%s", " all - load all symbols, including those from PCH\n" " local - load all symbols except those in PCH\n" @@ -1049,6 +1222,16 @@ int main(int argc, const char **argv) { else if (argc > 2 && strcmp(argv[1], "-test-print-linkage-source") == 0) return perform_test_load_source(argc - 2, argv + 2, "all", PrintLinkage, NULL); + else if (argc > 1 && strcmp(argv[1], "-print-usr") == 0) { + if (argc > 2) + return print_usrs(argv + 2, argv + argc); + else { + display_usrs(); + return 1; + } + } + else if (argc > 2 && strcmp(argv[1], "-print-usr-file") == 0) + return print_usrs_file(argv[2]); print_usage(); return 1; diff --git a/tools/driver/Makefile b/tools/driver/Makefile index 6434cb4..f88d229 100644 --- a/tools/driver/Makefile +++ b/tools/driver/Makefile @@ -11,6 +11,10 @@ LEVEL = ../../../.. TOOLNAME = clang ifndef CLANG_IS_PRODUCTION TOOLALIAS = clang++ +else + ifdef CLANGXX_IS_PRODUCTION + TOOLALIAS = clang++ + endif endif CPP.Flags += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include @@ -33,4 +37,6 @@ include $(LLVM_SRC_ROOT)/Makefile.rules ifdef CLANG_IS_PRODUCTION CPP.Defines += -DCLANG_IS_PRODUCTION endif - +ifdef CLANGXX_IS_PRODUCTION +CPP.Defines += -DCLANGXX_IS_PRODUCTION +endif diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index 0b108ae..35854be 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -29,8 +29,10 @@ #include "clang/Frontend/TextDiagnosticPrinter.h" #include "llvm/LLVMContext.h" #include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/Statistic.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/System/DynamicLibrary.h" #include "llvm/Target/TargetSelect.h" @@ -195,9 +197,9 @@ static int cc1_test(Diagnostic &Diags, int cc1_main(const char **ArgBegin, const char **ArgEnd, const char *Argv0, void *MainAddr) { - CompilerInstance Clang; + llvm::OwningPtr<CompilerInstance> Clang(new CompilerInstance()); - Clang.setLLVMContext(new llvm::LLVMContext); + Clang->setLLVMContext(new llvm::LLVMContext); // Run clang -cc1 test. if (ArgBegin != ArgEnd && llvm::StringRef(ArgBegin[0]) == "-cc1test") { @@ -214,17 +216,17 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, // well formed diagnostic object. TextDiagnosticBuffer DiagsBuffer; Diagnostic Diags(&DiagsBuffer); - CompilerInvocation::CreateFromArgs(Clang.getInvocation(), ArgBegin, ArgEnd, + CompilerInvocation::CreateFromArgs(Clang->getInvocation(), ArgBegin, ArgEnd, Diags); // Infer the builtin include path if unspecified. - if (Clang.getHeaderSearchOpts().UseBuiltinIncludes && - Clang.getHeaderSearchOpts().ResourceDir.empty()) - Clang.getHeaderSearchOpts().ResourceDir = + if (Clang->getHeaderSearchOpts().UseBuiltinIncludes && + Clang->getHeaderSearchOpts().ResourceDir.empty()) + Clang->getHeaderSearchOpts().ResourceDir = CompilerInvocation::GetResourcesPath(Argv0, MainAddr); // Honor -help. - if (Clang.getFrontendOpts().ShowHelp) { + if (Clang->getFrontendOpts().ShowHelp) { llvm::OwningPtr<driver::OptTable> Opts(driver::createCC1OptTable()); Opts->PrintHelp(llvm::outs(), "clang -cc1", "LLVM 'Clang' Compiler: http://clang.llvm.org"); @@ -234,27 +236,27 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, // Honor -version. // // FIXME: Use a better -version message? - if (Clang.getFrontendOpts().ShowVersion) { + if (Clang->getFrontendOpts().ShowVersion) { llvm::cl::PrintVersionMessage(); return 0; } // Create the actual diagnostics engine. - Clang.createDiagnostics(ArgEnd - ArgBegin, const_cast<char**>(ArgBegin)); - if (!Clang.hasDiagnostics()) + Clang->createDiagnostics(ArgEnd - ArgBegin, const_cast<char**>(ArgBegin)); + if (!Clang->hasDiagnostics()) return 1; // Set an error handler, so that any LLVM backend diagnostics go through our // error handler. llvm::llvm_install_error_handler(LLVMErrorHandler, - static_cast<void*>(&Clang.getDiagnostics())); + static_cast<void*>(&Clang->getDiagnostics())); - DiagsBuffer.FlushDiagnostics(Clang.getDiagnostics()); + DiagsBuffer.FlushDiagnostics(Clang->getDiagnostics()); // Load any requested plugins. for (unsigned i = 0, - e = Clang.getFrontendOpts().Plugins.size(); i != e; ++i) { - const std::string &Path = Clang.getFrontendOpts().Plugins[i]; + e = Clang->getFrontendOpts().Plugins.size(); i != e; ++i) { + const std::string &Path = Clang->getFrontendOpts().Plugins[i]; std::string Error; if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Path.c_str(), &Error)) Diags.Report(diag::err_fe_unable_to_load_plugin) << Path << Error; @@ -262,11 +264,26 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, // If there were errors in processing arguments, don't do anything else. bool Success = false; - if (!Clang.getDiagnostics().getNumErrors()) { + if (!Clang->getDiagnostics().getNumErrors()) { // Create and execute the frontend action. - llvm::OwningPtr<FrontendAction> Act(CreateFrontendAction(Clang)); - if (Act) - Success = Clang.ExecuteAction(*Act); + llvm::OwningPtr<FrontendAction> Act(CreateFrontendAction(*Clang)); + if (Act) { + Success = Clang->ExecuteAction(*Act); + if (Clang->getFrontendOpts().DisableFree) + Act.take(); + } + } + + // If any timers were active but haven't been destroyed yet, print their + // results now. This happens in -disable-free mode. + llvm::TimerGroup::printAll(llvm::errs()); + + // When running with -disable-free, don't do any destruction or shutdown. + if (Clang->getFrontendOpts().DisableFree) { + if (Clang->getFrontendOpts().ShowStats) + llvm::PrintStatistics(); + Clang.take(); + return !Success; } // Managed static deconstruction. Useful for making things like diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index 2108c8f..3f1cca1 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -24,6 +24,7 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Regex.h" +#include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/System/Host.h" #include "llvm/System/Path.h" @@ -73,10 +74,10 @@ static const char *SaveStringInSet(std::set<std::string> &SavedStrings, /// \param Args - The vector of command line arguments. /// \param Edit - The override command to perform. /// \param SavedStrings - Set to use for storing string representations. -void ApplyOneQAOverride(llvm::raw_ostream &OS, - std::vector<const char*> &Args, - llvm::StringRef Edit, - std::set<std::string> &SavedStrings) { +static void ApplyOneQAOverride(llvm::raw_ostream &OS, + std::vector<const char*> &Args, + llvm::StringRef Edit, + std::set<std::string> &SavedStrings) { // This does not need to be efficient. if (Edit[0] == '^') { @@ -140,8 +141,9 @@ void ApplyOneQAOverride(llvm::raw_ostream &OS, /// ApplyQAOverride - Apply a comma separate list of edits to the /// input argument lists. See ApplyOneQAOverride. -void ApplyQAOverride(std::vector<const char*> &Args, const char *OverrideStr, - std::set<std::string> &SavedStrings) { +static void ApplyQAOverride(std::vector<const char*> &Args, + const char *OverrideStr, + std::set<std::string> &SavedStrings) { llvm::raw_ostream *OS = &llvm::errs(); if (OverrideStr[0] == '#') { @@ -195,12 +197,19 @@ int main(int argc, const char **argv) { #ifdef CLANG_IS_PRODUCTION const bool IsProduction = true; +# ifdef CLANGXX_IS_PRODUCTION + const bool CXXIsProduction = true; +# else + const bool CXXIsProduction = false; +# endif #else const bool IsProduction = false; + const bool CXXIsProduction = false; #endif Driver TheDriver(Path.getBasename(), Path.getDirname(), llvm::sys::getHostTriple(), - "a.out", IsProduction, Diags); + "a.out", IsProduction, CXXIsProduction, + Diags); // Check for ".*++" or ".*++-[^-]*" to determine if we are a C++ // compiler. This matches things like "c++", "clang++", and "clang++-1.1". @@ -265,6 +274,11 @@ int main(int argc, const char **argv) { if (C.get()) Res = TheDriver.ExecuteCompilation(*C); + + // If any timers were active but haven't been destroyed yet, print their + // results now. This happens in -disable-free mode. + llvm::TimerGroup::printAll(llvm::errs()); + llvm::llvm_shutdown(); return Res; diff --git a/tools/scan-build/scan-build b/tools/scan-build/scan-build index 432456b..8a7afbb 100755 --- a/tools/scan-build/scan-build +++ b/tools/scan-build/scan-build @@ -783,6 +783,7 @@ sub RunBuildCommand { my $IgnoreErrors = shift; my $Cmd = $Args->[0]; my $CCAnalyzer = shift; + my $CXXAnalyzer = shift; # Get only the part of the command after the last '/'. if ($Cmd =~ /\/([^\/]+)$/) { @@ -809,12 +810,12 @@ sub RunBuildCommand { $ENV{"CCC_CXX"} = $1; } shift @$Args; - unshift @$Args, $CCAnalyzer; + unshift @$Args, $CXXAnalyzer; } elsif ($IgnoreErrors) { if ($Cmd eq "make" or $Cmd eq "gmake") { AddIfNotPresent($Args, "CC=$CCAnalyzer"); - AddIfNotPresent($Args, "CXX=$CCAnalyzer"); + AddIfNotPresent($Args, "CXX=$CXXAnalyzer"); AddIfNotPresent($Args,"-k"); AddIfNotPresent($Args,"-i"); } @@ -845,7 +846,8 @@ sub RunBuildCommand { # When 'CC' is set, xcodebuild uses it to do all linking, even if we are # linking C++ object files. Set 'LDPLUSPLUS' so that xcodebuild uses 'g++' - # when linking such files. + # (via c++-analyzer) when linking such files. + $ENV{"LDPLUSPLUS"} = $CXXAnalyzer; } return (system(@$Args) >> 8); @@ -1232,9 +1234,8 @@ if (defined $OutputFormat) { $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'} = $OutputFormat; } - # Run the build. -my $ExitStatus = RunBuildCommand(\@ARGV, $IgnoreErrors, $Cmd); +my $ExitStatus = RunBuildCommand(\@ARGV, $IgnoreErrors, $Cmd, $CmdCXX); if (defined $OutputFormat) { if ($OutputFormat =~ /plist/) { |