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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits