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

Daniel Jasper djasper at google.com
Tue Jul 22 03:00:43 PDT 2014


================
Comment at: clang-tidy/misc/UnusedRAII.cpp:51
@@ +50,3 @@
+
+  diag(E->getLocStart(), "object created and destroyed immediately; did you "
+                         "mean to name the object?");
----------------
Maybe: "object destroyed immediately after creation; did .."?

Should we suggestion a fix? E.g. insert "give_me_a_name"?

================
Comment at: test/clang-tidy/misc-unused-raii.cpp:21
@@ +20,3 @@
+
+int main() {
+  Foo(42);
----------------
Add a test with a templated RAII class.

Also, make this "void main()" (or "void f()") or return something. We should try to get these tests warning free.

http://reviews.llvm.org/D4615






More information about the cfe-commits mailing list