diff --git a/tools/clang-tidy-plugin/CMakeLists.txt b/tools/clang-tidy-plugin/CMakeLists.txt index 59b1829a78cf8..c39e57a5f3b46 100644 --- a/tools/clang-tidy-plugin/CMakeLists.txt +++ b/tools/clang-tidy-plugin/CMakeLists.txt @@ -54,6 +54,7 @@ if (CATA_CLANG_TIDY_EXECUTABLE) else () set(CataAnalyzerName CataAnalyzerPlugin) add_library(${CataAnalyzerName} MODULE ${CataAnalyzerSrc}) + target_link_libraries(${CataAnalyzerName} PRIVATE clangTidy) endif () target_include_directories(${CataAnalyzerName} SYSTEM PRIVATE diff --git a/tools/clang-tidy-plugin/LargeStackObjectCheck.cpp b/tools/clang-tidy-plugin/LargeStackObjectCheck.cpp index ccd7d754d9e0d..9cfdfa9e41cc3 100644 --- a/tools/clang-tidy-plugin/LargeStackObjectCheck.cpp +++ b/tools/clang-tidy-plugin/LargeStackObjectCheck.cpp @@ -58,7 +58,11 @@ static void CheckDecl( LargeStackObjectCheck &Check, const MatchFinder::MatchRes return; } +#if defined(LLVM_VERSION_MAJOR) && LLVM_VERSION_MAJOR >= 17 + if( std::optional VarSize = Result.Context->getTypeSizeInCharsIfKnown( T ) ) { +#else if( Optional VarSize = Result.Context->getTypeSizeInCharsIfKnown( T ) ) { +#endif int VarSize_KiB = *VarSize / CharUnits::fromQuantity( 1024 ); if( VarSize_KiB >= 100 ) {