[PATCH] D100092: [clang-tidy] cppcoreguidelines-declare-loop-variable-in-the-initializer: a new check

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 15 05:18:27 PST 2022


njames93 added a comment.
Herald added a subscriber: carlosgalvezp.

Sorry its been so long, How does this handle cases where the variable contains resources. Like a vector being used in a loop where you don't want to release its memory between each iteration.

  void foo(){
    std::vector<char> Buffer;
    for (int i = 0; i < limit;++i) {
      Buffer.clear();
      // Do something with buffer
    }
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100092



More information about the cfe-commits mailing list