[PATCH] D13787: [clang-tidy] add check cppcoreguidelines-pro-type-vararg-use
Samuel Benzaquen via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 19 14:36:22 PDT 2015
sbenza added inline comments.
================
Comment at: clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp:26
@@ +25,3 @@
+ Finder->addMatcher(
+ varDecl(hasType(pointsTo(cxxRecordDecl(hasName("__va_list_tag")))))
+ .bind("va_list"),
----------------
Is there a way to look for the standard type (and not the implementation defined __xxx type name)?
================
Comment at: test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp:38
@@ +37,3 @@
+ int i = va_arg(ap, int);
+ // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: do not use va_start/va_arg to define c-style vararg functions; use variadic templates instead
+ va_end(ap); // Don't warn, va_end is anyway useless without va_start
----------------
isn't va_arg as useless as va_copy (without va_start)?
Actually, given that va_arg is the only one we can look for without using the private __va_xxx name, maybe we should only warn on that one.
http://reviews.llvm.org/D13787
More information about the cfe-commits
mailing list