diff --git a/CMakeLists.txt b/CMakeLists.txt index ad29e1a2..c2d2ebb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ project(cppparser) set(CMAKE_CXX_STANDARD 17) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) -# set(CMAKE_CXX_CLANG_TIDY clang-tidy --config-file=${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy) +set(CLANG_TIDY_COMMAND "clang-tidy" "--config-file=${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy") if(MSVC) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd\"4996\"") diff --git a/cppast/CMakeLists.txt b/cppast/CMakeLists.txt index acead37e..8fcc1d90 100644 --- a/cppast/CMakeLists.txt +++ b/cppast/CMakeLists.txt @@ -17,5 +17,6 @@ target_include_directories(cppast PUBLIC include ) +set_target_properties(cppast PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}") add_subdirectory(test) diff --git a/cppparser/CMakeLists.txt b/cppparser/CMakeLists.txt index b414784c..d544bf89 100644 --- a/cppparser/CMakeLists.txt +++ b/cppparser/CMakeLists.txt @@ -86,5 +86,4 @@ target_link_libraries(cppparser cppparser_lex_and_yacc ) -set(CLANG_TIDY_COMMAND "clang-tidy" "--config-file=${CMAKE_CURRENT_SOURCE_DIR}/../.clang-tidy") set_target_properties(cppparser PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}") diff --git a/cppwriter/CMakeLists.txt b/cppwriter/CMakeLists.txt index 360e96b9..61ea393f 100644 --- a/cppwriter/CMakeLists.txt +++ b/cppwriter/CMakeLists.txt @@ -12,3 +12,4 @@ target_link_libraries(cppwriter PUBLIC cppast ) +set_target_properties(cppwriter PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}") diff --git a/cppwriter/src/cppwriter.cpp b/cppwriter/src/cppwriter.cpp index 63e4dcfb..838d1618 100644 --- a/cppwriter/src/cppwriter.cpp +++ b/cppwriter/src/cppwriter.cpp @@ -9,7 +9,7 @@ namespace cppcodegen { namespace { -static void emitAttribute(std::uint32_t attr, std::ostream& stm) +static void EmitAttribute(std::uint32_t attr, std::ostream& stm) { if (attr & cppast::CppIdentifierAttrib::STATIC) stm << "static "; @@ -28,7 +28,7 @@ static void emitAttribute(std::uint32_t attr, std::ostream& stm) stm << "mutable "; } -static void emitTypeModifier(const cppast::CppTypeModifier& modifier, std::ostream& stm) +static void EmitTypeModifier(const cppast::CppTypeModifier& modifier, std::ostream& stm) { std::uint8_t constBit = 0; for (constBit = 0; constBit < modifier.ptrLevel_; ++constBit) @@ -297,7 +297,7 @@ void CppWriter::emitUsingNamespace(const cppast::CppUsingNamespaceDecl& usingNsO void CppWriter::emitVarType(const cppast::CppVarType& varTypeObj, std::ostream& stm) const { const auto attr = varTypeObj.typeAttr() | (IsConst(varTypeObj) ? cppast::CppIdentifierAttrib::CONST : 0); - emitAttribute(attr, stm); + EmitAttribute(attr, stm); if (varTypeObj.compound()) emit(*varTypeObj.compound(), stm, CppIndent(), true); else @@ -305,7 +305,7 @@ void CppWriter::emitVarType(const cppast::CppVarType& varTypeObj, std::ostream& const auto& origTypeModifier = varTypeObj.typeModifier(); const cppast::CppTypeModifier typeModifier { origTypeModifier.refType_, origTypeModifier.ptrLevel_, origTypeModifier.constBits_ & ~1}; - emitTypeModifier(typeModifier, stm); + EmitTypeModifier(typeModifier, stm); if (varTypeObj.parameterPack()) stm << "..."; } @@ -378,7 +378,7 @@ void CppWriter::emitVarList(const cppast::CppVarList& varListObj, std::ostream& { stm << ", "; const auto& decl = varDeclList[i]; - emitTypeModifier(decl, stm); + EmitTypeModifier(decl, stm); emitVarDecl(stm, decl, false); }