summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2018-04-10 10:36:46 +0000
committerSam McCall <sam.mccall@gmail.com>2018-04-10 10:36:46 +0000
commit44f2f4ec45bf8eb75165f38c5f005e0634f00d6e (patch)
tree25f8109f194955e88a9a1bc8af722b88216e0988
parentc88deb100f1d4a1d14dbcc42de01d325919ebec6 (diff)
downloadbcm5719-llvm-44f2f4ec45bf8eb75165f38c5f005e0634f00d6e.tar.gz
bcm5719-llvm-44f2f4ec45bf8eb75165f38c5f005e0634f00d6e.zip
[Tooling] fix UB when interpolating compile commands with an empty index
llvm-svn: 329685
-rw-r--r--clang/lib/Tooling/InterpolatingCompilationDatabase.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
index cc292348915..cf29744f307 100644
--- a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
+++ b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
@@ -373,8 +373,8 @@ private:
ArrayRef<SubstringAndIndex>
indexLookup(StringRef Key, const std::vector<SubstringAndIndex> &Idx) const {
// Use pointers as iteratiors to ease conversion of result to ArrayRef.
- auto Range =
- std::equal_range(&Idx[0], &Idx[Idx.size()], Key, Less<Prefix>());
+ auto Range = std::equal_range(Idx.data(), Idx.data() + Idx.size(), Key,
+ Less<Prefix>());
return {Range.first, Range.second};
}
OpenPOWER on IntegriCloud