DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (cdf352f02ac4)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-unused-raii.html

struct scoped_lock
{
  scoped_lock() {}
  ~scoped_lock() {}
};

#define SCOPED_LOCK_MACRO(m) scoped_lock()

struct trivial_scoped_lock
{
  trivial_scoped_lock() {}
};

scoped_lock test()
{
  scoped_lock(); // misc-unused-raii warning!

  SCOPED_LOCK_MACRO(); // no warning for macros

  trivial_scoped_lock(); // no warning for trivial objects without destructors

  return scoped_lock(); // no warning for return values
}