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

Eduardo Caldas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 01:49:05 PDT 2020


eduucaldas added a reviewer: gribozavr2.
eduucaldas added a comment.

A proposition, upon review I'll change other tests.

One concern is that we might lose coverage while reducing noise. But I'll take a look into that with calm when changing the tests.



================
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);
----------------
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?


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