summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/include-fixer/IncludeFixer.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2016-07-11 13:53:21 +0000
committerEric Liu <ioeric@google.com>2016-07-11 13:53:21 +0000
commita452db4d0ffa4cf6c2a861ef5806f30caebe2bf9 (patch)
treeedcff3cce2c241736b3b329e45b5d3dc21bd742a /clang-tools-extra/include-fixer/IncludeFixer.cpp
parent4f8d99433da80161f85988052f96bc7dc621c4eb (diff)
downloadbcm5719-llvm-a452db4d0ffa4cf6c2a861ef5806f30caebe2bf9.tar.gz
bcm5719-llvm-a452db4d0ffa4cf6c2a861ef5806f30caebe2bf9.zip
Changes related to tooling::applyAllReplacements interface change in D21601.
Summary: this patch contains changes related to the interface change from http://reviews.llvm.org/D21601. Only submit this patch after D21601 is submitted. Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21602 llvm-svn: 275063
Diffstat (limited to 'clang-tools-extra/include-fixer/IncludeFixer.cpp')
-rw-r--r--clang-tools-extra/include-fixer/IncludeFixer.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/include-fixer/IncludeFixer.cpp b/clang-tools-extra/include-fixer/IncludeFixer.cpp
index 64844d26681..24265618966 100644
--- a/clang-tools-extra/include-fixer/IncludeFixer.cpp
+++ b/clang-tools-extra/include-fixer/IncludeFixer.cpp
@@ -349,7 +349,7 @@ bool IncludeFixerActionFactory::runInvocation(
return !Compiler.getDiagnostics().hasFatalErrorOccurred();
}
-tooling::Replacements
+llvm::Expected<tooling::Replacements>
createInsertHeaderReplacements(StringRef Code, StringRef FilePath,
StringRef Header,
const clang::format::FormatStyle &Style) {
@@ -360,8 +360,10 @@ createInsertHeaderReplacements(StringRef Code, StringRef FilePath,
clang::tooling::Replacements Insertions = {
tooling::Replacement(FilePath, UINT_MAX, 0, IncludeName)};
- return formatReplacements(
- Code, cleanupAroundReplacements(Code, Insertions, Style), Style);
+ auto CleanReplaces = cleanupAroundReplacements(Code, Insertions, Style);
+ if (!CleanReplaces)
+ return CleanReplaces;
+ return formatReplacements(Code, *CleanReplaces, Style);
}
} // namespace include_fixer
OpenPOWER on IntegriCloud