summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/ASTMatchersTest.h
Commit message (Collapse)AuthorAgeFilesLines
* Added AST matcher for ignoring elidable constructorsDmitri Gribenko2019-06-131-5/+73
| | | | | | | | | | | | | | | | | | Summary: Added AST matcher for ignoring elidable move constructors Reviewers: hokein, gribozavr Reviewed By: hokein, gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63149 Patch by Johan Vikström. llvm-svn: 363262
* [clang][OpenMP] Fix another test when using libgomp.Jordan Rupprecht2019-03-211-2/+2
| | | | | | Similarly to r356614, -fopenmp=libomp needs to be used for some omp-related AST matching. llvm-svn: 356700
* [ASTMatchers][OpenMP] Add base ompExecutableDirective() matcher.Roman Lebedev2019-03-211-0/+12
| | | | | | | | | | | | | | | | | | Summary: A simple matcher for `OMPExecutableDirective` Stmt type. Split off from D57113. Reviewers: gribozavr, aaron.ballman, JonasToth, george.karpenkov Reviewed By: gribozavr, aaron.ballman Subscribers: guansong, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59453 llvm-svn: 356674
* [CUDA] add support for the new kernel launch API in CUDA-9.2+.Artem Belevich2019-01-311-1/+3
| | | | | | | | | | | | | Instead of calling CUDA runtime to arrange function arguments, the new API constructs arguments in a local array and the kernels are launched with __cudaLaunchKernel(). The old API has been deprecated and is expected to go away in the next CUDA release. Differential Revision: https://reviews.llvm.org/D57488 llvm-svn: 352799
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [ASTMatchers] Introduce a blockDecl matcher for matching block declarationsGeorge Karpenkov2018-05-161-1/+1
| | | | | | | | Blocks can be matched just as well as functions or Objective-C methods. Differential Revision: https://reviews.llvm.org/D46980 llvm-svn: 332545
* Added braces to work around gcc warning in googletest: suggest explicit ↵Galina Kistanova2017-06-151-3/+6
| | | | | | braces to avoid ambiguous 'else'. NFC. llvm-svn: 305507
* Add AST matchers for ObjCProtocolDecl, ObjCCategoryDecl, ObjCMethodDecl, ↵Aaron Ballman2017-03-151-12/+23
| | | | | | | | ObjCIvarDecl, and ObjCPropertyDecl. Patch by Dave Lee. llvm-svn: 297882
* [CUDA] Do not allow using NVPTX target for host compilation.Artem Belevich2016-08-021-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D23042 llvm-svn: 277537
* Don't instantiate a full host toolchain in ASTMatchersTest.Justin Lebar2016-06-301-15/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This test was stat()'ing large swaths of /usr/lib hundreds of times, as every invocation of matchesConditionally*() created a new Linux toolchain. In addition to being slow, perf indicated this was causing substantial contention in the kernel. Something is...interesting in the kernel, as without this patch I sometimes see ~11m spent in the kernel, and sometimes ~5m. This corresponds to bimodal ninja check-clang times of ~30s and ~20s. It's not clear to me exactly what causes the bimodality. In any case, this change makes this test run in 2.5s, down from 17s, and it seems to cause us to get the 20s ninja check-clang time unconditionally. Reviewers: chandlerc Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D21810 llvm-svn: 274257
* Dividied ASTMatcherTests into 4 filesPiotr Padlewski2016-05-171-2/+74
| | | | | | | fix for long compilation [20061] http://reviews.llvm.org/D20210 llvm-svn: 269802
* Clarify memory ownership semantics; NFC.Aaron Ballman2016-04-211-10/+9
| | | | | | Patch by Clement Courbet llvm-svn: 266986
* Adding new AST matchers for: addrLabelExpr, atomicExpr, ↵Aaron Ballman2016-03-091-0/+7
| | | | | | | | binaryConditionalOperator, designatedInitExpr, designatorCountIs, hasSyntacticForm, implicitValueInitExpr, labelDecl, opaqueValueExpr, parenListExpr, predefinedExpr, requiresZeroInitialization, and stmtExpr. Patch by Aleksei Sidorin. llvm-svn: 263027
* Add an optional ToolName argument to ↵Benjamin Kramer2016-01-291-3/+3
| | | | | | | | | | runToolOnCodeWithArgs/buildASTFromCodeWithArgs. This can be used as a way to modify argv[0] for a clang tool. Differential Revision: http://reviews.llvm.org/D16718 llvm-svn: 259187
* [CUDA] Make CUDA compilation usable by default.Artem Belevich2015-11-171-0/+1
| | | | | | | | | | | | | | | | | | Currently clang requires several additional command line options in order to enable new features needed during CUDA compilation. This patch makes these options default. * Automatically include cuda_runtime.h if we've found a valid CUDA installation. * Disable automatic CUDA header inclusion during unit tests. * Added test case for command line construction. * Enabled target overloads and relaxed call checks that are needed in order to include CUDA headers. * Added CUDA-7.5 installation path to the CUDA installation search list. * Define __CUDA__ macro to indicate CUDA compilation. llvm-svn: 253389
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* Adding a narrowing AST matcher for FunctionDecl::isVariadic(), plus tests ↵Aaron Ballman2015-10-051-0/+7
| | | | | | and documentation. llvm-svn: 249321
* Fixing a bug where hasType(decl()) would fail to match on C code involving ↵Aaron Ballman2015-09-041-0/+6
| | | | | | structs or unions. llvm-svn: 246860
* Make the clang module container format selectable from the command line.Adrian Prantl2015-07-171-1/+1
| | | | | | | | | | | | | - introduces a new cc1 option -fmodule-format=[raw,obj] with 'raw' being the default - supports arbitrary module container formats that libclang is agnostic to - adds the format to the module hash to avoid collisions - splits the old PCHContainerOperations into PCHContainerWriter and a PCHContainerReader. Thanks to Richard Smith for reviewing this patch! llvm-svn: 242499
* [cuda] Driver changes to compile and stitch together host and device-side ↵Artem Belevich2015-07-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | CUDA code. NOTE: reverts r242077 to reinstate r242058, r242065, 242067 and includes fix for OS X test failures. - Changed driver pipeline to compile host and device side of CUDA files and incorporate results of device-side compilation into host object file. - Added a test for cuda pipeline creation in clang driver. New clang options: --cuda-host-only - Do host-side compilation only. --cuda-device-only - Do device-side compilation only. --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more than once in which case one device-compilation will be done per unique specified GPU architecture. Differential Revision: http://reviews.llvm.org/D9509 llvm-svn: 242085
* This reverts commit r242058, r242065, r242067.Rafael Espindola2015-07-131-1/+0
| | | | | | | | | | The tests were failing on OS X. Revert "[cuda] Driver changes to compile and stitch together host and device-side CUDA code." Revert "Fixed regex to properly match '64' in the test case." Revert "clang/test/Driver/cuda-options.cu REQUIRES clang-driver, at least." llvm-svn: 242077
* [cuda] Driver changes to compile and stitch together host and device-side ↵Artem Belevich2015-07-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | CUDA code. - Changed driver pipeline to compile host and device side of CUDA files and incorporate results of device-side compilation into host object file. - Added a test for cuda pipeline creation in clang driver. New clang options: --cuda-host-only - Do host-side compilation only. --cuda-device-only - Do device-side compilation only. --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more than once in which case one device-compilation will be done per unique specified GPU architecture. Differential Revision: http://reviews.llvm.org/D9509 llvm-svn: 242058
* Introduce a PCHContainerOperations interface (NFC).Adrian Prantl2015-06-201-0/+1
| | | | | | | | | | | | | | | | A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
* Remove redundant virtual on member functions marked 'override'.David Blaikie2015-04-081-1/+1
| | | | llvm-svn: 234417
* Add support for a few Objective-C matchers.Manuel Klimek2015-03-121-2/+20
| | | | | | | | | | | Add some matchers for Objective-C selectors and messages to ASTMatchers.h. Minor mods to ASTMatchersTest.h to allow test files with ".m" extension in addition to ".cpp". New tests added to ASTMatchersTest.c. Patch by Dean Sutherland. llvm-svn: 232051
* Reverting r232034, as it broke one of the bots with link errors. Details at: ↵Aaron Ballman2015-03-121-20/+2
| | | | | | http://bb.pgr.jp/builders/ninja-clang-x64-mingw64-RA/builds/6352/steps/build/logs/stdio llvm-svn: 232038
* Added some matchers for objective c selectors and messages to ASTMatchers.h. ↵Aaron Ballman2015-03-121-2/+20
| | | | | | | | Minor mods to ASTMatchersTest.h to allow test files with ".m" extension in addition to ".cpp". New tests added to ASTMatchersTest.c. Patch by Dean Sutherland, reviewed by Manuel Klimek. From http://reviews.llvm.org/D7710 llvm-svn: 232034
* Add -frtti and -fexceptions to tests that assume these are on.Filipe Cabecinhas2015-03-021-1/+5
| | | | | | | | | | | | | | | Summary: We now have targets that don't enable rtti/exceptions by default, and the ASTMatchers tests are assuming that these features are on (e.g: They use dynamic_cast or try). Reviewers: klimek, thakis, djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D7892 llvm-svn: 230984
* Re-apply r222646 (was reverted in r222667). Adding 4 ASTMatchers: ↵Manuel Klimek2014-11-251-5/+7
| | | | | | | | | | | | | | | | | | | | | | | typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName Change to original: ifndef out tests in Windows due to /-separated paths. Summary: Often one is only interested in matches within the main-file or matches that are not within a system-header, for which this patch adds isInMainFile and isInSystemFile. They take no arguments and narrow down the matches. The isInFileMatchingName is mainly thought for interactive clang-query-sessions, to make a matcher more specific without restarting the session with the files you are interested in for that moment. It takes a string that will be used as regular-expression to match the filename of where the matched node is expanded. Patch by Hendrik von Prince. llvm-svn: 222765
* Reverting r222646; the tests do not pass on Windows. Also reverts r222664, ↵Aaron Ballman2014-11-241-7/+5
| | | | | | which was required for r222646 to compile with Visual Studio 2012. llvm-svn: 222667
* Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, ↵Manuel Klimek2014-11-241-5/+7
| | | | | | | | | | | | | | | | | | | | isInFileMatchingName Summary: Often one is only interested in matches within the main-file or matches that are not within a system-header, for which this patch adds isInMainFile and isInSystemFile. They take no arguments and narrow down the matches. The isInFileMatchingName is mainly thought for interactive clang-query-sessions, to make a matcher more specific without restarting the session with the files you are interested in for that moment. It takes a string that will be used as regular-expression to match the filename of where the matched node is expanded. Patch by Hendrik von Prince. llvm-svn: 222646
* Adds 'override' to overriding methods. NFC.Fariborz Jahanian2014-10-011-1/+1
| | | | | | These were uncoveredby my yet undelivered patch. llvm-svn: 218774
* Header guard canonicalization, clang part.Benjamin Kramer2014-08-131-2/+2
| | | | | | Modifications made by clang-tidy with minor tweaks. llvm-svn: 215557
* ASTMatchersTests/matchesConditionallyWithCuda: Add -fno-ms-extensions, and ↵NAKAMURA Takumi2014-08-051-1/+4
| | | | | | | | get rid of initializer list. I am not sure whether -xcuda might imply -fno-ms-extensions. llvm-svn: 214876
* Adds AST matchers for matching CUDA declarations.Manuel Klimek2014-08-051-0/+66
| | | | | | Patch by Jacques Pienaar. llvm-svn: 214852
* [C++11] Use 'nullptr'. Unittests edition.Craig Topper2014-06-081-3/+3
| | | | llvm-svn: 210423
* Fix 3 test-only leaks found by LSan.Nico Weber2014-04-241-4/+6
| | | | llvm-svn: 207068
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-4/+6
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper2014-03-021-1/+1
| | | | llvm-svn: 202625
* Introduce MatchFinder::matchAST.Peter Collingbourne2013-11-071-0/+17
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2115 llvm-svn: 194223
* Re-introduce MatchFinder::addDynamicMatcher.Peter Collingbourne2013-11-071-1/+15
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D2114 llvm-svn: 194222
* Enhancements for the DynTypedMatcher system.Samuel Benzaquen2013-06-201-35/+0
| | | | | | | | | - Added conversion routines and checks in Matcher<T> that take a DynTypedMatcher. - Added type information on the error messages for the marshallers. - Allows future work on Polymorphic/overloaded matchers. We should be able to disambiguate at runtime and choose the appropriate overload. llvm-svn: 184429
* First revision of the dynamic ASTMatcher library.Manuel Klimek2013-05-141-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | This library supports all the features of the compile-time based ASTMatcher library, but allows the user to specify and construct the matchers at runtime. It contains the following modules: - A variant type, to be used by the matcher factory. - A registry, where the matchers are indexed by name and have a factory method with a generic signature. - A simple matcher expression parser, that can be used to convert a matcher expression string into actual matchers that can be used with the AST at runtime. Many features where omitted from this first revision to simplify this code review. The main ideas are still represented in this change and it already has support working use cases. Things that are missing: - Support for polymorphic matchers. These requires supporting code in the registry, the marshallers and the variant type. - Support for numbers, char and bool arguments to the matchers. This requires supporting code in the parser and the variant type. - A command line program putting everything together and providing an already functional tool. Patch by Samuel Benzaquen. llvm-svn: 181768
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Fix binding of nodes in case of forEach..() matchers.Daniel Jasper2012-11-111-1/+1
| | | | | | | | | | When recursively visiting the generated matches, the aggregated bindings need to be copied during the recursion. Otherwise, we they might not be properly overwritten (which is shown by the test), or there might be bound nodes present that were bound on a different matching branch. Review: http://llvm-reviews.chandlerc.com/D112 llvm-svn: 167695
* Fix ASTMatchersTests to not create an overloaded-virtual warning.Daniel Jasper2012-10-291-4/+2
| | | | llvm-svn: 166921
* Adds the possibility to run ASTMatchFinder over arbitrary AST nodes.Manuel Klimek2012-10-241-2/+5
| | | | llvm-svn: 166567
* Add matchers for selected C++11 features.Daniel Jasper2012-10-011-4/+5
| | | | | | | Patch by Gábor Horváth. Review: http://llvm-reviews.chandlerc.com/D46 llvm-svn: 164943
* Reland r160052: Default to -std=c++11 on Windows.Nico Weber2012-08-301-3/+7
| | | | | | Also update the tests that rely on c++98 to explicitly mention that. llvm-svn: 162890
OpenPOWER on IntegriCloud