[PATCH] D89303: [SyntaxTree] Improve safety of `replaceChildRangeLowLevel`
Dmitri Gribenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 13 11:00:12 PDT 2020
gribozavr2 added inline comments.
================
Comment at: clang/lib/Tooling/Syntax/Tree.cpp:103
#ifndef NDEBUG
- for (auto *N = New; N; N = N->getNextSibling()) {
+ for (auto *N = New; N; N = N->NextSibling) {
assert(N->Parent == nullptr);
----------------
eduucaldas wrote:
> Throughout the function we use data members instead of accessors. Is one preferrable to the other?
I don't think there is a difference.
================
Comment at: clang/lib/Tooling/Syntax/Tree.cpp:124
+ return BeforeBegin ? BeforeBegin->NextSibling : FirstChild;
+ };
+
----------------
Why lambda and not:
```
Node *&Begin = BeforeBegin ? BeforeBegin->NextSibling : FirstChild;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89303/new/
https://reviews.llvm.org/D89303
More information about the cfe-commits
mailing list