sbenza added inline comments. ================ Comment at: clang-tidy/cppcoreguidelines/ProTypeVarargUseCheck.cpp:20 @@ +19,3 @@ +void ProTypeVarargUseCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher(callExpr(callee(functionDecl(isVariadic()))).bind("expr"), this); +} ---------------- mgehre wrote: > sbenza wrote: > > The guideline says that we should also issue a diagnostics for uses of > > va_list/va_start/va_arg. > This is handled by http://reviews.llvm.org/D13785 I see. They are split between vararg "def" and "use".
================ Comment at: test/clang-tidy/cppcoreguidelines-pro-type-vararg-use.cpp:14 @@ +13,3 @@ + +void check() { + f_vararg(1, 7, 9); ---------------- mgehre wrote: > sbenza wrote: > > how does this handle SFINAE style ... uses? > > The guideline mentions this case as "useful" so we should try to avoid > > warning on it. > I saw the note in the guidelines, but frankly I don't quite get the use case. > Do you have an example or reference for me? ... has the lowest rank for overload resolution. You can use it as a default case. Example: template <typename T> void CallFooIfAvailableImpl(T& t, decltype(t.foo())*) { t->foo(); } template <typename T> void CallFooIfAvailableImpl(T& t, ...) { // nothing } template <typename T> void CallFooIfAvailable(T& t) { CallFooIfAvailableImpl(t, 0); } It is also useful when making traits. Eg: https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Member_Detector#Solution_and_Sample_Code http://reviews.llvm.org/D13787 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits