summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2016-08-08 13:37:39 +0000
committerEric Liu <ioeric@google.com>2016-08-08 13:37:39 +0000
commit73337f3dfa3114150f2bf68244f90213db38db50 (patch)
tree365d643aa18548bff6a877e49b19d999544e0b3b /clang/lib
parentad0c42e3a9a185bc904aba3407f9dd5c9b08f67c (diff)
downloadbcm5719-llvm-73337f3dfa3114150f2bf68244f90213db38db50.tar.gz
bcm5719-llvm-73337f3dfa3114150f2bf68244f90213db38db50.zip
Fixes calculateRangesAfterReplacements crash when Replacements is empty.
Reviewers: klimek, djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D23264 llvm-svn: 278004
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Tooling/Core/Replacement.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Tooling/Core/Replacement.cpp b/clang/lib/Tooling/Core/Replacement.cpp
index d498f433521..b257f0f1372 100644
--- a/clang/lib/Tooling/Core/Replacement.cpp
+++ b/clang/lib/Tooling/Core/Replacement.cpp
@@ -361,6 +361,8 @@ calculateRangesAfterReplacements(const Replacements &Replaces,
// - Merge with \p Replaces.
// - The new ranges will be the affected ranges of the merged replacements.
auto MergedRanges = combineAndSortRanges(Ranges);
+ if (Replaces.empty())
+ return MergedRanges;
tooling::Replacements FakeReplaces;
for (const auto &R : MergedRanges) {
auto Err = FakeReplaces.add(Replacement(Replaces.begin()->getFilePath(),
OpenPOWER on IntegriCloud