Commit Graph

165 Commits

Author SHA1 Message Date
David Blaikie 62a56f39b7 Revert "unique_ptr-ify ownership of ASTConsumers"
This reverts commit r213307.

Reverting to have some on-list discussion/confirmation about the ongoing
direction of smart pointer usage in the LLVM project.

llvm-svn: 213325
2014-07-17 22:34:12 +00:00
David Blaikie a51666a4d6 unique_ptr-ify ownership of ASTConsumers
(after fixing a bug in MultiplexConsumer I noticed the ownership of the
nested consumers was implemented with raw pointers - so this fixes
that... and follows the source back to its origin pushing unique_ptr
ownership up through there too)

llvm-svn: 213307
2014-07-17 20:40:36 +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
NAKAMURA Takumi 9b9de47d15 [CMake] Give explicit dependencies to a couple of modules, PrintFunctionNames and SampleAnalyzerPlugin, for Win32.DLL.
llvm-svn: 212906
2014-07-13 13:40:23 +00:00
NAKAMURA Takumi 6672b8e4ee PrintFunctionNames/CMakeLists.txt: Fix a comment.
llvm-svn: 212905
2014-07-13 13:38:55 +00:00
NAKAMURA Takumi ad4c06c656 Instantiate llvm::Registry<clang::PluginASTAction> in FrontendAction.cpp.
- Plugins don't need to export _ZN4llvm8Registry*.
  - Win32.DLL cannot merge common symbols among DLLs. Static members in llvm::Registry should be instantiated in a parent.

llvm-svn: 212821
2014-07-11 15:06:24 +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 7da9487dd4 [CMake] Get rid of explicit dependencies to include/clang/*.inc and introduce CLANG_TABLEGEN_TARGETS.
This does;
  - clang_tablegen() adds each tblgen'd target to global property CLANG_TABLEGEN_TARGETS as list.
  - List of targets is added to LLVM_COMMON_DEPENDS.
  - all clang libraries and targets depend on generated headers.

You might wonder this would be regression, but in fact, this is little loss.
  - Almost all of clang libraries depend on tblgen'd files and clang-tblgen.
  - clang-tblgen may cause short stall-out but doesn't cause unconditional rebuild.
  - Each library's dependencies to tblgen'd files might vary along headers' structure.
    It made hard to track and update *really optimal* dependencies.

Each dependency to intrinsics_gen and ClangSACheckers is left as DEPENDS.

llvm-svn: 201842
2014-02-21 07:59:59 +00:00
Jordan Rose ee9808dfdf [CMake] Fix installation without CLANG_BUILD_EXAMPLES
When CLANG_BUILD_EXAMPLES is not on we set the EXCLUDE_FROM_ALL
directory property for the examples/ directory to tell CMake not to
build them by default.  The AddLLVM.cmake APIs are not aware of this and
try to install targets that are not built.  This does not cause an
install-time error because CMake excludes the directory from the default
installation.  However, now that installation attaches targets to the
LLVMExports export set CMake-based applications that find_package(LLVM)
fail because the example plugin binary is not available.

Tell the AddLLVM.cmake APIs to exclude the examples from installation by
setting the EXCLUDE_FROM_ALL variable they check.

Patch by Brad King!

llvm-svn: 201799
2014-02-20 17:43:31 +00:00
Jordan Rose ab57f79df4 [examples] Add tablegen'd ClangCommentCommandList as a dependency for plugins.
Also, remove library dependencies for the sample analyzer-plugin. The only
library changes that would require a rebuild should be in headers, which
should already implicitly be marked as dependencies.

llvm-svn: 201350
2014-02-13 18:12:30 +00:00
Jordan Rose 68db107c81 [examples] Use loadable modules instead of shared libraries for Clang plugins.
This avoids linking in extra copies of, say, LLVMSupport.

llvm-svn: 201256
2014-02-12 21:04:23 +00:00
Alexander Kornienko 4aca9b1cd8 Expose the name of the checker producing each diagnostic message.
Summary:
In clang-tidy we'd like to know the name of the checker producing each
diagnostic message. PathDiagnostic has BugType and Category fields, which are
both arbitrary human-readable strings, but we need to know the exact name of the
checker in the form that can be used in the CheckersControlList option to
enable/disable the specific checker.

This patch adds the CheckName field to the CheckerBase class, and sets it in
the CheckerManager::registerChecker() method, which gets them from the
CheckerRegistry.

Checkers that implement multiple checks have to store the names of each check
in the respective registerXXXChecker method.

Reviewers: jordan_rose, krememek

Reviewed By: jordan_rose

CC: cfe-commits

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

llvm-svn: 201186
2014-02-11 21:49:21 +00:00
NAKAMURA Takumi a050e3e9bd [CMake] Suppress SampleAnalyzerPlugin w/o ENABLE_STATIC_ANALYZER.
llvm-svn: 200532
2014-01-31 11:19:09 +00:00
NAKAMURA Takumi ac3ff26885 [CMake] Parameterize MODULE and SHARED in add_clang_library().
llvm-svn: 199902
2014-01-23 15:33:44 +00:00
Nico Weber c45921903f Don't use PrintFunctionNames.exports on Windows.
llvm-svn: 198187
2013-12-30 00:05:56 +00:00
Nico Weber e8ef46c851 Fix typo in comment.
llvm-svn: 198186
2013-12-29 23:15:01 +00:00
Nico Weber 216436c77a [cmake] Set in LLVM_EXPORTED_SYMBOL_FILE PrintFunctionNames/CMakeLists.txt.
The corresponding Makefile sets it too. Also tweak add_clang_library to support
LLVM_EXPORTED_SYMBOL_FILE for modules.

llvm-svn: 198185
2013-12-29 23:14:26 +00:00
Alp Toker 9477f9e52f Fix getCustomDiagID() usage in example code
This was setting a bad example. DiagIDs are a limited resource and the message
argument is evaluated as a format string.

llvm-svn: 197855
2013-12-21 05:19:58 +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
Douglas Gregor 27c42e66bb Revert r170801, which breaks the mingw build.
llvm-svn: 170804
2012-12-20 23:36:52 +00:00
Douglas Gregor d04592dc81 Eliminate errors when running the 'PrintFunctionNames' plugin, from Li Qun!
llvm-svn: 170801
2012-12-20 23:11:42 +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
NAKAMURA Takumi 53eefc43f4 analyzer-plugin/MainCallChecker.cpp: Fixup corresponding to r167275.
llvm-svn: 167278
2012-11-02 02:04:01 +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
NAKAMURA Takumi a9a35c67e1 libclang, examples: [CMake] Add dependencies to tblgen'd headers.
llvm-svn: 160849
2012-07-27 06:17:56 +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
Peter Collingbourne 9251b7d873 Honour CLANG_BUILD_EXAMPLES correctly, by setting the directory's
EXCLUDE_FROM_ALL property.

llvm-svn: 156090
2012-05-03 19:11:45 +00:00
Manuel Klimek 34e0f6cba2 Reverted unintentional commit.
llvm-svn: 155629
2012-04-26 08:46:12 +00:00
Manuel Klimek c01d3fbe0f Adds a small tutorial on how to write RAV based ASTFrontendActions.
llvm-svn: 155627
2012-04-26 08:35:39 +00:00