[PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 00:45:52 PDT 2016


alexfh added inline comments.


================
Comment at: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp:11
+extern int A, B;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'A' declaration
+// CHECK-FIXES: {{^}}extern int A, B;{{$}}
----------------
Just noticed: could you add a check line for the note ("previously declared here")? One should be enough.


================
Comment at: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp:17
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'Buf' declaration
+// CHECK-FIXES: {{^}}{{$}}
+
----------------
Just noticed: this is a rather unspecific check pattern that can match any empty line anywhere in the file. Int way to make the check stricter is to add a unique trailing comment and then match it (anchored to the line start).


Repository:
  rL LLVM

https://reviews.llvm.org/D24656





More information about the cfe-commits mailing list