From: Nathan Ridge Date: Tue, 21 Feb 2023 08:22:59 +0000 (-0500) Subject: [clangd] Fix a bug in TweakTest::decorate() X-Git-Tag: upstream/17.0.6~14944 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9a88b6178d3a30123394d1fef6b51140f79d03a;p=platform%2Fupstream%2Fllvm.git [clangd] Fix a bug in TweakTest::decorate() The second argument to string::substr() is a count, not an end position. Differential Revision: https://reviews.llvm.org/D144453 --- diff --git a/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp b/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp index ee93436..51071d8 100644 --- a/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp +++ b/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp @@ -157,7 +157,8 @@ std::string TweakTest::decorate(llvm::StringRef Code, unsigned Point) { 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(); }