diff options
author | Antonio Maiorano <amaiorano@gmail.com> | 2017-01-17 00:13:32 +0000 |
---|---|---|
committer | Antonio Maiorano <amaiorano@gmail.com> | 2017-01-17 00:13:32 +0000 |
commit | 9440e6a974a9d6c37dfa1c0c9bc5bfcdf2c733af (patch) | |
tree | c1f2931a3d30b0e0c14343d93d535bae1fa9ab34 /include-fixer | |
parent | f5fe3ddb0070ae66c295a0b9e750aa70142a7c5d (diff) | |
download | clang-tools-extra-9440e6a974a9d6c37dfa1c0c9bc5bfcdf2c733af.tar.gz |
Update tools to use new getStyle API
Depends on https://reviews.llvm.org/D28081
Differential Revision: https://reviews.llvm.org/D28315
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@292175 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include-fixer')
-rw-r--r-- | include-fixer/tool/ClangIncludeFixer.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include-fixer/tool/ClangIncludeFixer.cpp b/include-fixer/tool/ClangIncludeFixer.cpp index 47942a97..15a7158f 100644 --- a/include-fixer/tool/ClangIncludeFixer.cpp +++ b/include-fixer/tool/ClangIncludeFixer.cpp @@ -303,10 +303,13 @@ int includeFixerMain(int argc, const char **argv) { const IncludeFixerContext::HeaderInfo &RHS) { return LHS.QualifiedName == RHS.QualifiedName; }); - format::FormatStyle InsertStyle = - format::getStyle("file", Context.getFilePath(), Style); + auto InsertStyle = format::getStyle("file", Context.getFilePath(), Style); + if (!InsertStyle) { + llvm::errs() << llvm::toString(InsertStyle.takeError()) << "\n"; + return 1; + } auto Replacements = clang::include_fixer::createIncludeFixerReplacements( - Code->getBuffer(), Context, InsertStyle, + Code->getBuffer(), Context, *InsertStyle, /*AddQualifiers=*/IsUniqueQualifiedName); if (!Replacements) { errs() << "Failed to create replacements: " @@ -378,7 +381,11 @@ int includeFixerMain(int argc, const char **argv) { std::vector<tooling::Replacements> FixerReplacements; for (const auto &Context : Contexts) { StringRef FilePath = Context.getFilePath(); - format::FormatStyle InsertStyle = format::getStyle("file", FilePath, Style); + auto InsertStyle = format::getStyle("file", FilePath, Style); + if (!InsertStyle) { + llvm::errs() << llvm::toString(InsertStyle.takeError()) << "\n"; + return 1; + } auto Buffer = llvm::MemoryBuffer::getFile(FilePath); if (!Buffer) { errs() << "Couldn't open file: " + FilePath.str() + ": " @@ -387,7 +394,7 @@ int includeFixerMain(int argc, const char **argv) { } auto Replacements = clang::include_fixer::createIncludeFixerReplacements( - Buffer.get()->getBuffer(), Context, InsertStyle); + Buffer.get()->getBuffer(), Context, *InsertStyle); if (!Replacements) { errs() << "Failed to create replacement: " << llvm::toString(Replacements.takeError()) << "\n"; |