diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2019-01-18 19:46:00 +0000 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2019-01-18 19:46:00 +0000 |
commit | 3748d41833787fcbf59cc5624e8d2b042a8991bc (patch) | |
tree | f3fcdba7decca7ee845a1bb3f885cb0baa1b4d83 /lib/Tooling/Tooling.cpp | |
parent | 55c8788102d8fd203270fabd6513247b2d7fbd87 (diff) | |
parent | e054eb577a1f469b1a4a49fce08572c76e2dddf2 (diff) |
Creating branches/google/stable and tags/google/stable/2019-01-18 from r351319
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/stable@351578 91177308-0d34-0410-b5e6-96231b3b80d8
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; |