[clang] 6fbad9b - [SyntaxTree][NFC] Nit on `replaceChildRangeLowLevel`
Eduardo Caldas via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 14 02:41:17 PDT 2020
Author: Eduardo Caldas
Date: 2020-10-14T09:40:37Z
New Revision: 6fbad9bf304c05d37454420f7d5a1c2ab3adab20
URL: https://github.com/llvm/llvm-project/commit/6fbad9bf304c05d37454420f7d5a1c2ab3adab20
DIFF: https://github.com/llvm/llvm-project/commit/6fbad9bf304c05d37454420f7d5a1c2ab3adab20.diff
LOG: [SyntaxTree][NFC] Nit on `replaceChildRangeLowLevel`
Added:
Modified:
clang/lib/Tooling/Syntax/Tree.cpp
Removed:
################################################################################
diff --git a/clang/lib/Tooling/Syntax/Tree.cpp b/clang/lib/Tooling/Syntax/Tree.cpp
index 74cd3c1f68b1..87526ad7a976 100644
--- a/clang/lib/Tooling/Syntax/Tree.cpp
+++ b/clang/lib/Tooling/Syntax/Tree.cpp
@@ -99,6 +99,8 @@ void syntax::Tree::replaceChildRangeLowLevel(Node *BeforeBegin, Node *End,
assert((!End || End->Parent == this) && "`End` is not a child of `this`.");
assert(canModify() && "Cannot modify `this`.");
+ Node *&Begin = BeforeBegin ? BeforeBegin->NextSibling : FirstChild;
+
#ifndef NDEBUG
for (auto *N = New; N; N = N->NextSibling) {
assert(N->Parent == nullptr);
@@ -116,10 +118,8 @@ void syntax::Tree::replaceChildRangeLowLevel(Node *BeforeBegin, Node *End,
};
assert(Reachable(FirstChild, BeforeBegin) &&
"`BeforeBegin` is not reachable.");
- assert(Reachable(BeforeBegin ? BeforeBegin->NextSibling : FirstChild, End) &&
- "`End` is not after `BeforeBegin`.");
+ assert(Reachable(Begin, End) && "`End` is not after `BeforeBegin`.");
#endif
- Node *&Begin = BeforeBegin ? BeforeBegin->NextSibling : FirstChild;
if (!New && Begin == End)
return;
More information about the cfe-commits
mailing list