From 27da23464f469baaaf862845be39bc0c60a30a38 Mon Sep 17 00:00:00 2001 From: Matthias Gehre Date: Wed, 21 Oct 2015 20:09:02 +0000 Subject: [clang-tidy] add check cppcoreguidelines-pro-type-vararg Summary: This check flags all calls to c-style vararg functions and all use of va_list, va_start and va_arg. Passing to varargs assumes the correct type will be read. This is fragile because it cannot generally be enforced to be safe in the language and so relies on programmer discipline to get it right. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type8-avoid-reading-from-varargs-or-passing-vararg-arguments-prefer-variadic-template-parameters-instead This commits also reverts "[clang-tidy] add cert's VariadicFunctionDefCheck as cppcoreguidelines-pro-type-vararg-def" because that check makes the SFINAE use of vararg functions impossible. Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13787 llvm-svn: 250939 --- .../clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp') diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp index 3d517902660..9929d66e780 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp @@ -10,13 +10,13 @@ #include "../ClangTidy.h" #include "../ClangTidyModule.h" #include "../ClangTidyModuleRegistry.h" -#include "../cert/VariadicFunctionDefCheck.h" #include "../misc/AssignOperatorSignatureCheck.h" #include "ProBoundsPointerArithmeticCheck.h" #include "ProTypeConstCastCheck.h" #include "ProTypeReinterpretCastCheck.h" #include "ProTypeStaticCastDowncastCheck.h" #include "ProTypeUnionAccessCheck.h" +#include "ProTypeVarargCheck.h" namespace clang { namespace tidy { @@ -30,14 +30,14 @@ public: "cppcoreguidelines-pro-bounds-pointer-arithmetic"); CheckFactories.registerCheck( "cppcoreguidelines-pro-type-const-cast"); - CheckFactories.registerCheck( - "cppcoreguidelines-pro-type-vararg-def"); CheckFactories.registerCheck( "cppcoreguidelines-pro-type-reinterpret-cast"); CheckFactories.registerCheck( "cppcoreguidelines-pro-type-static-cast-downcast"); CheckFactories.registerCheck( "cppcoreguidelines-pro-type-union-access"); + CheckFactories.registerCheck( + "cppcoreguidelines-pro-type-vararg"); CheckFactories.registerCheck( "cppcoreguidelines-c-copy-assignment-signature"); } -- cgit v1.2.3