diff options
Diffstat (limited to 'lib/Tooling/Tooling.cpp')
-rw-r--r-- | lib/Tooling/Tooling.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/Tooling/Tooling.cpp b/lib/Tooling/Tooling.cpp index cfdb32f0ae..63aa64a533 100644 --- a/lib/Tooling/Tooling.cpp +++ b/lib/Tooling/Tooling.cpp @@ -369,7 +369,7 @@ bool FrontendActionFactory::runInvocation( const bool Success = Compiler.ExecuteAction(*ScopedToolAction); - Files->clearStatCaches(); + Files->clearStatCache(); return Success; } @@ -574,20 +574,16 @@ namespace clang { namespace tooling { std::unique_ptr<ASTUnit> -buildASTFromCode(const Twine &Code, const Twine &FileName, +buildASTFromCode(StringRef Code, StringRef FileName, std::shared_ptr<PCHContainerOperations> PCHContainerOps) { return buildASTFromCodeWithArgs(Code, std::vector<std::string>(), FileName, "clang-tool", std::move(PCHContainerOps)); } std::unique_ptr<ASTUnit> buildASTFromCodeWithArgs( - const Twine &Code, const std::vector<std::string> &Args, - const Twine &FileName, const Twine &ToolName, - std::shared_ptr<PCHContainerOperations> PCHContainerOps, + StringRef Code, const std::vector<std::string> &Args, StringRef FileName, + StringRef ToolName, std::shared_ptr<PCHContainerOperations> PCHContainerOps, ArgumentsAdjuster Adjuster) { - SmallString<16> FileNameStorage; - StringRef FileNameRef = FileName.toNullTerminatedStringRef(FileNameStorage); - std::vector<std::unique_ptr<ASTUnit>> ASTs; ASTBuilderAction Action(ASTs); llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFileSystem( @@ -599,13 +595,11 @@ std::unique_ptr<ASTUnit> buildASTFromCodeWithArgs( new FileManager(FileSystemOptions(), OverlayFileSystem)); ToolInvocation Invocation( - getSyntaxOnlyToolArgs(ToolName, Adjuster(Args, FileNameRef), FileNameRef), + getSyntaxOnlyToolArgs(ToolName, Adjuster(Args, FileName), FileName), &Action, Files.get(), std::move(PCHContainerOps)); - SmallString<1024> CodeStorage; - InMemoryFileSystem->addFile(FileNameRef, 0, - llvm::MemoryBuffer::getMemBuffer( - Code.toNullTerminatedStringRef(CodeStorage))); + InMemoryFileSystem->addFile(FileName, 0, + llvm::MemoryBuffer::getMemBufferCopy(Code)); if (!Invocation.run()) return nullptr; |