summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a new matcher to match character types.Gabor Horvath2015-12-151-0/+8
| | | | llvm-svn: 255627
* Add a narrowing AST matcher that matches on a FunctionDecl with a ↵Aaron Ballman2015-12-021-0/+9
| | | | | | non-throwing exception specification. llvm-svn: 254516
* Traverse the NestedNameSpecifier(Loc) of NamespaceAliasDecls.Daniel Jasper2015-12-021-0/+2
| | | | | Review: http://reviews.llvm.org/D15149 llvm-svn: 254510
* Add an AST matcher for narrowing when a type is volatile-qualified.Aaron Ballman2015-11-231-0/+9
| | | | llvm-svn: 253882
* Removing the AST matcher test for thread_local storage duration. Not all ↵Aaron Ballman2015-11-181-5/+5
| | | | | | platforms support TLS, and on platforms that do not support it, use of thread_local causes an error. Since there's no way to determine whether the testing platform supports TLS, there's no way to know whether the test is safe to run or not. I will explore ways to enable this test, but this will appease at least one more build bot. llvm-svn: 253486
* Re-committing r253473 after hopefully fixing the bot breakage. There was a ↵Aaron Ballman2015-11-181-0/+23
| | | | | | copy-pasta issue that my local testing did not catch. llvm-svn: 253481
* Reverting r253473 while I investigate build bot failures.Aaron Ballman2015-11-181-23/+0
| | | | llvm-svn: 253475
* Adding AST matchers for VarDecl storage durations. Can now determine whether ↵Aaron Ballman2015-11-181-0/+23
| | | | | | a VarDecl has automatic, static, or thread storage duration. This also updates the documentation for matchers, which appear to be missing some previous additions. llvm-svn: 253473
* [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
* Make hasLHS and hasRHS matchers available for ArraySubscriptExprAlexander Kornienko2015-11-021-0/+5
| | | | | | | | | | | | | | Summary: The hasBase and hasIndex don't tell anything about the position of the base and the index in the code, so we need hasLHS and hasRHS in some cases. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D14212 llvm-svn: 251842
* Add "equalsNode" for types and "isCopyAssignmentOperator" matchers.Angel Garcia Gomez2015-10-301-0/+29
| | | | | | | | | | | | Summary: This matchers are going to be used in modernize-use-default, but are generic enough to be placed in ASTMatchers.h. Reviewers: klimek Subscribers: alexfh, cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D14152 llvm-svn: 251693
* [AST] Re-add TypeLocs and NestedNameSpecifierLocs to the ParentMap.Benjamin Kramer2015-10-232-4/+10
| | | | | | | | | | | | | | | | | | | | This relands r250831 after some fixes to shrink the ParentMap overall with one addtional tweak: nodes with pointer identity (e.g. Decl* and friends) can be store more efficiently so I put them in a separate map. All other nodes (so far only TypeLoc and NNSLoc) go in a different map keyed on DynTypedNode. This further uglifies the code but significantly reduces memory overhead. Overall this change still make ParentMap significantly larger but it's nowhere as bad as before. I see about 25 MB over baseline (pre-r251008) on X86ISelLowering.cpp. If this becomes an issue we could consider splitting the maps further as DynTypedNode is still larger (32 bytes) than a single TypeLoc (16 bytes) but I didn't want to introduce even more complexity now. Differential Revision: http://reviews.llvm.org/D14011 llvm-svn: 251101
* Shrink DynTypedNode by one pointer from 40 to 32 bytes (on x86_64).Benjamin Kramer2015-10-211-2/+2
| | | | | | | | | | | | | | | | | | The MemoizationData cache was introduced to avoid a series of enum compares at the cost of making DynTypedNode bigger. This change reverts to using an enum compare but instead of building a chain of comparison the enum values are reordered so the check can be performed with a simple greater than. The alternative would be to steal a bit from the enum but I think that's a more complex solution and not really needed here. I tried this on several large .cpp files with clang-tidy and didn't notice any performance difference. The test change is due to matchers being sorted by their node kind. Differential Revision: http://reviews.llvm.org/D13946 llvm-svn: 250905
* Revert "[AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap."Benjamin Kramer2015-10-212-10/+5
| | | | | | | | | | | | Putting DynTypedNode in the ParentMap bloats its memory foot print. Before the void* key had 8 bytes, now we're at 40 bytes per key which can mean multiple gigabytes increase for large ASTs and this count doesn't even include all the added TypeLoc nodes. Revert until I come up with a better data structure. This reverts commit r250831. llvm-svn: 250889
* [AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap.Benjamin Kramer2015-10-202-5/+10
| | | | | | | | | | | | | | | | Firstly this changes the type of parent map to be keyed on DynTypedNode to simplify the following changes. This comes with a DenseMapInfo for DynTypedNode, which is a bit incomplete still and will probably only work for parentmap right now. Then the RecursiveASTVisitor in ASTContext is updated and finally ASTMatchers hasParent and hasAncestor learn about the new functionality. Now ParentMap is only missing TemplateArgumentLocs and CXXCtorInitializers. Differential Revision: http://reviews.llvm.org/D13897 llvm-svn: 250831
* Roll-back r250822.Angel Garcia Gomez2015-10-202-2/+2
| | | | | | | | | | 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-202-2/+2
| | | | | | | | | | | | 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
* Add an AST node matcher for TemplateTypeParmDecl objects.Eric Fiselier2015-10-171-0/+7
| | | | llvm-svn: 250602
* Add decayedType and hasDecayedType AST matchersMatthias Gehre2015-10-121-0/+5
| | | | | | | | | | | | Summary: Add decayedType and hasDecayedType AST matchers Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13639 llvm-svn: 250114
* Adding an AST node matcher for NonTypeTemplateParmDecl objects.Aaron Ballman2015-10-051-0/+7
| | | | llvm-svn: 249341
* Adding a narrowing AST matcher for FunctionDecl::isVariadic(), plus tests ↵Aaron Ballman2015-10-052-0/+14
| | | | | | and documentation. llvm-svn: 249321
* Pass SourceRange by value in a test I missed in r249259.Craig Topper2015-10-041-2/+2
| | | | llvm-svn: 249260
* Rename AST node matchers to match the AST node names directly. Part of this ↵Aaron Ballman2015-09-173-269/+278
| | | | | | rename also splits recordDecl() (which used to match CXXRecordDecl) into recordDecl() (that matches RecordDecl) and cxxRecordDecl (that matches CXXRecordDecl). Also adds isStruct(), isUnion(), and isClass() narrowing matchers for RecordDecl objects. llvm-svn: 247885
* Fixed HasDeclarationMatcher to properly convert all types into decls where ↵Aaron Ballman2015-09-111-0/+48
| | | | | | | | | | | | | | possible. Added objcObjectPointerType(), objcInterfaceDecl(), templateTypeParmType(), injectedClassNameType(), and unresolvedUsingTypenameDecl(). Updated documentation for pointerType() to call out that it does not match ObjCObjectPointerType types. Changed pointsTo() to handle ObjCObjectPointerType as well as PointerType. While this may seem like a lot of unrelated changes, they all relate back to fixing HasDeclarationMatcher. This now allows us to write a matcher like: varDecl(hasType(namedDecl(hasName("Foo")))) that matches code using typedefs, objc interfaces, template type parameters, injected class names, or unresolved using typenames. llvm-svn: 247404
* Fix documentation of numSelectorArgs.Manuel Klimek2015-09-081-0/+3
| | | | | | | | | | | | Currently, the documentation for numSelectorArgs includes an incorrect example. It shows a case where an argument of 1 will match a property getter, but a getter will be matched only when N == 0. This diff corrects the documentation and adds a test for numSelectorArgs(0). Patch by Dave Lee. llvm-svn: 246998
* Fixing a bug where hasType(decl()) would fail to match on C code involving ↵Aaron Ballman2015-09-042-0/+9
| | | | | | structs or unions. llvm-svn: 246860
* Adding an AST matcher for namespaceAliasDecl.Aaron Ballman2015-08-281-0/+5
| | | | llvm-svn: 246322
* [ASTMatchers] Add type matcher for SubstTemplateTypeParmType.Samuel Benzaquen2015-08-261-0/+12
| | | | llvm-svn: 246037
* Add AST narrowing matchers for inline and anonymous namespaces. Since the ↵Aaron Ballman2015-08-181-0/+12
| | | | | | inline keyword can also be specified on a FunctionDecl, this is a polymorphic matcher. llvm-svn: 245337
* Add a polymorphic AST matcher for testing whether a constructor or a ↵Aaron Ballman2015-08-111-0/+14
| | | | | | conversion declaration is marked as explicit or not. llvm-svn: 244666
* Add an AST matcher to match member intializers of a CXXCtorInitializer.Aaron Ballman2015-08-111-0/+6
| | | | llvm-svn: 244662
* Add AST matchers for narrowing constructors that are default, copy, or move ↵Aaron Ballman2015-08-051-0/+41
| | | | | | constructors, as well as functionality to determine whether a ctor initializer is a base initializer. llvm-svn: 244036
* Add an AST matcher, isFinal(), for testing whether a method or class ↵Aaron Ballman2015-07-241-0/+9
| | | | | | declaration are marked final. llvm-svn: 243107
* [ASTMatchers] Use provided target NodeKind instead of inferring it from the ↵Samuel Benzaquen2015-07-171-0/+10
| | | | | | | | | | matchers. Individual matchers might not be convertible to each other's kind, but they might still all be convertible to the target kind. All the callers already know the target kind, so just pass it down. llvm-svn: 242534
* 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
* Add the ability to AST match a variable declaration that is an exception ↵Aaron Ballman2015-07-151-0/+4
| | | | | | variable. llvm-svn: 242303
* [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
* Fix clang/unittests/ASTMatchers/Dynamic/Makefile. clangDynamicASTMatchers ↵NAKAMURA Takumi2015-07-131-1/+3
| | | | | | should be linked in advance of clangAST and clangASTMatchers. llvm-svn: 242005
* Replace some const std::string & with llvm::StringRef or std::stringYaron Keren2015-07-063-26/+26
| | | | | | | | and std::move to avoid implicit std::string construction. Patch by Eugene Kosov. llvm-svn: 241433
* When testing for anyOf(), the test should not be for an exact type match for ↵Aaron Ballman2015-07-021-0/+4
| | | | | | all members of the set. Instead, test that all members are convertible to the common type. llvm-svn: 241263
* Implement an AST matcher for C++ exception catch handlers that can catch any ↵Aaron Ballman2015-07-021-0/+4
| | | | | | exception type (...). llvm-svn: 241256
* 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
* Adding new AST matcher: isConstexprSzabolcs Sipos2015-05-221-0/+7
| | | | | | It matches constexpr variable and function declarations. llvm-svn: 238016
* Adding new AST matcher: gnuNullExprSzabolcs Sipos2015-05-071-0/+4
| | | | | | It matches GNU __null expression. llvm-svn: 236731
* Add conversionDecl matcher for node CXXConversionDecl.Samuel Benzaquen2015-04-201-0/+6
| | | | llvm-svn: 235348
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-112-18/+15
| | | | | | | | | | | | | | | | | | | | 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
* Remove redundant virtual on member functions marked 'override'.David Blaikie2015-04-081-1/+1
| | | | llvm-svn: 234417
* [CMake] Add clangBasic in ASTMatchersTests, according to r232051.NAKAMURA Takumi2015-03-121-0/+1
| | | | | | Jan Vesely noticed it. See also r232055. llvm-svn: 232123
OpenPOWER on IntegriCloud