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