[PATCH] [clang-tidy] Add a check for RAII temporaries.

Benjamin Kramer benny.kra at gmail.com
Tue Jul 22 05:15:47 PDT 2014


- Added FixIts. This is tricky because we have to remove the parens when encountering
     Foo(); // Foo is a type.
  -> Foo give_me_a_name;
otherwise it'll parse as a function decl.
- Added another way of reducing false positives: If the expression is the last one in
the compoundStmt we don't warn, as it doesn't change behavior.

http://reviews.llvm.org/D4615

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/UnusedRAII.cpp
  clang-tidy/misc/UnusedRAII.h
  test/clang-tidy/misc-unused-raii.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4615.11747.patch
Type: text/x-patch
Size: 7118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140722/71c01118/attachment.bin>


More information about the cfe-commits mailing list