From ed1dd883c69c7c9caba8cf6745571531bdb44811 Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Wed, 27 Jul 2022 13:16:11 +0200 Subject: [PATCH 01/14] Remove modernize check --- ClangTidy.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index 858db49..1e9f8a0 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -137,7 +137,6 @@ function(swift_create_clang_tidy_targets) cppcoreguidelines* google* misc* - modernize* performance* readability*) From bc09e8589c7da9bb2abb15ccdc5a0cf115bf66d2 Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Wed, 27 Jul 2022 15:58:50 +0200 Subject: [PATCH 02/14] Disable more checks --- ClangTidy.cmake | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index 1e9f8a0..5b2d3d1 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -137,12 +137,17 @@ function(swift_create_clang_tidy_targets) cppcoreguidelines* google* misc* + modernize* performance* readability*) # The set of specific tests which will be disabled. All checks in this list should have a reason for being disabled placed in a comment along side. Use wildcards with care, in # general try to disabled the minimum set of checks required and provide a reason for doing so. set(disabled_checks + -clang-analyzer-core.StackAddressEscape + -clang-analyzer-cplusplus.NewDeleteLeaks + -clang-analyzer-deadcode.DeadStores + -clang-analyzer-optin.cplusplus.UninitializedObject # Don't need OSX checks -clang-analyzer-osx* -clang-analyzer-optin.osx.* @@ -168,8 +173,13 @@ function(swift_create_clang_tidy_targets) # endorsement of anything. -cert-dcl03-c -cert-dcl21-cpp + -cert-err33-c -cert-err34-c + -cert-dcl37-c + -cert-dcl51-cpp -cert-err58-cpp + -cert-oop54-cpp + -cert-str34-c -clang-analyzer-alpha* -clang-analyzer-core.CallAndMessage -clang-analyzer-core.UndefinedBinaryOperatorResult @@ -177,7 +187,16 @@ function(swift_create_clang_tidy_targets) -clang-analyzer-core.uninitialized.UndefReturn -clang-analyzer-optin.cplusplus.VirtualCall -clang-analyzer-optin.performance.Padding + -cppcoreguidelines-avoid-c-arrays + -cppcoreguidelines-avoid-goto + -cppcoreguidelines-avoid-magic-numbers + -cppcoreguidelines-avoid-non-const-global-variables + -cppcoreguidelines-init-variables + -cppcoreguidelines-macro-usage + -cppcoreguidelines-narrowing-conversions + -cppcoreguidelines-non-private-member-variables-in-classes -cppcoreguidelines-owning-memory + -cppcoreguidelines-prefer-member-initializer -cppcoreguidelines-pro-bounds-array-to-pointer-decay -cppcoreguidelines-pro-bounds-constant-array-index -cppcoreguidelines-pro-bounds-pointer-arithmetic @@ -186,7 +205,10 @@ function(swift_create_clang_tidy_targets) -cppcoreguidelines-pro-type-union-access -cppcoreguidelines-pro-type-vararg -cppcoreguidelines-special-member-functions + -cppcoreguidelines-virtual-class-destructor -google-runtime-references + -misc-non-private-member-variables-in-classes + -misc-no-recursion -misc-static-assert -modernize-deprecated-headers -modernize-pass-by-value @@ -198,12 +220,25 @@ function(swift_create_clang_tidy_targets) -modernize-use-emplace -modernize-use-equals-default -modernize-use-equals-delete + -modernize-use-trailing-return-type // -modernize-use-using -performance-unnecessary-value-param -readability-avoid-const-params-in-decls + -readability-const-return-type + -readability-container-data-pointer + -readability-convert-member-functions-to-static + -readability-duplicate-include + -readability-function-cognitive-complexity + -readability-identifier-length + -readability-isolate-declaration + -readability-make-member-function-const -readability-non-const-parameter + -readability-qualified-auto + -readability-redundant-access-specifiers -readability-redundant-declaration - -readability-redundant-member-init) + -readability-redundant-member-init + -readability-uppercase-literal-suffix + -readability-use-anyofallof) # Final list of checks to enable/disable set(all_checks -* ${enabled_categories} ${disabled_checks}) From 2a73bbbefb691a3057ad7a57ec4a8ec886621e8f Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Wed, 27 Jul 2022 16:56:49 +0200 Subject: [PATCH 03/14] Remove new checks --- ClangTidy.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index 5b2d3d1..be23f6d 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -210,6 +210,7 @@ function(swift_create_clang_tidy_targets) -misc-non-private-member-variables-in-classes -misc-no-recursion -misc-static-assert + -modernize-avoid-c-arrays -modernize-deprecated-headers -modernize-pass-by-value -modernize-redundant-void-arg @@ -232,6 +233,7 @@ function(swift_create_clang_tidy_targets) -readability-identifier-length -readability-isolate-declaration -readability-make-member-function-const + -readability-magic-numbers -readability-non-const-parameter -readability-qualified-auto -readability-redundant-access-specifiers From 9d6423b35b15aceab04ac47fe9e3425b486cb20c Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Thu, 4 Aug 2022 14:43:07 +0200 Subject: [PATCH 04/14] clang-tidy: remove third_party headers and protobuf generated files Enable clang-tidy for targets created without swift_* functions --- ClangTidy.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index be23f6d..e5a8da9 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -221,7 +221,7 @@ function(swift_create_clang_tidy_targets) -modernize-use-emplace -modernize-use-equals-default -modernize-use-equals-delete - -modernize-use-trailing-return-type // + -modernize-use-trailing-return-type -modernize-use-using -performance-unnecessary-value-param -readability-avoid-const-params-in-decls @@ -253,7 +253,7 @@ function(swift_create_clang_tidy_targets) # Automatically generated, do not edit # Enabled checks are generated from SwiftClangTidy.cmake Checks: \"${comma_checks}\" -HeaderFilterRegex: '.*' +HeaderFilterRegex: '!.*/third_party/.*' AnalyzeTemporaryDtors: true ") endif() @@ -265,6 +265,11 @@ AnalyzeTemporaryDtors: true # Only lint targets created in this repository. Later on we will create 2 targets: clang-tidy-all will lint all "core" targets, executables and libraries clang-tidy-world will # lint everything including test suites swift_list_compilable_targets(all_targets ONLY_THIS_REPO SWIFT_TYPES "executable" "library") + if(x_WITHOUT_SWIFT_TYPES) + swift_list_compilable_targets(all_targets_without_swift_types ONLY_THIS_REPO) + list(APPEND all_targets ${all_targets_without_swift_types}) + list(REMOVE_DUPLICATES all_targets) + endif() swift_list_compilable_targets(world_targets ONLY_THIS_REPO) foreach(target IN LISTS world_targets) @@ -292,6 +297,7 @@ AnalyzeTemporaryDtors: true message(WARNING "No sources to lint for clang-tidy-all, that doesn't sound right") else() list(REMOVE_DUPLICATES all_abs_srcs) + list(FILTER all_abs_srcs EXCLUDE REGEX "pb.cc") create_clang_tidy_targets(all fixes.yaml ${all_abs_srcs}) create_clang_tidy_targets(diff fixes.yaml `git diff --diff-filter=ACMRTUXB --name-only master -- ${all_abs_srcs}`) endif() From 379ae1b35352ffecd275424903a259e8dba886cf Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Thu, 4 Aug 2022 14:52:34 +0200 Subject: [PATCH 05/14] Fix --- ClangTidy.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index e5a8da9..adac41a 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -93,7 +93,7 @@ function(swift_create_clang_tidy_targets) return() endif() - set(argOption "DONT_GENERATE_CLANG_TIDY_CONFIG") + set(argOption "DONT_GENERATE_CLANG_TIDY_CONFIG" "WITHOUT_SWIFT_TYPES") set(argSingle "") set(argMulti "") From 413925506a2e1877fa6cab623756e339e98d19ec Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Fri, 5 Aug 2022 11:03:40 +0200 Subject: [PATCH 06/14] Fixes --- ClangTidy.cmake | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index adac41a..35f7842 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -144,10 +144,6 @@ function(swift_create_clang_tidy_targets) # The set of specific tests which will be disabled. All checks in this list should have a reason for being disabled placed in a comment along side. Use wildcards with care, in # general try to disabled the minimum set of checks required and provide a reason for doing so. set(disabled_checks - -clang-analyzer-core.StackAddressEscape - -clang-analyzer-cplusplus.NewDeleteLeaks - -clang-analyzer-deadcode.DeadStores - -clang-analyzer-optin.cplusplus.UninitializedObject # Don't need OSX checks -clang-analyzer-osx* -clang-analyzer-optin.osx.* @@ -173,13 +169,8 @@ function(swift_create_clang_tidy_targets) # endorsement of anything. -cert-dcl03-c -cert-dcl21-cpp - -cert-err33-c -cert-err34-c - -cert-dcl37-c - -cert-dcl51-cpp -cert-err58-cpp - -cert-oop54-cpp - -cert-str34-c -clang-analyzer-alpha* -clang-analyzer-core.CallAndMessage -clang-analyzer-core.UndefinedBinaryOperatorResult @@ -187,16 +178,7 @@ function(swift_create_clang_tidy_targets) -clang-analyzer-core.uninitialized.UndefReturn -clang-analyzer-optin.cplusplus.VirtualCall -clang-analyzer-optin.performance.Padding - -cppcoreguidelines-avoid-c-arrays - -cppcoreguidelines-avoid-goto - -cppcoreguidelines-avoid-magic-numbers - -cppcoreguidelines-avoid-non-const-global-variables - -cppcoreguidelines-init-variables - -cppcoreguidelines-macro-usage - -cppcoreguidelines-narrowing-conversions - -cppcoreguidelines-non-private-member-variables-in-classes -cppcoreguidelines-owning-memory - -cppcoreguidelines-prefer-member-initializer -cppcoreguidelines-pro-bounds-array-to-pointer-decay -cppcoreguidelines-pro-bounds-constant-array-index -cppcoreguidelines-pro-bounds-pointer-arithmetic @@ -205,12 +187,8 @@ function(swift_create_clang_tidy_targets) -cppcoreguidelines-pro-type-union-access -cppcoreguidelines-pro-type-vararg -cppcoreguidelines-special-member-functions - -cppcoreguidelines-virtual-class-destructor -google-runtime-references - -misc-non-private-member-variables-in-classes - -misc-no-recursion -misc-static-assert - -modernize-avoid-c-arrays -modernize-deprecated-headers -modernize-pass-by-value -modernize-redundant-void-arg @@ -221,10 +199,36 @@ function(swift_create_clang_tidy_targets) -modernize-use-emplace -modernize-use-equals-default -modernize-use-equals-delete - -modernize-use-trailing-return-type -modernize-use-using -performance-unnecessary-value-param -readability-avoid-const-params-in-decls + -readability-non-const-parameter + -readability-redundant-declaration + -readability-use-anyofallof + # Disable all new checks introduced between clang-6 and clang-14 + -clang-analyzer-core.StackAddressEscape + -clang-analyzer-cplusplus.NewDeleteLeaks + -clang-analyzer-deadcode.DeadStores + -clang-analyzer-optin.cplusplus.UninitializedObject + -cert-err33-c + -cert-dcl37-c + -cert-dcl51-cpp + -cert-oop54-cpp + -cert-str34-c + -cppcoreguidelines-avoid-c-arrays + -cppcoreguidelines-avoid-goto + -cppcoreguidelines-avoid-magic-numbers + -cppcoreguidelines-avoid-non-const-global-variables + -cppcoreguidelines-init-variables + -cppcoreguidelines-macro-usage + -cppcoreguidelines-narrowing-conversions + -cppcoreguidelines-non-private-member-variables-in-classes + -cppcoreguidelines-prefer-member-initializer + -cppcoreguidelines-virtual-class-destructor + -misc-non-private-member-variables-in-classes + -misc-no-recursion + -modernize-avoid-c-arrays + -modernize-use-trailing-return-type -readability-const-return-type -readability-container-data-pointer -readability-convert-member-functions-to-static @@ -234,13 +238,10 @@ function(swift_create_clang_tidy_targets) -readability-isolate-declaration -readability-make-member-function-const -readability-magic-numbers - -readability-non-const-parameter -readability-qualified-auto -readability-redundant-access-specifiers - -readability-redundant-declaration -readability-redundant-member-init - -readability-uppercase-literal-suffix - -readability-use-anyofallof) + -readability-uppercase-literal-suffix) # Final list of checks to enable/disable set(all_checks -* ${enabled_categories} ${disabled_checks}) @@ -253,7 +254,7 @@ function(swift_create_clang_tidy_targets) # Automatically generated, do not edit # Enabled checks are generated from SwiftClangTidy.cmake Checks: \"${comma_checks}\" -HeaderFilterRegex: '!.*/third_party/.*' +HeaderFilterRegex: '.*' AnalyzeTemporaryDtors: true ") endif() @@ -264,11 +265,10 @@ AnalyzeTemporaryDtors: true # Only lint targets created in this repository. Later on we will create 2 targets: clang-tidy-all will lint all "core" targets, executables and libraries clang-tidy-world will # lint everything including test suites - swift_list_compilable_targets(all_targets ONLY_THIS_REPO SWIFT_TYPES "executable" "library") - if(x_WITHOUT_SWIFT_TYPES) - swift_list_compilable_targets(all_targets_without_swift_types ONLY_THIS_REPO) - list(APPEND all_targets ${all_targets_without_swift_types}) - list(REMOVE_DUPLICATES all_targets) + if (x_WITHOUT_SWIFT_TYPES) + swift_list_compilable_targets(all_targets ONLY_THIS_REPO) + else() + swift_list_compilable_targets(all_targets ONLY_THIS_REPO SWIFT_TYPES "executable" "library") endif() swift_list_compilable_targets(world_targets ONLY_THIS_REPO) From 822e9a2efcd81d8e24e02a15bbb127ab68f1afc2 Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Fri, 5 Aug 2022 11:05:03 +0200 Subject: [PATCH 07/14] Fix --- ClangTidy.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index 35f7842..9cd1971 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -204,7 +204,7 @@ function(swift_create_clang_tidy_targets) -readability-avoid-const-params-in-decls -readability-non-const-parameter -readability-redundant-declaration - -readability-use-anyofallof + -readability-uppercase-literal-suffix # Disable all new checks introduced between clang-6 and clang-14 -clang-analyzer-core.StackAddressEscape -clang-analyzer-cplusplus.NewDeleteLeaks @@ -241,7 +241,7 @@ function(swift_create_clang_tidy_targets) -readability-qualified-auto -readability-redundant-access-specifiers -readability-redundant-member-init - -readability-uppercase-literal-suffix) + -readability-use-anyofallof) # Final list of checks to enable/disable set(all_checks -* ${enabled_categories} ${disabled_checks}) From cdc6776a881dabe549f66bc272044101f9d8f99e Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Fri, 5 Aug 2022 11:06:27 +0200 Subject: [PATCH 08/14] Fix --- ClangTidy.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index 9cd1971..4fa471d 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -204,7 +204,7 @@ function(swift_create_clang_tidy_targets) -readability-avoid-const-params-in-decls -readability-non-const-parameter -readability-redundant-declaration - -readability-uppercase-literal-suffix + -readability-redundant-member-init # Disable all new checks introduced between clang-6 and clang-14 -clang-analyzer-core.StackAddressEscape -clang-analyzer-cplusplus.NewDeleteLeaks @@ -240,7 +240,7 @@ function(swift_create_clang_tidy_targets) -readability-magic-numbers -readability-qualified-auto -readability-redundant-access-specifiers - -readability-redundant-member-init + -readability-uppercase-literal-suffix -readability-use-anyofallof) # Final list of checks to enable/disable From 89dac708558a45e4a452cd59d0c59d93c3d85039 Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Fri, 5 Aug 2022 12:52:45 +0200 Subject: [PATCH 09/14] Set SYSTEM_INCLUDES in find orion-proto and find starling --- FindOrion-Proto.cmake | 1 + FindStarling.cmake | 1 + 2 files changed, 2 insertions(+) diff --git a/FindOrion-Proto.cmake b/FindOrion-Proto.cmake index 1786711..537c51d 100644 --- a/FindOrion-Proto.cmake +++ b/FindOrion-Proto.cmake @@ -17,4 +17,5 @@ option(orion_proto_ENABLE_TESTS "" false) GenericFindDependency( TARGET orion-proto SOURCE_DIR orion_proto + SYSTEM_INCLUDES ) diff --git a/FindStarling.cmake b/FindStarling.cmake index c0cda33..31b1247 100644 --- a/FindStarling.cmake +++ b/FindStarling.cmake @@ -32,4 +32,5 @@ GenericFindDependency( starling-util SOURCE_DIR starling SYSTEM_HEADER_FILE "pvt_driver/runner/pvt_runner.h" + SYSTEM_INCLUDES ) From c5dc6f148c951acd8a2dfcded723771d44982a77 Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Thu, 18 Aug 2022 11:14:04 +0200 Subject: [PATCH 10/14] Revert SYSTEM_INCLUDES --- FindOrion-Proto.cmake | 1 - FindStarling.cmake | 1 - 2 files changed, 2 deletions(-) diff --git a/FindOrion-Proto.cmake b/FindOrion-Proto.cmake index 537c51d..1786711 100644 --- a/FindOrion-Proto.cmake +++ b/FindOrion-Proto.cmake @@ -17,5 +17,4 @@ option(orion_proto_ENABLE_TESTS "" false) GenericFindDependency( TARGET orion-proto SOURCE_DIR orion_proto - SYSTEM_INCLUDES ) diff --git a/FindStarling.cmake b/FindStarling.cmake index 31b1247..c0cda33 100644 --- a/FindStarling.cmake +++ b/FindStarling.cmake @@ -32,5 +32,4 @@ GenericFindDependency( starling-util SOURCE_DIR starling SYSTEM_HEADER_FILE "pvt_driver/runner/pvt_runner.h" - SYSTEM_INCLUDES ) From b1d30ac630fc1e487367dec25caf102e98b83600 Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Fri, 19 Aug 2022 17:37:56 +0200 Subject: [PATCH 11/14] Disable checks --- ClangTidy.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index 4fa471d..60ca574 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -207,6 +207,7 @@ function(swift_create_clang_tidy_targets) -readability-redundant-member-init # Disable all new checks introduced between clang-6 and clang-14 -clang-analyzer-core.StackAddressEscape + -clang-analyzer-core.VLASize -clang-analyzer-cplusplus.NewDeleteLeaks -clang-analyzer-deadcode.DeadStores -clang-analyzer-optin.cplusplus.UninitializedObject @@ -240,6 +241,7 @@ function(swift_create_clang_tidy_targets) -readability-magic-numbers -readability-qualified-auto -readability-redundant-access-specifiers + -readability-suspicious-call-argument -readability-uppercase-literal-suffix -readability-use-anyofallof) From c1c5d73bfc615948c2c4c46ce6d8b5eac3c6b42b Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Fri, 19 Aug 2022 19:34:40 +0200 Subject: [PATCH 12/14] Disable checks --- ClangTidy.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index 60ca574..7bd90d3 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -212,8 +212,10 @@ function(swift_create_clang_tidy_targets) -clang-analyzer-deadcode.DeadStores -clang-analyzer-optin.cplusplus.UninitializedObject -cert-err33-c + -cert-exp42-c -cert-dcl37-c -cert-dcl51-cpp + -cert-flp37-c -cert-oop54-cpp -cert-str34-c -cppcoreguidelines-avoid-c-arrays @@ -230,6 +232,7 @@ function(swift_create_clang_tidy_targets) -misc-no-recursion -modernize-avoid-c-arrays -modernize-use-trailing-return-type + -performance-no-int-to-ptr -readability-const-return-type -readability-container-data-pointer -readability-convert-member-functions-to-static From 5a2d65dec5d0359f489421df308b3017d3a6e925 Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Mon, 22 Aug 2022 19:57:03 +0200 Subject: [PATCH 13/14] Set clang-tidy and clang-format to 14 --- ClangFormat.cmake | 11 +---------- ClangTidy.cmake | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/ClangFormat.cmake b/ClangFormat.cmake index 8469c2a..ad83202 100644 --- a/ClangFormat.cmake +++ b/ClangFormat.cmake @@ -212,16 +212,7 @@ function(swift_setup_clang_format) # First try to find clang-format if(NOT x_CLANG_FORMAT_NAMES) set(x_CLANG_FORMAT_NAMES - clang-format11 clang-format-11 - clang-format60 clang-format-6.0 - clang-format40 clang-format-4.0 - clang-format39 clang-format-3.9 - clang-format38 clang-format-3.8 - clang-format37 clang-format-3.7 - clang-format36 clang-format-3.6 - clang-format35 clang-format-3.5 - clang-format34 clang-format-3.4 - clang-format + clang-format-14 clang-format ) endif() find_program(CLANG_FORMAT NAMES ${x_CLANG_FORMAT_NAMES}) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index 7bd90d3..921c6c3 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -120,7 +120,7 @@ function(swift_create_clang_tidy_targets) ON CACHE BOOL "Export compile commands" FORCE) - find_program(CLANG_TIDY NAMES clang-tidy-6.0 clang-tidy) + find_program(CLANG_TIDY NAMES clang-tidy-14 clang-tidy) if("${CLANG_TIDY}" STREQUAL "CLANG_TIDY-NOTFOUND") message(WARNING "Could not find clang-tidy, link targets will not be created") From c8c39a142c866da4b085092c118c099c97b70beb Mon Sep 17 00:00:00 2001 From: Krzysztof Naglik Date: Wed, 24 Aug 2022 18:20:26 +0200 Subject: [PATCH 14/14] Set CMAKE_EXPORT_COMPILE_COMMANDS in the global space --- ClangTidy.cmake | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ClangTidy.cmake b/ClangTidy.cmake index 921c6c3..9f8cbd9 100644 --- a/ClangTidy.cmake +++ b/ClangTidy.cmake @@ -69,6 +69,8 @@ # will explicitly disable these targets from the command line at configure time # +set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Export compile commands" FORCE) + # Helper function to actually create the targets, not to be used outside this file function(create_clang_tidy_targets key fixes) add_custom_target( @@ -115,11 +117,6 @@ function(swift_create_clang_tidy_targets) early_exit(STATUS "${PROJECT_NAME} clang-tidy support is DISABLED") endif() - # This is required so that clang-tidy can work out what compiler options to use for each file - set(CMAKE_EXPORT_COMPILE_COMMANDS - ON - CACHE BOOL "Export compile commands" FORCE) - find_program(CLANG_TIDY NAMES clang-tidy-14 clang-tidy) if("${CLANG_TIDY}" STREQUAL "CLANG_TIDY-NOTFOUND")