llvm-project/clang-tools-extra/clang-tidy
Shoaib Meenai d806af3499 [CMake] Use PRIVATE in target_link_libraries for executables
We currently use target_link_libraries without an explicit scope
specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables.
Dependencies added in this way apply to both the target and its
dependencies, i.e. they become part of the executable's link interface
and are transitive.

Transitive dependencies generally don't make sense for executables,
since you wouldn't normally be linking against an executable. This also
causes issues for generating install export files when using
LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM
library dependencies, which are currently added as interface
dependencies. If clang is in the distribution components but the LLVM
libraries it depends on aren't (which is a perfectly legitimate use case
if the LLVM libraries are being built static and there are therefore no
run-time dependencies on them), CMake will complain about the LLVM
libraries not being in export set when attempting to generate the
install export file for clang. This is reasonable behavior on CMake's
part, and the right thing is for LLVM's build system to explicitly use
PRIVATE dependencies for executables.

Unfortunately, CMake doesn't allow you to mix and match the keyword and
non-keyword target_link_libraries signatures for a single target; i.e.,
if a single call to target_link_libraries for a particular target uses
one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must
also be updated to use those keywords. This means we must do this change
in a single shot. I also fully expect to have missed some instances; I
tested by enabling all the projects in the monorepo (except dragonegg),
and configuring both with and without shared libraries, on both Darwin
and Linux, but I'm planning to rely on the buildbots for other
configurations (since it should be pretty easy to fix those).

Even after this change, we still have a lot of target_link_libraries
calls that don't specify a scope keyword, mostly for shared libraries.
I'm thinking about addressing those in a follow-up, but that's a
separate change IMO.

Differential Revision: https://reviews.llvm.org/D40823

llvm-svn: 319840
2017-12-05 21:49:56 +00:00
..
android [clang-tidy] Remove unused static variable. 2017-08-16 21:00:06 +00:00
boost [clang-tidy] boost-use-to-string arg expr location bugfix 2016-06-28 08:16:20 +00:00
bugprone [clang-tidy] Move a few more checks from misc to bugprone. 2017-11-24 14:16:29 +00:00
cert [clang-tidy] Fix link error in clang-tidy after the recent check renames. 2017-11-27 15:17:13 +00:00
cppcoreguidelines [clang-tidy] introduce legacy resource functions to 'cppcoreguidelines-owning-memory' 2017-10-18 16:14:15 +00:00
fuchsia Commit access test. 2017-12-05 18:50:49 +00:00
google add check to avoid throwing objc exception according to Google Objective-C guide 2017-11-16 01:28:29 +00:00
hicpp [clang-tidy] Move more checks from misc- to performance- 2017-11-28 16:41:03 +00:00
llvm [clang-tidy] Unify the way IncludeStyle and HeaderFileExtesions options are used 2017-07-20 12:02:03 +00:00
misc [clang-tidy] Move more checks from misc- to performance- 2017-11-28 16:41:03 +00:00
modernize Fix build after r319688: s/CPlusPlus1z/CPlusPlus17/ 2017-12-04 20:38:21 +00:00
mpi modernize-use-auto NFC fixes 2016-12-14 15:29:23 +00:00
objc add new check to find NSError init invocation 2017-11-30 19:05:09 +00:00
performance [clang-tidy] Move more checks from misc- to performance- 2017-11-28 16:41:03 +00:00
plugin [clang-tidy ObjC] [1/3] New module `objc` for Objective-C checks 2017-10-26 08:23:20 +00:00
readability [clang-tidy] make readability-simplify-bool-expr completely ignore macros 2017-11-29 17:16:09 +00:00
tool [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
utils [clang-tidy] Implement type-based check for `gsl::owner` 2017-09-12 20:00:42 +00:00
CMakeLists.txt Add a new clang-tidy module for Fuchsia as an umbrella to diagnose issues with the Fuschia and Zircon coding guidelines (https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md). Adds the first of such checkers, which detects when default arguments are declared in a function declaration or when default arguments are used at call sites. 2017-11-28 21:09:25 +00:00
ClangTidy.cpp Change getChecksFilter() interface to hide implementation details. 2017-05-17 14:39:47 +00:00
ClangTidy.h [clang-tidy] Add FormatStyle configuration option. 2017-04-06 13:41:29 +00:00
ClangTidyDiagnosticConsumer.cpp [clang-tidy] Ignore newlines in checks list 2017-08-09 16:00:31 +00:00
ClangTidyDiagnosticConsumer.h [clang-tidy] Optimize GlobList::contains 2017-05-18 01:13:51 +00:00
ClangTidyModule.cpp Change getChecksFilter() interface to hide implementation details. 2017-05-17 14:39:47 +00:00
ClangTidyModule.h [clang-tools-extra] Format sources with clang-format. NFC. 2016-11-08 07:50:19 +00:00
ClangTidyModuleRegistry.h Reapply r276973 "Adjust Registry interface to not require plugins to export a registry" 2016-08-05 11:01:08 +00:00
ClangTidyOptions.cpp Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR 2017-06-30 20:57:16 +00:00
ClangTidyOptions.h [clang-tidy] Add FormatStyle configuration option. 2017-04-06 13:41:29 +00:00
add_new_check.py [clang-tidy] Actually fix header guard handling in scripts 2017-11-25 08:49:04 +00:00
rename_check.py [clang-tidy] Rename qualified references to check class + support inconsistent names 2017-11-27 17:59:26 +00:00