[PATCH] D85713: [SyntaxTree]: Use Annotations in tests to reduce noise

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 02:17:29 PDT 2020


gribozavr2 added inline comments.


================
Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:186-187
+    auto AnnotatedRanges = AnnotatedCode.ranges();
+    assert(AnnotatedRanges.size() == TreeDumps.size());
+    for (auto i = 0u; i < AnnotatedRanges.size(); i++) {
+      auto *AnnotatedNode = nodeByRange(AnnotatedRanges[i], Root);
----------------
eduucaldas wrote:
> I just wanted to do a for( auto [range, dump]& : zip(AnnotatedRanges,TreeDumps))
> 
> Is indexed loop the way to go in C++? 
> And also I used `0u` here because we make a comparison to `std::vector::size_type`, is there a less error-prone way of writing those loop indexes?
Yes, I believe what you have now is indeed the best way.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85713/new/

https://reviews.llvm.org/D85713



More information about the cfe-commits mailing list