[PATCH] D58818: [clang-tidy] added cppcoreguidelines-use-raii-locks check

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 1 06:20:39 PST 2019


MyDeveloperDay added a comment.

This looks good to me but I would wait for one of @JonasToth or @alexfh to perhaps take a look,

maybe you should add some nested scope example too using the same name, I know the compiler should warn about a shadow variable anyway but

  std::mutex m;
  m.lock();
  {
      std::mutex m;
      m.lock();
      m.unlock();
  }
  m_unlock();

and what about

  std::mutex m1;
  std::mutex m2;
  
  m1.lock();
  m1.unlock();
  m2.lock();
  m2.unlock();

and

  std::mutex m1;
  std::mutex m2;
  
  m1.lock();
  m2.lock();
  m2.unlock();
  m1.unlock();



  std::mutex m1;
  std::mutex m2;
  
  m1.lock();
  m1.unlock();
  m2.lock();
  m2.unlock();



  std::mutex m1;
  std::mutex m2;
  
  m1.lock();
  m2.lock();
  m1.unlock();
  m2.unlock();


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D58818





More information about the cfe-commits mailing list