diff options
| author | 2017-10-04 20:27:34 +0000 | |
|---|---|---|
| committer | 2017-10-04 20:27:34 +0000 | |
| commit | 31eb748944903b7f4f38afda9851951ca9dfc1ae (patch) | |
| tree | 9b95b6ea45d0874d75eb05b90c0840e191416439 /gnu/llvm/tools/clang/lib/Tooling/Refactoring.cpp | |
| parent | Don't try to handle IPv4-compatible IPv6 addresses (diff) | |
| download | wireguard-openbsd-31eb748944903b7f4f38afda9851951ca9dfc1ae.tar.xz wireguard-openbsd-31eb748944903b7f4f38afda9851951ca9dfc1ae.zip | |
Import LLVM 5.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Tooling/Refactoring.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/lib/Tooling/Refactoring.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gnu/llvm/tools/clang/lib/Tooling/Refactoring.cpp b/gnu/llvm/tools/clang/lib/Tooling/Refactoring.cpp index 308c1ac48b2..db34c952d79 100644 --- a/gnu/llvm/tools/clang/lib/Tooling/Refactoring.cpp +++ b/gnu/llvm/tools/clang/lib/Tooling/Refactoring.cpp @@ -28,7 +28,7 @@ namespace tooling { RefactoringTool::RefactoringTool( const CompilationDatabase &Compilations, ArrayRef<std::string> SourcePaths, std::shared_ptr<PCHContainerOperations> PCHContainerOps) - : ClangTool(Compilations, SourcePaths, PCHContainerOps) {} + : ClangTool(Compilations, SourcePaths, std::move(PCHContainerOps)) {} std::map<std::string, Replacements> &RefactoringTool::getReplacements() { return FileToReplaces; @@ -68,8 +68,8 @@ int RefactoringTool::saveRewrittenFiles(Rewriter &Rewrite) { } bool formatAndApplyAllReplacements( - const std::map<std::string, Replacements> &FileToReplaces, Rewriter &Rewrite, - StringRef Style) { + const std::map<std::string, Replacements> &FileToReplaces, + Rewriter &Rewrite, StringRef Style) { SourceManager &SM = Rewrite.getSourceMgr(); FileManager &Files = SM.getFileManager(); @@ -83,9 +83,14 @@ bool formatAndApplyAllReplacements( FileID ID = SM.getOrCreateFileID(Entry, SrcMgr::C_User); StringRef Code = SM.getBufferData(ID); - format::FormatStyle CurStyle = format::getStyle(Style, FilePath, "LLVM"); + auto CurStyle = format::getStyle(Style, FilePath, "LLVM"); + if (!CurStyle) { + llvm::errs() << llvm::toString(CurStyle.takeError()) << "\n"; + return false; + } + auto NewReplacements = - format::formatReplacements(Code, CurReplaces, CurStyle); + format::formatReplacements(Code, CurReplaces, *CurStyle); if (!NewReplacements) { llvm::errs() << llvm::toString(NewReplacements.takeError()) << "\n"; return false; |
