aboutsummaryrefslogtreecommitdiff
path: root/clang/examples
AgeCommit message (Collapse)AuthorFilesLines
2017-01-14Add LLVMOption to clang-interpreter, corresponding to r291938.NAKAMURA Takumi1-0/+1
llvm-svn: 292007
2017-01-06Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase ↵David Blaikie1-1/+1
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-06Revert "Fix examples for recent shared_ptrification"David Blaikie1-1/+1
(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-05Fix examples for recent shared_ptrificationDavid Blaikie1-1/+1
llvm-svn: 291185
2016-10-10[Examples] Fix use of sema.LateParsedTemplateMap in clang/examples.Justin Lebar1-2/+3
llvm-svn: 283778
2016-08-05Reapply r276973 "Adjust Registry interface to not require plugins to export ↵John Brawn2-2/+2
a registry" This differs from the previous version by being more careful about template instantiation/specialization in order to prevent errors when building with clang -Werror. Specifically: * begin is not defined in the template and is instead instantiated when Head is. I think the warning when we don't do that is wrong (PR28815) but for now at least do it this way to avoid the warning. * Instead of performing template specializations in LLVM_INSTANTIATE_REGISTRY instead provide a template definition then do explicit instantiation. No compiler I've tried has problems with doing it the other way, but strictly speaking it's not permitted by the C++ standard so better safe than sorry. Original commit message: Currently the Registry class contains the vestiges of a previous attempt to allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a plugin would have its own copy of a registry and export it to be imported by the tool that's loading the plugin. This only works if the plugin is entirely self-contained with the only interface between the plugin and tool being the registry, and in particular this conflicts with how IR pass plugins work. This patch changes things so that instead the add_node function of the registry is exported by the tool and then imported by the plugin, which solves this problem and also means that instead of every plugin having to export every registry they use instead LLVM only has to export the add_node functions. This allows plugins that use a registry to work on Windows if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used. llvm-svn: 277806
2016-07-28Revert r276973 "Adjust Registry interface to not require plugins to export a ↵John Brawn2-2/+2
registry" Buildbot failures when building with clang -Werror. Reverting while I try to figure this out. llvm-svn: 277008
2016-07-28Reapply r276856 "Adjust Registry interface to not require plugins to export ↵John Brawn2-2/+2
a registry" This version has two fixes compared to the original: * In Registry.h the template static members are instantiated before they are used, as clang gives an error if you do it the other way around. * The use of the Registry template in clang-tidy is updated in the same way as has been done everywhere else. Original commit message: Currently the Registry class contains the vestiges of a previous attempt to allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a plugin would have its own copy of a registry and export it to be imported by the tool that's loading the plugin. This only works if the plugin is entirely self-contained with the only interface between the plugin and tool being the registry, and in particular this conflicts with how IR pass plugins work. This patch changes things so that instead the add_node function of the registry is exported by the tool and then imported by the plugin, which solves this problem and also means that instead of every plugin having to export every registry they use instead LLVM only has to export the add_node functions. This allows plugins that use a registry to work on Windows if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used. llvm-svn: 276973
2016-07-27Revert r276856 "Adjust Registry interface to not require plugins to export a ↵John Brawn2-2/+2
registry" This is causing a huge pile of buildbot failures. llvm-svn: 276857
2016-07-27Adjust Registry interface to not require plugins to export a registryJohn Brawn2-2/+2
Currently the Registry class contains the vestiges of a previous attempt to allow plugins to be used on Windows without using BUILD_SHARED_LIBS, where a plugin would have its own copy of a registry and export it to be imported by the tool that's loading the plugin. This only works if the plugin is entirely self-contained with the only interface between the plugin and tool being the registry, and in particular this conflicts with how IR pass plugins work. This patch changes things so that instead the add_node function of the registry is exported by the tool and then imported by the plugin, which solves this problem and also means that instead of every plugin having to export every registry they use instead LLVM only has to export the add_node functions. This allows plugins that use a registry to work on Windows if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is used. Differential Revision: http://reviews.llvm.org/D21385 llvm-svn: 276856
2016-07-08Explicitly export symbols from the sample analyzer pluginJohn Brawn2-1/+4
This is done so that it will work when built using MSVC if LLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON. Differential Revision: http://reviews.llvm.org/D21971 llvm-svn: 274871
2016-06-09[CMake] Cleaning up CMake feature gating on 2.8.12Chris Bieneman3-3/+3
CMake 2.8.12 introduced interface libraries and some related policies. This removes the conditional block because we're now past 2.8.12. llvm-svn: 272312
2016-04-04AnnotateFunctions: Tweak for mingw.NAKAMURA Takumi1-0/+2
- Externalize the registry. - Update libdeps. llvm-svn: 265301
2016-04-04Add a PragmaHandler Registry for plugins to add PragmaHandlers toJohn Brawn1-1/+37
This allows plugins which add AST passes to also define pragmas to do things like only enable certain behaviour of the AST pass in files where a certain pragma is used. Differential Revision: http://reviews.llvm.org/D18319 llvm-svn: 265295
2016-03-15Make it possible for AST plugins to enable themselves by defaultJohn Brawn3-0/+62
Currently when an AST plugin is loaded it must then be enabled by passing -plugin pluginname or -add-plugin pluginname to the -cc1 command line. This patch adds a method to PluginASTAction which allows it to declare that the action happens before, instead of, or after the main AST action, plus the relevant changes to make the plugin action happen at that time automatically. Differential Revision: http://reviews.llvm.org/D17959 llvm-svn: 263546
2016-02-11Revert r260265, "clang-cl: Support loading plugins on Windows"NAKAMURA Takumi1-1/+0
It causes memory exhaust on mingw-w64(x64). Investigating. llvm-svn: 260536
2016-02-09clang-cl: Support loading plugins on WindowsEhsan Akhgari1-0/+1
This builds on the support being added to LLVM to import and export registries from DLLs. This will allow us to pick up the registry entries added in the DLL's copy of FrontendPluginRegistry. This will allow us to use plugins on Windows using: $ clang-cl -Xclang -load -Xclang plugin.dll \ -Xclang -add-plugin -Xclang foo llvm-svn: 260265
2016-01-26Remove autoconf supportChris Bieneman4-90/+0
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
2015-09-16analyzer-plugin/MainCallChecker.cpp: s/generateSink/generateErrorNode/, ↵NAKAMURA Takumi1-1/+1
corresponding to r247859. llvm-svn: 247862
2015-06-23Fixing a build bot break from r240400.Aaron Ballman1-2/+3
llvm-svn: 240401
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-1/+1
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-1/+1
The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
2015-05-17Don't leak TemplateIds when a plugin parses late-parsed templates at TU end.Nico Weber1-2/+53
In -fdelayed-template-parsing mode, templates that aren't used are not parsed at all. For some diagnostic plugins, this is a problem since they want to analyse the contents of the template function body. What has been suggested on cfe-dev [1] is to explicitly parse interesting templates in HandleTranslationUnit(); IWYU does this for example [2]. This is workable, but since the delayed parsing doesn't run below a call to ParseTopLevelDecl(), no DestroyTemplateIdAnnotationsRAIIObj object is on the stack to clean up TemplateIds that are created during parsing. To fix this, let ~Parser() clean them up in delayed template parsing mode instead of leaking (or asserting in +Assert builds). (r219810, relanded in r220400, fixed the same problem in incremental processing mode; the review thread of r219810 has a good discussion of the problem.) To test this, give the PrintFunctionNames plugin a flag to force parsing of a template and add a test that uses it in -fdelayed-template-parsing mode. Without the Parser.cpp change, that test asserts. 1: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-August/038415.html 2: https://code.google.com/p/include-what-you-use/source/detail?r=566 llvm-svn: 237531
2015-04-11Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko1-3/+3
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 Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
2015-01-23Replace size() calls on containers with empty() calls where appropriate. NFCAlexander Kornienko1-1/+1
http://reviews.llvm.org/D7090 Patch by Gábor Horváth! llvm-svn: 226914
2014-10-03Driver: Update clang-interpreter example for r218938Justin Bogner1-2/+2
llvm-svn: 218942
2014-09-04unique_ptrify JobList::JobsDavid Blaikie1-4/+4
llvm-svn: 217168
2014-09-03Fix configure and make build of clang-interpreter.Iain Sandoe1-2/+4
Replaced 'jit' link component with 'mcjit'. Updated the required libraries. llvm-svn: 217033
2014-09-02Reinstate "Update for llvm API change.""Eric Christopher1-1/+0
This reinstates r215113. llvm-svn: 216986
2014-08-19Go back to having a takeModule instead of a getModule.Rafael Espindola1-1/+1
Returning a std::unique_ptr is more constrained. Thanks to David Blaikie for the suggestion. llvm-svn: 215979
2014-08-19Update for llvm api change.Rafael Espindola1-13/+15
llvm-svn: 215968
2014-08-10Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)David Blaikie1-2/+3
After post-commit review and community discussion, this seems like a reasonable direction to continue, making ownership semantics explicit in the source using the type system. llvm-svn: 215323
2014-08-07Temporarily Revert "Update for llvm API change."Eric Christopher1-0/+1
This reverts commit 215113 to match the reversion in llvm. llvm-svn: 215156
2014-08-07Update for llvm API change.Rafael Espindola1-1/+0
llvm-svn: 215113
2014-07-24Use ELF in the clang-interpreter on windows.Rafael Espindola1-1/+8
We don't support loading COFF files yet. llvm-svn: 213893
2014-07-24Attempt at fixing the windows shared build.Rafael Espindola1-0/+1
llvm-svn: 213881
2014-07-24Use MCJIT.Rafael Espindola2-2/+5
llvm-svn: 213879
2014-07-24Remove the last use of llvm::ExecutionEngine::create.Rafael Espindola1-2/+9
llvm-svn: 213869
2014-07-17Revert "unique_ptr-ify ownership of ASTConsumers"David Blaikie1-3/+2
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-17unique_ptr-ify ownership of ASTConsumersDavid Blaikie1-2/+3
(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-16Make clang's rewrite engine a core featureAlp Toker1-1/+1
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-15Prune Redundant libdeps in CMake's target_link_libraries and LLVMBuild.txt.NAKAMURA Takumi1-1/+0
I checked this with Release+Asserts on x86_64-mingw32. Please restore partially if this were overkill. llvm-svn: 213064
2014-07-13[CMake] Give explicit dependencies to a couple of modules, ↵NAKAMURA Takumi2-0/+18
PrintFunctionNames and SampleAnalyzerPlugin, for Win32.DLL. llvm-svn: 212906
2014-07-13PrintFunctionNames/CMakeLists.txt: Fix a comment.NAKAMURA Takumi1-1/+1
llvm-svn: 212905
2014-07-11Instantiate llvm::Registry<clang::PluginASTAction> in FrontendAction.cpp.NAKAMURA Takumi1-1/+0
- 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-09clang-interpreter: don't check input file existence, we're in-processAlp Toker1-0/+1
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-01clang-interpreter: use LLVM interpreter if JIT is unavailableAlp Toker3-5/+6
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-01clang-interpreter: interpret instead of JITingAlp Toker3-6/+6
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-05-15Eliminate DefaultImageName from the Driver constructorAlp Toker1-1/+1
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-03-09Fix build break, replace take() with release().Ahmed Charles1-1/+1
llvm-svn: 203390