[clang-tools-extra] e9a88b6 - [clangd] Fix a bug in TweakTest::decorate()
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 14 00:02:38 PDT 2023
Author: Nathan Ridge
Date: 2023-03-14T03:02:26-04:00
New Revision: e9a88b6178d3a30123394d1fef6b51140f79d03a
URL: https://github.com/llvm/llvm-project/commit/e9a88b6178d3a30123394d1fef6b51140f79d03a
DIFF: https://github.com/llvm/llvm-project/commit/e9a88b6178d3a30123394d1fef6b51140f79d03a.diff
LOG: [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
Added:
Modified:
clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp b/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp
index ee93436d708d2..51071d89a66e5 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();
}
More information about the cfe-commits
mailing list