[PATCH] D144453: [clangd] Fix a bug in TweakTest::decorate()
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 21 00:25:35 PST 2023
nridge created this revision.
nridge added a reviewer: kadircet.
Herald added a subscriber: arphaman.
Herald added a project: All.
nridge requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.
The second argument to string::substr() is a count,
not an end position.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D144453
Files:
clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
Index: clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
+++ clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
@@ -157,7 +157,8 @@
std::string TweakTest::decorate(llvm::StringRef Code,
llvm::Annotations::Range Range) {
return (Code.substr(0, Range.Begin) + "[[" +
- Code.substr(Range.Begin, Range.End) + "]]" + Code.substr(Range.End))
+ Code.substr(Range.Begin, Range.End - Range.Begin) + "]]" +
+ Code.substr(Range.End))
.str();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144453.499056.patch
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230221/76a22078/attachment.bin>
More information about the cfe-commits
mailing list