Hi klimek,
This disables this check for std::bind and similar functions that use
parameter packs to forward arguments to a different function. Name of the
parameter pack argument doesn't matter.
http://reviews.llvm.org/D5168
Files:
clang-tidy/misc/ArgumentCommentCheck.cpp
test/clang-tidy/arg-comments.cpp
Index: clang-tidy/misc/ArgumentCommentCheck.cpp
===================================================================
--- clang-tidy/misc/ArgumentCommentCheck.cpp
+++ clang-tidy/misc/ArgumentCommentCheck.cpp
@@ -119,6 +119,12 @@
IdentifierInfo *II = PVD->getIdentifier();
if (!II)
continue;
+ if (auto Template = Callee->getTemplateInstantiationPattern()) {
+ if (Template->getNumParams() <= i ||
+ Template->getParamDecl(i)->isParameterPack()) {
+ continue;
+ }
+ }
SourceLocation BeginSLoc, EndSLoc = Args[i]->getLocStart();
if (i == 0)
Index: test/clang-tidy/arg-comments.cpp
===================================================================
--- test/clang-tidy/arg-comments.cpp
+++ test/clang-tidy/arg-comments.cpp
@@ -7,11 +7,10 @@
void f(int x, int y);
void g() {
- // CHECK: [[@LINE+5]]:5: warning: argument name 'y' in comment does not match parameter name 'x'
+ // CHECK: [[@LINE+4]]:5: warning: argument name 'y' in comment does not match parameter name 'x'
// CHECK: :[[@LINE-3]]:12: note: 'x' declared here
- // CHECK: [[@LINE+3]]:14: warning: argument name 'z' in comment does not match parameter name 'y'
+ // CHECK: [[@LINE+2]]:14: warning: argument name 'z' in comment does not match parameter name 'y'
// CHECK: :[[@LINE-5]]:19: note: 'y' declared here
- // CHECK-NOT: warning
f(/*y=*/0, /*z=*/0);
}
@@ -27,3 +26,15 @@
(void)NewCallback(&ffff, /*xxxx=*/11, /*yyyy=*/22);
(void)NewPermanentCallback(&ffff, /*xxxx=*/11, /*yyyy=*/22);
}
+
+template<typename... Args>
+void variadic(Args&&... args);
+
+template<typename... Args>
+void variadic2(int zzz, Args&&... args);
+
+void templates() {
+ variadic(/*xxx=*/0, /*yyy=*/1);
+ variadic2(/*zzZ=*/0, /*xxx=*/1, /*yyy=*/2);
+ // CHECK: [[@LINE-1]]:13: warning: argument name 'zzZ' in comment does not match parameter name 'zzz'
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits