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 "ProBoundsPointerArithmeticCheck.h" 15 #include "ProTypeConstCastCheck.h" 16 #include "ProTypeReinterpretCastCheck.h" 17 #include "ProTypeStaticCastDowncastCheck.h" 18 19 namespace clang { 20 namespace tidy { 21 namespace cppcoreguidelines { 22 23 /// A module containing checks of the C++ Core Guidelines 24 class CppCoreGuidelinesModule : public ClangTidyModule { 25 public: 26 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { 27 CheckFactories.registerCheck<ProBoundsPointerArithmeticCheck>( 28 "cppcoreguidelines-pro-bounds-pointer-arithmetic"); 29 CheckFactories.registerCheck<ProTypeConstCastCheck>( 30 "cppcoreguidelines-pro-type-const-cast"); 31 CheckFactories.registerCheck<ProTypeReinterpretCastCheck>( 32 "cppcoreguidelines-pro-type-reinterpret-cast"); 33 CheckFactories.registerCheck<ProTypeStaticCastDowncastCheck>( 34 "cppcoreguidelines-pro-type-static-cast-downcast"); 35 CheckFactories.registerCheck<misc::AssignOperatorSignatureCheck>( 36 "cppcoreguidelines-c-copy-assignment-signature"); 37 } 38 }; 39 40 // Register the LLVMTidyModule using this statically initialized variable. 41 static ClangTidyModuleRegistry::Add<CppCoreGuidelinesModule> 42 X("cppcoreguidelines-module", "Adds checks for the C++ Core Guidelines."); 43 44 } // namespace cppcoreguidelines 45 46 // This anchor is used to force the linker to link in the generated object file 47 // and thus register the CppCoreGuidelinesModule. 48 volatile int CppCoreGuidelinesModuleAnchorSource = 0; 49 50 } // namespace tidy 51 } // namespace clang 52