Commit Graph

96 Commits

Author SHA1 Message Date
Luke Cheeseman 14cfb0de5d clang-interpreter example cmake fix
Add in a space when appending the export to the linker options. Without
the space the export is appended onto whatever the last link option
was, which might be a file.

llvm-svn: 328092
2018-03-21 12:05:19 +00:00
Frederich Munch f11cc49f7c [CMake] Properly quote string arguments to quiet errors from r327528 when built
with LLVM_ENABLE_EH and LLVM_ENABLE_RTTI.

llvm-svn: 327531
2018-03-14 16:56:02 +00:00
Frederich Munch 529ce72efc Expand clang-interpreter with example of throwing in and from the JIT for Windows64.
Summary:
Getting this to work is not particularly obvious, and having it as an example should be helpful.
Portions of this could be placed into LLVM, but as a whole it seems necessary to do this a higher level.

Reviewers: lhames, mehdi_amini

Reviewed By: lhames

Subscribers: mgrang, martell, cfe-commits, mgorny

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

llvm-svn: 327528
2018-03-14 16:04:45 +00:00
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
NAKAMURA Takumi 9393654530 Add LLVMOption to clang-interpreter, corresponding to r291938.
llvm-svn: 292007
2017-01-14 08:54:05 +00:00
David Blaikie ea4395ebcd Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer"
Aleksey Shlypanikov pointed out my mistake in migrating an explicit
unique_ptr to auto - I was expecting the function returned a unique_ptr,
but instead it returned a raw pointer - introducing a leak.

Thanks Aleksey!

This reapplies r291184, reverted in r291249.

llvm-svn: 291270
2017-01-06 19:49:01 +00:00
David Blaikie 98f0af4b3e Revert "Fix examples for recent shared_ptrification"
(should've rolled in to this revert of the CompilerInstance change in
the first place... anyway)

This reverts commit r291185.

llvm-svn: 291252
2017-01-06 17:50:34 +00:00
David Blaikie bbe146f226 Fix examples for recent shared_ptrification
llvm-svn: 291185
2017-01-05 22:36:44 +00:00
Chris Bieneman 2bf68c6c1c 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

    "This is the way [autoconf] ends
    Not with a bang but a whimper."
    -T.S. Eliot

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: klimek, cfe-commits

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

llvm-svn: 258862
2016-01-26 21:30:40 +00:00
Justin Bogner 4075f6ce21 Driver: Update clang-interpreter example for r218938
llvm-svn: 218942
2014-10-03 01:08:27 +00:00
David Blaikie c11bf80265 unique_ptrify JobList::Jobs
llvm-svn: 217168
2014-09-04 16:04:28 +00:00
Iain Sandoe fe3add79bf Fix configure and make build of clang-interpreter.
Replaced 'jit' link component with 'mcjit'.
Updated the required libraries.

llvm-svn: 217033
2014-09-03 13:13:50 +00:00
Eric Christopher af2b7dc522 Reinstate "Update for llvm API change.""
This reinstates r215113.

llvm-svn: 216986
2014-09-02 22:35:49 +00:00
Rafael Espindola aca3be852a Go back to having a takeModule instead of a getModule.
Returning a std::unique_ptr is more constrained. Thanks to David Blaikie for the
suggestion.

llvm-svn: 215979
2014-08-19 14:32:16 +00:00
Rafael Espindola a296664479 Update for llvm api change.
llvm-svn: 215968
2014-08-19 04:04:30 +00:00
Eric Christopher 3668534f92 Temporarily Revert "Update for llvm API change."
This reverts commit 215113 to match the reversion in llvm.

llvm-svn: 215156
2014-08-07 22:09:08 +00:00
Rafael Espindola b0ece4e07d Update for llvm API change.
llvm-svn: 215113
2014-08-07 14:23:03 +00:00
Rafael Espindola 3175daa950 Use ELF in the clang-interpreter on windows.
We don't support loading COFF files yet.

llvm-svn: 213893
2014-07-24 20:47:42 +00:00
Rafael Espindola 2daa6ede46 Attempt at fixing the windows shared build.
llvm-svn: 213881
2014-07-24 17:38:18 +00:00
Rafael Espindola e89d2891dd Use MCJIT.
llvm-svn: 213879
2014-07-24 17:13:09 +00:00
Rafael Espindola fb3d5d1750 Remove the last use of llvm::ExecutionEngine::create.
llvm-svn: 213869
2014-07-24 15:54:23 +00:00
Alp Toker 0621cb2e7d Make clang's rewrite engine a core feature
The rewrite facility's footprint is small so it's not worth going to these
lengths to support disabling at configure time, particularly since key compiler
features now depend on it.

Meanwhile the Objective-C rewriters have been moved under the
ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still
potentially worth excluding from lightweight builds.

Tests are now passing with any combination of feature flags. The flags
historically haven't been tested by LLVM's build servers so caveat emptor.

llvm-svn: 213171
2014-07-16 16:48:33 +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
Alp Toker ed412dac65 clang-interpreter: don't check input file existence, we're in-process
This flag is set by most other tools and avoids extra stat() calls. The
frontend will diagnose anyway as it performs the check atomically while opening
files at point of use.

We could probably make Driver::CheckInputsExist default to false and only
enable it in the main 'clang' binary, or even better only perform the checks if
we know the tool is external but that needs more thought.

llvm-svn: 212585
2014-07-09 01:37:36 +00:00
Alp Toker 60c88cbf7f clang-interpreter: use LLVM interpreter if JIT is unavailable
Update the strategy in r212083 to try JIT first and otherwise fall back to the
interpreter. This gives the best of both worlds and still builds fine with no
targets enabled.

Requires supporting changes from LLVM r212086.

