1 //===--- CppCoreGuidelinesModule.cpp - clang-tidy -------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "../ClangTidy.h" 11 #include "../ClangTidyModule.h" 12 #include "../ClangTidyModuleRegistry.h" 13 #include "../misc/AssignOperatorSignatureCheck.h" 14 #include "InterfacesGlobalInitCheck.h" 15 #include "ProBoundsArrayToPointerDecayCheck.h" 16 #include "ProBoundsConstantArrayIndexCheck.h" 17 #include "ProBoundsPointerArithmeticCheck.h" 18 #include "ProTypeConstCastCheck.h" 19 #include "ProTypeCstyleCastCheck.h" 20 #include "ProTypeMemberInitCheck.h" 21 #include "ProTypeReinterpretCastCheck.h" 22 #include "ProTypeStaticCastDowncastCheck.h" 23 #include "ProTypeUnionAccessCheck.h" 24 #include "ProTypeVarargCheck.h" 25 26 namespace clang { 27 namespace tidy { 28 namespace cppcoreguidelines { 29 30 /// A module containing checks of the C++ Core Guidelines 31 class CppCoreGuidelinesModule : public ClangTidyModule { 32 public: 33 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { 34 CheckFactories.registerCheck<InterfacesGlobalInitCheck>( 35 "cppcoreguidelines-interfaces-global-init"); 36 CheckFactories.registerCheck<ProBoundsArrayToPointerDecayCheck>( 37 "cppcoreguidelines-pro-bounds-array-to-pointer-decay"); 38 CheckFactories.registerCheck<ProBoundsConstantArrayIndexCheck>( 39 "cppcoreguidelines-pro-bounds-constant-array-index"); 40 CheckFactories.registerCheck<ProBoundsPointerArithmeticCheck>( 41 "cppcoreguidelines-pro-bounds-pointer-arithmetic"); 42 CheckFactories.registerCheck<ProTypeConstCastCheck>( 43 "cppcoreguidelines-pro-type-const-cast"); 44 CheckFactories.registerCheck<ProTypeCstyleCastCheck>( 45 "cppcoreguidelines-pro-type-cstyle-cast"); 46 CheckFactories.registerCheck<ProTypeMemberInitCheck>( 47 "cppcoreguidelines-pro-type-member-init"); 48 CheckFactories.registerCheck<ProTypeReinterpretCastCheck>( 49 "cppcoreguidelines-pro-type-reinterpret-cast"); 50 CheckFactories.registerCheck<ProTypeStaticCastDowncastCheck>( 51 "cppcoreguidelines-pro-type-static-cast-downcast"); 52 CheckFactories.registerCheck<ProTypeUnionAccessCheck>( 53 "cppcoreguidelines-pro-type-union-access"); 54 CheckFactories.registerCheck<ProTypeVarargCheck>( 55 "cppcoreguidelines-pro-type-vararg"); 56 CheckFactories.registerCheck<misc::AssignOperatorSignatureCheck>( 57 "cppcoreguidelines-c-copy-assignment-signature"); 58 } 59 }; 60 61 // Register the LLVMTidyModule using this statically initialized variable. 62 static ClangTidyModuleRegistry::Add<CppCoreGuidelinesModule> 63 X("cppcoreguidelines-module", "Adds checks for the C++ Core Guidelines."); 64 65 } // namespace cppcoreguidelines 66 67 // This anchor is used to force the linker to link in the generated object file 68 // and thus register the CppCoreGuidelinesModule. 69 volatile int CppCoreGuidelinesModuleAnchorSource = 0; 70 71 } // namespace tidy 72 } // namespace clang 73