Commit Graph

47 Commits

Author SHA1 Message Date
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
Peter Smith d34a65d6b6 [NFC] Update to account for DiagnosticRenderer use of FullSourceLoc
D31709 [NFC] Refactor DiagnosticRenderer to use FullSourceLoc was committed
in r305684 and reverted in 305688 as clang-tidy and clang-query failed to
build. This change updates the extra tools to use the new interface.

Reviewers: christof, rnk, rsmith, rovka, alexfh

Reviewed By: alexfh

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

llvm-svn: 306385
2017-06-27 10:04:04 +00:00
Piotr Padlewski 08124b110a modernize-use-auto NFC fixes
llvm-svn: 289656
2016-12-14 15:29:23 +00:00
Mandeep Singh Grang 7c7ea7d0ae [clang-tools-extra] Format sources with clang-format. NFC.
Summary:
Ran clang-format on all .c/.cpp/.h files in clang-tools-extra.
Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories.

Reviewers: klimek, alexfh

Subscribers: nemanjai

Tags: #clang-tools-extra

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

llvm-svn: 286221
2016-11-08 07:50:19 +00:00
Malcolm Parsons d03c254662 [clang-query] Fix Clang-tidy readability-redundant-string-cstr warnings
Reviewers: pcc, dblaikie

Subscribers: cfe-commits

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

llvm-svn: 285731
2016-11-01 20:07:05 +00:00
Richard Smith 22252f9847 Update to match LLVM r272232.
llvm-svn: 272235
2016-06-09 00:54:42 +00:00
Eugene Zelenko 05f7e6ae0d Fix Clang-tidy modernize-deprecated-headers warnings; other minor fixes.
Differential revision: http://reviews.llvm.org/D18231

llvm-svn: 263726
2016-03-17 17:02:25 +00:00
Chris Bieneman 2cc7fec76a Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"Now I am become Death, the destroyer of worlds."
-J. Robert Oppenheimer

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D16475

llvm-svn: 258864
2016-01-26 21:31:36 +00:00
David Blaikie e04a3da093 Revert "Apply modernize-use-default to clang-tools-extra."
Breaks the build in GCC 4.7.2 (see
http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3 for example)

This reverts commit r250824.

llvm-svn: 250862
2015-10-20 21:45:52 +00:00
Angel Garcia Gomez 3ca34bc870 Apply modernize-use-default to clang-tools-extra.
Summary: Replace empty bodies of default constructors and destructors with '= default'.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

Differential Revision: http://reviews.llvm.org/D13889

llvm-svn: 250824
2015-10-20 12:56:27 +00:00
Manuel Klimek 55dc5df59f Install clang-query by default.
It is already installed by the autotools build, and it is useful for
developers who are not working on LLVM/Clang itself.

llvm-svn: 248710
2015-09-28 13:26:39 +00:00
Aaron Ballman 5890717e70 Add the "quit" command as a way to terminate clang-query interactive sessions.
llvm-svn: 244206
2015-08-06 11:56:57 +00:00
Adrian Prantl db8ef097be Add missing dependency clangFrontend to clangQuery.
llvm-svn: 240227
2015-06-20 19:28:07 +00:00
Alexander Kornienko 87638f6345 Use 'override/final' instead of 'virtual' for overridden methods
Summary:
The patch is generated using clang-tidy misc-use-override check.

This command was used:

  tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
      -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix

  svn diff | clang-format-diff -i

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8927

llvm-svn: 234681
2015-04-11 07:59:33 +00:00
Samuel Benzaquen e39269e790 Add 'let' to the help message.
Summary: Add 'let' to the help message.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7940

llvm-svn: 230768
2015-02-27 17:53:23 +00:00
Adrian Prantl b97f5c1eb2 Revert "Adapt clang-tools-extra to clang module format changes."
This reverts commit 230424.

llvm-svn: 230456
2015-02-25 02:46:37 +00:00
Adrian Prantl e95edbf5a9 Adapt clang-tools-extra to clang module format changes.
- add clangCodeGen.a to the tools that need it
- tweak pp-trace command line handling to not conflict with clang's.

llvm-svn: 230424
2015-02-25 01:32:04 +00:00
Adrian Prantl a22fd38174 Revert "Adapt Makefile dependencies for the clang module format change in r230089."
llvm-svn: 230104
2015-02-21 00:29:43 +00:00
Adrian Prantl 6897e3e456 Adapt Makefile dependencies for the clang module format change in r230089.
llvm-svn: 230090
2015-02-20 23:35:07 +00:00
Craig Topper ae926ad24d Remove call to llvm::makeArrayRef. Implicit conversion is sufficient.
llvm-svn: 216711
2014-08-29 06:05:20 +00:00
Craig Topper 2f020e5497 Simplify creation of a couple ArrayRefs by using None and makeArrayRef.
llvm-svn: 216529
2014-08-27 06:29:07 +00:00
Samuel Benzaquen d7349439d5 [clang-query] Use the new API for named values from the Parser.
Summary: This finishes the support for autocomplete for user defined values..

Reviewers: pcc

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4851

llvm-svn: 215474
2014-08-12 21:22:58 +00:00
Alexander Kornienko 228dda5ac5 Use CommonOptionsParser in clang-query. This fixes its support of the fixed
compilation database and makes it behave consistently with other clang tools.

Reviewers: klimek, pcc

Reviewed By: pcc

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4763

llvm-svn: 214607
2014-08-02 01:02:33 +00:00
Alp Toker e208dfc2af Track clang r213171
The clang rewriter is now a core facility.