llvm-svn: 212087
2014-07-01 03:19:50 +00:00
Alp Toker 475f282b5d clang-interpreter: interpret instead of JITing
Fixes the build when no targets are selected, or no native target is built.

This also better matches up with the description/title of the example and
demonstrates how clang can be used to run C++ on constrained environments
without file IO or executable memory permissions (e.g. iOS apps).

A comment is added explaining how to extend the demo with JIT support as
needed.

llvm-svn: 212083
2014-07-01 02:41:55 +00:00
Alp Toker 1761f11801 Eliminate DefaultImageName from the Driver constructor
All callers were passing in "a.out" or garbage so a sensible default works fine
here as a cleanup.

This also brings about the possibility of adapting the value based on the
driver's compatibility mode in future.

The setting can still be changed via Driver::DefaultImageName as needed.

llvm-svn: 208926
2014-05-15 22:26:36 +00:00
Ahmed Charles a3374446d4 Fix build break, replace take() with release().
llvm-svn: 203390
2014-03-09 11:46:32 +00:00
Ahmed Charles dfca6f97bc [C++11] Replace OwningPtr include with <memory>.
llvm-svn: 203389
2014-03-09 11:36:40 +00:00
Ahmed Charles af94d56b56 [C++11] Remove the remaining uses of OwningPtr.
Replace OwningArrayPtr with std::unique_ptr<T[]>.

llvm-svn: 203388
2014-03-09 11:34:25 +00:00
NAKAMURA Takumi ac85179219 [CMake] Update target_link_libraries() and LLVM_LINK_COMPONENTS for each CMakeLists.txt.
llvm-svn: 196916
2013-12-10 12:40:37 +00:00
NAKAMURA Takumi 320b4d21c8 Add ObjCARCOpts to LINK_COMPONENTS.
llvm-svn: 196915
2013-12-10 12:40:11 +00:00
Bill Wendling 83da4dae3d Add irreader to the component list, because ParseIR is called.
llvm-svn: 193032
2013-10-19 08:33:11 +00:00
Hans Wennborg b212b34f19 Move Compilation::PrintJob and PrintDiagnosticJob into Job::Print.
This moves the code to Job.cpp, which seems like a more natural fit,
and replaces the "is this a JobList? is this a Command?" logic with
a virtual function call.

It also removes the code duplication between PrintJob and
PrintDiagnosticJob and simplifies the code a little.

There's no functionality change here, except that the Executable is
now always printed within quotes, whereas it would previously not be
quoted in crash reports, which I think was a bug.

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

llvm-svn: 190620
2013-09-12 18:23:34 +00:00
Rafael Espindola e6151cf586 Remove unused header.
llvm-svn: 184945
2013-06-26 13:49:47 +00:00
Rafael Espindola 9678d27140 Use llvm::sys::fs::getMainExecutable.
llvm-svn: 184915
2013-06-26 05:03:40 +00:00
Rafael Espindola 1600a53bc0 Include PathV1.h only where it is used.
llvm-svn: 184090
2013-06-17 17:23:47 +00:00
Reid Kleckner 898229ab4b [Driver] Refactor clang driver to use LLVM's Option library
The big changes are:
- Deleting Driver/(Arg|Opt)*
- Rewriting includes to llvm/Option/ and re-sorting
- 'using namespace llvm::opt' in clang::driver
- Fixing the autoconf build by adding option everywhere

As discussed in the review, this change includes using directives in
header files.  I'll make follow up changes to remove those in favor of
name specifiers.

Reviewers: espindola

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

llvm-svn: 183989
2013-06-14 17:17:23 +00:00
Chandler Carruth b45836a231 The IRReader header is now part of its own library. Update the include
line and the library dependencies to reflect this.

llvm-svn: 177972
2013-03-26 02:25:54 +00:00
Sean Silva f1b49e237f Nuke SetUpBuildDumpLog.
Also, it was the only reason that `argc` and `argv` were being passed
into createDiagnostics, so remove those parameters and clean up callers.

llvm-svn: 172945
2013-01-20 01:58:28 +00:00
Peter Collingbourne e8baf33712 Use getProcessTriple in clang-interpreter.
llvm-svn: 172664
2013-01-16 22:37:09 +00:00
Dmitri Gribenko f857950d39 Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h

llvm-svn: 172323
2013-01-12 19:30:44 +00:00
Chandler Carruth ffd5551bc7 Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate to
reflect the migration in r171366.

Re-sort the #include lines to reflect the new paths.

llvm-svn: 171369
2013-01-02 11:45:17 +00:00
Chandler Carruth 8675b4af77 Sort the #include lines for examples/...
llvm-svn: 169241
2012-12-04 09:37:22 +00:00
Rafael Espindola e3cfca7aa2 Fix examples.
llvm-svn: 168705
2012-11-27 16:16:02 +00:00
Douglas Gregor cdb4d699a8 Update clang-interpreter example
llvm-svn: 166510
2012-10-23 22:36:49 +00:00
Ted Kremenek cdf814900d Split library clangRewrite into clangRewriteCore and clangRewriteFrontend.
This is similar to how we divide up the StaticAnalyzer libraries to separate
core functionality to what is clearly associated with Frontend actions.

llvm-svn: 163050
2012-09-01 05:09:24 +00:00
Chandler Carruth 28969b4139 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

llvm-svn: 158888
2012-06-21 01:30:21 +00:00
Douglas Gregor 11f91b9fe7 Remove clangIndex reference from clang-interpreter CMake build
llvm-svn: 154674
2012-04-13 17:22:46 +00:00
NAKAMURA Takumi a4917fade7 clang-interpreter/Makefile: [PR12313] Update USEDLIBS to add clangEdit.
llvm-svn: 153167
2012-03-21 06:25:42 +00:00