diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/arcmt-test/arcmt-test.cpp | 7 | ||||
-rw-r--r-- | tools/c-index-test/c-index-test.c | 2 | ||||
-rwxr-xr-x | tools/clang-format/git-clang-format | 1 | ||||
-rw-r--r-- | tools/driver/cc1_main.cpp | 4 | ||||
-rw-r--r-- | tools/driver/cc1as_main.cpp | 4 | ||||
-rw-r--r-- | tools/driver/driver.cpp | 18 | ||||
-rw-r--r-- | tools/libclang/ARCMigrate.cpp | 4 | ||||
-rw-r--r-- | tools/libclang/CIndex.cpp | 17 | ||||
-rw-r--r-- | tools/libclang/CIndexCodeCompletion.cpp | 12 | ||||
-rw-r--r-- | tools/libclang/CIndexer.h | 15 | ||||
-rw-r--r-- | tools/libclang/CXCursor.cpp | 5 | ||||
-rw-r--r-- | tools/libclang/Indexing.cpp | 21 | ||||
-rwxr-xr-x | tools/scan-build/ccc-analyzer | 4 | ||||
-rwxr-xr-x | tools/scan-build/scan-build | 2 |
14 files changed, 63 insertions, 53 deletions
diff --git a/tools/arcmt-test/arcmt-test.cpp b/tools/arcmt-test/arcmt-test.cpp index 7be4ed6..c269e01 100644 --- a/tools/arcmt-test/arcmt-test.cpp +++ b/tools/arcmt-test/arcmt-test.cpp @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +#include "clang/Frontend/PCHContainerOperations.h" #include "clang/ARCMigrate/ARCMT.h" #include "clang/Frontend/ASTUnit.h" #include "clang/Frontend/TextDiagnosticPrinter.h" @@ -130,7 +131,8 @@ static bool checkForMigration(StringRef resourcesPath, if (!CI.getLangOpts()->ObjC1) return false; - arcmt::checkForManualIssues(CI, CI.getFrontendOpts().Inputs[0], + arcmt::checkForManualIssues(CI, CI.getFrontendOpts().Inputs[0], + std::make_shared<RawPCHContainerOperations>(), Diags->getClient()); return Diags->getClient()->getNumErrors() > 0; } @@ -169,7 +171,8 @@ static bool performTransformations(StringRef resourcesPath, if (!origCI.getLangOpts()->ObjC1) return false; - MigrationProcess migration(origCI, DiagClient); + MigrationProcess migration( + origCI, std::make_shared<RawPCHContainerOperations>(), DiagClient); std::vector<TransformFn> transforms = arcmt::getAllTransformations(origCI.getLangOpts()->getGC(), diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 56f39c2..980f341 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -2101,7 +2101,7 @@ int perform_code_completion(int argc, const char **argv, int timing_only) { clang_defaultReparseOptions(TU)); if (Err != CXError_Success) { - fprintf(stderr, "Unable to reparse translation init!\n"); + fprintf(stderr, "Unable to reparse translation unit!\n"); describeLibclangFailure(Err); clang_disposeTranslationUnit(TU); return 1; diff --git a/tools/clang-format/git-clang-format b/tools/clang-format/git-clang-format index 6a0db27..0c45762 100755 --- a/tools/clang-format/git-clang-format +++ b/tools/clang-format/git-clang-format @@ -78,6 +78,7 @@ def main(): # Other languages that clang-format supports 'proto', 'protodevel', # Protocol Buffers 'js', # JavaScript + 'ts', # TypeScript ]) p = argparse.ArgumentParser( diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index fa1a10e..972bf5b 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -14,6 +14,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Option/Arg.h" +#include "clang/Frontend/PCHContainerOperations.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Options.h" #include "clang/Frontend/CompilerInstance.h" @@ -64,7 +65,8 @@ void initializePollyPasses(llvm::PassRegistry &Registry); #endif int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) { - std::unique_ptr<CompilerInstance> Clang(new CompilerInstance()); + std::unique_ptr<CompilerInstance> Clang( + new CompilerInstance(std::make_shared<RawPCHContainerOperations>())); IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); // Initialize targets first, so that --version shows registered targets. diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp index f73d07b..f7ac17f 100644 --- a/tools/driver/cc1as_main.cpp +++ b/tools/driver/cc1as_main.cpp @@ -323,8 +323,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr); // FIXME: Assembler behavior can change with -static. - MOFI->InitMCObjectFileInfo(Opts.Triple, - Reloc::Default, CodeModel::Default, Ctx); + MOFI->InitMCObjectFileInfo(Triple(Opts.Triple), Reloc::Default, + CodeModel::Default, Ctx); if (Opts.SaveTemporaryLabels) Ctx.setAllowTemporaryLabels(false); if (Opts.GenDwarfForAssembly) diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp index e1f9367..ff81b8a 100644 --- a/tools/driver/driver.cpp +++ b/tools/driver/driver.cpp @@ -43,6 +43,7 @@ #include "llvm/Support/Program.h" #include "llvm/Support/Regex.h" #include "llvm/Support/Signals.h" +#include "llvm/Support/StringSaver.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" #include "llvm/Support/Timer.h" @@ -290,18 +291,6 @@ static void ParseProgName(SmallVectorImpl<const char *> &ArgVector, } } -namespace { - class StringSetSaver : public llvm::cl::StringSaver { - public: - StringSetSaver(std::set<std::string> &Storage) : Storage(Storage) {} - const char *SaveString(const char *Str) override { - return GetStableCStr(Storage, Str); - } - private: - std::set<std::string> &Storage; - }; -} - static void SetBackdoorDriverOutputsFromEnvVars(Driver &TheDriver) { // Handle CC_PRINT_OPTIONS and CC_PRINT_OPTIONS_FILE. TheDriver.CCPrintOptions = !!::getenv("CC_PRINT_OPTIONS"); @@ -391,8 +380,8 @@ int main(int argc_, const char **argv_) { return 1; } - std::set<std::string> SavedStrings; - StringSetSaver Saver(SavedStrings); + llvm::BumpPtrAllocator A; + llvm::BumpPtrStringSaver Saver(A); // Determines whether we want nullptr markers in argv to indicate response // files end-of-lines. We only use this for the /LINK driver argument. @@ -426,6 +415,7 @@ int main(int argc_, const char **argv_) { } } + std::set<std::string> SavedStrings; // Handle CCC_OVERRIDE_OPTIONS, used for editing a command line behind the // scenes. if (const char *OverrideStr = ::getenv("CCC_OVERRIDE_OPTIONS")) { diff --git a/tools/libclang/ARCMigrate.cpp b/tools/libclang/ARCMigrate.cpp index b0b869b..b597383 100644 --- a/tools/libclang/ARCMigrate.cpp +++ b/tools/libclang/ARCMigrate.cpp @@ -101,9 +101,7 @@ CXRemapping clang_getRemappingsFromFileList(const char **filePaths, } TextDiagnosticBuffer diagBuffer; - SmallVector<StringRef, 32> Files; - for (unsigned i = 0; i != numFiles; ++i) - Files.push_back(filePaths[i]); + SmallVector<StringRef, 32> Files(filePaths, filePaths + numFiles); bool err = arcmt::getFileRemappingsFromFileList(remap->Vec, Files, &diagBuffer); diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 05287bd..2216ec6 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -1879,6 +1879,7 @@ public: void VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *D); void VisitOMPBarrierDirective(const OMPBarrierDirective *D); void VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *D); + void VisitOMPTaskgroupDirective(const OMPTaskgroupDirective *D); void VisitOMPFlushDirective(const OMPFlushDirective *D); void VisitOMPOrderedDirective(const OMPOrderedDirective *D); void VisitOMPAtomicDirective(const OMPAtomicDirective *D); @@ -2478,6 +2479,11 @@ void EnqueueVisitor::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *D) { VisitOMPExecutableDirective(D); } +void EnqueueVisitor::VisitOMPTaskgroupDirective( + const OMPTaskgroupDirective *D) { + VisitOMPExecutableDirective(D); +} + void EnqueueVisitor::VisitOMPFlushDirective(const OMPFlushDirective *D) { VisitOMPExecutableDirective(D); } @@ -2883,7 +2889,8 @@ enum CXErrorCode clang_createTranslationUnit2(CXIndex CIdx, IntrusiveRefCntPtr<DiagnosticsEngine> Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions()); std::unique_ptr<ASTUnit> AU = ASTUnit::LoadFromASTFile( - ast_filename, Diags, FileSystemOpts, CXXIdx->getOnlyLocalDecls(), None, + ast_filename, CXXIdx->getPCHContainerOperations(), Diags, FileSystemOpts, + CXXIdx->getOnlyLocalDecls(), None, /*CaptureDiagnostics=*/true, /*AllowPCHWithCompilerErrors=*/true, /*UserFilesAreVolatile=*/true); @@ -3021,7 +3028,8 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { unsigned NumErrors = Diags->getClient()->getNumErrors(); std::unique_ptr<ASTUnit> ErrUnit; std::unique_ptr<ASTUnit> Unit(ASTUnit::LoadFromCommandLine( - Args->data(), Args->data() + Args->size(), Diags, + Args->data(), Args->data() + Args->size(), + CXXIdx->getPCHContainerOperations(), Diags, CXXIdx->getClangResourcesPath(), CXXIdx->getOnlyLocalDecls(), /*CaptureDiagnostics=*/true, *RemappedFiles.get(), /*RemappedFilesKeepOriginalName=*/true, PrecompilePreamble, TUKind, @@ -3262,7 +3270,8 @@ static void clang_reparseTranslationUnit_Impl(void *UserData) { RemappedFiles->push_back(std::make_pair(UF.Filename, MB.release())); } - if (!CXXUnit->Reparse(*RemappedFiles.get())) + if (!CXXUnit->Reparse(CXXIdx->getPCHContainerOperations(), + *RemappedFiles.get())) RTUI->result = CXError_Success; else if (isASTReadError(CXXUnit)) RTUI->result = CXError_ASTReadError; @@ -4260,6 +4269,8 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) { return cxstring::createRef("OMPBarrierDirective"); case CXCursor_OMPTaskwaitDirective: return cxstring::createRef("OMPTaskwaitDirective"); + case CXCursor_OMPTaskgroupDirective: + return cxstring::createRef("OMPTaskgroupDirective"); case CXCursor_OMPFlushDirective: return cxstring::createRef("OMPFlushDirective"); case CXCursor_OMPOrderedDirective: diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp index ca167e8..a7b8e29 100644 --- a/tools/libclang/CIndexCodeCompletion.cpp +++ b/tools/libclang/CIndexCodeCompletion.cpp @@ -715,14 +715,12 @@ static void clang_codeCompleteAt_Impl(void *UserData) { // Perform completion. AST->CodeComplete(complete_filename, complete_line, complete_column, - RemappedFiles, - (options & CXCodeComplete_IncludeMacros), + RemappedFiles, (options & CXCodeComplete_IncludeMacros), (options & CXCodeComplete_IncludeCodePatterns), - IncludeBriefComments, - Capture, - *Results->Diag, Results->LangOpts, *Results->SourceMgr, - *Results->FileMgr, Results->Diagnostics, - Results->TemporaryBuffers); + IncludeBriefComments, Capture, + CXXIdx->getPCHContainerOperations(), *Results->Diag, + Results->LangOpts, *Results->SourceMgr, *Results->FileMgr, + Results->Diagnostics, Results->TemporaryBuffers); Results->DiagnosticsWrappers.resize(Results->Diagnostics.size()); diff --git a/tools/libclang/CIndexer.h b/tools/libclang/CIndexer.h index cb7c62e..8a306cd 100644 --- a/tools/libclang/CIndexer.h +++ b/tools/libclang/CIndexer.h @@ -16,6 +16,8 @@ #define LLVM_CLANG_TOOLS_LIBCLANG_CINDEXER_H #include "clang-c/Index.h" +#include "clang/Frontend/PCHContainerOperations.h" +#include "clang/Lex/ModuleLoader.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Path.h" #include <vector> @@ -38,11 +40,14 @@ class CIndexer { unsigned Options; // CXGlobalOptFlags. std::string ResourcesPath; + std::shared_ptr<PCHContainerOperations> PCHContainerOps; public: - CIndexer() : OnlyLocalDecls(false), DisplayDiagnostics(false), - Options(CXGlobalOpt_None) { } - + CIndexer(std::shared_ptr<PCHContainerOperations> PCHContainerOps = + std::make_shared<RawPCHContainerOperations>()) + : OnlyLocalDecls(false), DisplayDiagnostics(false), + Options(CXGlobalOpt_None), PCHContainerOps(PCHContainerOps) {} + /// \brief Whether we only want to see "local" declarations (that did not /// come from a previous precompiled header). If false, we want to see all /// declarations. @@ -54,6 +59,10 @@ public: DisplayDiagnostics = Display; } + std::shared_ptr<PCHContainerOperations> getPCHContainerOperations() const { + return PCHContainerOps; + } + unsigned getCXGlobalOptFlags() const { return Options; } void setCXGlobalOptFlags(unsigned options) { Options = options; } diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp index b0446fd..b8bb28e 100644 --- a/tools/libclang/CXCursor.cpp +++ b/tools/libclang/CXCursor.cpp @@ -235,11 +235,13 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent, case Stmt::CXXUuidofExprClass: case Stmt::ChooseExprClass: case Stmt::DesignatedInitExprClass: + case Stmt::DesignatedInitUpdateExprClass: case Stmt::ExprWithCleanupsClass: case Stmt::ExpressionTraitExprClass: case Stmt::ExtVectorElementExprClass: case Stmt::ImplicitCastExprClass: case Stmt::ImplicitValueInitExprClass: + case Stmt::NoInitExprClass: case Stmt::MaterializeTemporaryExprClass: case Stmt::ObjCIndirectCopyRestoreExprClass: case Stmt::OffsetOfExprClass: @@ -568,6 +570,9 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent, case Stmt::OMPTaskwaitDirectiveClass: K = CXCursor_OMPTaskwaitDirective; break; + case Stmt::OMPTaskgroupDirectiveClass: + K = CXCursor_OMPTaskgroupDirective; + break; case Stmt::OMPFlushDirectiveClass: K = CXCursor_OMPFlushDirective; break; diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp index 0ede684..e356400 100644 --- a/tools/libclang/Indexing.cpp +++ b/tools/libclang/Indexing.cpp @@ -590,8 +590,7 @@ static void clang_indexSourceFile_Impl(void *UserData) { if (index_options & CXIndexOpt_SuppressWarnings) CInvok->getDiagnosticOpts().IgnoreWarnings = true; - ASTUnit *Unit = ASTUnit::create(CInvok.get(), Diags, - CaptureDiagnostics, + ASTUnit *Unit = ASTUnit::create(CInvok.get(), Diags, CaptureDiagnostics, /*UserFilesAreVolatile=*/true); if (!Unit) { ITUI->result = CXError_InvalidArguments; @@ -644,17 +643,13 @@ static void clang_indexSourceFile_Impl(void *UserData) { PPOpts.DetailedRecord = false; DiagnosticErrorTrap DiagTrap(*Diags); - bool Success = ASTUnit::LoadFromCompilerInvocationAction(CInvok.get(), Diags, - IndexAction.get(), - Unit, - Persistent, - CXXIdx->getClangResourcesPath(), - OnlyLocalDecls, - CaptureDiagnostics, - PrecompilePreamble, - CacheCodeCompletionResults, - /*IncludeBriefCommentsInCodeCompletion=*/false, - /*UserFilesAreVolatile=*/true); + bool Success = ASTUnit::LoadFromCompilerInvocationAction( + CInvok.get(), CXXIdx->getPCHContainerOperations(), Diags, + IndexAction.get(), Unit, Persistent, CXXIdx->getClangResourcesPath(), + OnlyLocalDecls, CaptureDiagnostics, PrecompilePreamble, + CacheCodeCompletionResults, + /*IncludeBriefCommentsInCodeCompletion=*/false, + /*UserFilesAreVolatile=*/true); if (DiagTrap.hasErrorOccurred() && CXXIdx->getDisplayDiagnostics()) printDiagsToStderr(Unit); diff --git a/tools/scan-build/ccc-analyzer b/tools/scan-build/ccc-analyzer index 4549b29..ffe6859 100755 --- a/tools/scan-build/ccc-analyzer +++ b/tools/scan-build/ccc-analyzer @@ -135,8 +135,8 @@ sub ProcessClangFailure { my ($PPH, $PPFile) = tempfile( $prefix . "_XXXXXX", SUFFIX => GetPPExt($Lang), DIR => $Dir); - system $Clang, @$Args, "-E", "-o", $PPFile; close ($PPH); + system $Clang, @$Args, "-E", "-o", $PPFile; # Create the info file. open (OUT, ">", "$PPFile.info.txt") or die "Cannot open $PPFile.info.txt\n"; @@ -756,5 +756,3 @@ if ($Action eq 'compile' or $Action eq 'link') { } } } - -exit($Status >> 8); diff --git a/tools/scan-build/scan-build b/tools/scan-build/scan-build index d52d8f5..ac8e22e 100755 --- a/tools/scan-build/scan-build +++ b/tools/scan-build/scan-build @@ -766,7 +766,7 @@ ENDTEXT my $x = shift @fname; print OUT $x; if ($#fname >= 0) { - print OUT "<span class=\"W\"> </span>/"; + print OUT "/"; } } } |