llvm-svn: 213172
2014-07-16 16:50:17 +00:00
NAKAMURA Takumi 04b8b37f56 Prune Redundant libdeps in CMake's target_link_libraries and LLVMBuild.txt.
I checked this with Release+Asserts on x86_64-mingw32. Please restore partially if this were overkill.

llvm-svn: 213064
2014-07-15 11:37:03 +00:00
NAKAMURA Takumi 23b702c8de [CMake] Update libdeps.
llvm-svn: 212920
2014-07-14 05:01:53 +00:00
Craig Topper 6014c49921 Simplify code. No functional change.
llvm-svn: 210508
2014-06-10 04:50:50 +00:00
Craig Topper f61be9c971 [C++11] Use 'nullptr'.
llvm-svn: 210447
2014-06-09 02:03:06 +00:00
Manuel Klimek 5a1ef9c855 Fix clang-query on Windows: flush llvm::outs() after each command.
llvm-svn: 209313
2014-05-21 18:10:47 +00:00
David Blaikie 35013fa390 Slightly less blindly fixing clang-tools-extra now that I remember that the "check-clang" target doesn't check clang-tools-extra
llvm-svn: 207231
2014-04-25 15:21:43 +00:00
David Blaikie 329be894f1 Blindly try to fix the clang-tools-extra build since my local build doesn't appear to be picking it up
llvm-svn: 207230
2014-04-25 15:06:18 +00:00
NAKAMURA Takumi fcb3fa13c4 QueryParser::doParse(): Fix msc17 build. Don't use initializer list.
llvm-svn: 206998
2014-04-23 16:01:44 +00:00
Samuel Benzaquen 1f6066c9ac Add new 'let' command to bind arbitrary values into constants.
Summary:
Add new 'let' command to bind arbitrary values into constants.
These constants can then be used in the matcher expressions.

Reviewers: pcc

CC: cfe-commits

Differential Revision: http://reviews.llvm.org/D3383

llvm-svn: 206984
2014-04-23 14:04:52 +00:00
Ahmed Charles 6a2dc5c381 [C++11] Replace OwningPtr with std::unique_ptr.
This removes all references to OwningPtr, which should be fairly
undisruptive to out-of-tree projects since they are unlikely to use
clang-tools-extra as a library instead of a set of tools.

llvm-svn: 203382
2014-03-09 09:24:40 +00:00
Chandler Carruth edc9e38810 [cleanup] Re-sort headers with llvm/utils/sort_includes.py.
llvm-svn: 202809
2014-03-04 10:03:05 +00:00
Dmitri Gribenko 23077e3e0a Documentation comments: fix incorrect usage of \param
llvm-svn: 202649
2014-03-02 16:48:59 +00:00
Craig Topper a3dbe84166 [C++11] Replace LLVM_OVERRIDE with 'override'
llvm-svn: 202632
2014-03-02 10:20:11 +00:00
NAKAMURA Takumi 9698686505 [CMake] Use LINK_LIBS instead of target_link_libraries().
llvm-svn: 202238
2014-02-26 06:41:29 +00:00
Peter Collingbourne b549019c3c Add a makefile for clang-query. Patch by Alex Horn!
While at it, have cmake build and test the tool if libedit is not installed,
as this dependency is now optional.

llvm-svn: 201599
2014-02-18 19:46:01 +00:00
Peter Collingbourne d9a0f254bc Add completion to the query parser, and hook it up to clang-query.
Differential Revision: http://llvm-reviews.chandlerc.com/D2263

llvm-svn: 200604
2014-02-01 01:42:46 +00:00
Peter Collingbourne c31176da02 Switch clang-query to use the lineeditor library.
Differential Revision: http://llvm-reviews.chandlerc.com/D2262

llvm-svn: 200603
2014-02-01 01:42:42 +00:00
Chandler Carruth 85e6e87171 Run llvm/utils/sort_includes.py over the Clang tools code. This doesn't
always produce as pretty of results as it does in LLVM and Clang, but
I don't mind and the value of having a single canonical ordering is very
high IMO.

Let me know if you spot really serious problems here.

llvm-svn: 198703
2014-01-07 20:05:01 +00:00
NAKAMURA Takumi 78f534d689 [CMake] clang-tools-extra: Update dependencies.
llvm-svn: 196860
2013-12-10 01:41:10 +00:00
Peter Collingbourne c7ae6101a4 Revert r194247 conditional on non-MSVC.
These definitions are required by the standard.  MSVC rejecting them
appears to be a bug.

llvm-svn: 194252
2013-11-08 08:54:53 +00:00
NAKAMURA Takumi 55380c4e54 clang-query: Unbreak msvc.
llvm-svn: 194247
2013-11-08 06:29:09 +00:00
Peter Collingbourne 0dc0e6d32c Silence GCC warning.
llvm-svn: 194230
2013-11-08 01:08:12 +00:00
Peter Collingbourne 8b1265b353 Introduce clang-query tool.
This tool is for interactive exploration of the Clang AST using AST matchers.
It currently allows the user to enter a matcher at an interactive prompt
and view the resulting bindings as diagnostics, AST pretty prints or AST
dumps. Example session:

$ cat foo.c
void foo(void) {}
$ clang-query foo.c --
clang-query> match functionDecl()

Match #1:

foo.c:1:1: note: "root" binds here
void foo(void) {}
^~~~~~~~~~~~~~~~~
1 match.

Differential Revision: http://llvm-reviews.chandlerc.com/D2098

llvm-svn: 194227
2013-11-08 00:08:23 +00:00