Commit Graph

21 Commits

Author SHA1 Message Date
George Karpenkov 88a16a0790 [ASTMatchers] Introduce a matcher for matching any given Objective-C selector
Incudes a tiny related refactoring.

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

llvm-svn: 328747
2018-03-29 00:51:12 +00:00
Dave Lee 0934fdc3a5 Add ObjC exception statement AST matchers
Summary: Add AST matchers for Objective-C @throw, @try, @catch and @finally.

Reviewers: aaron.ballman, malcolm.parsons, alexshap, compnerd

Reviewed By: aaron.ballman

Subscribers: cfe-commits, klimek

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

llvm-svn: 317992
2017-11-11 22:46:15 +00:00
Dave Lee 55540a0ce7 Add objcCategoryImplDecl matcher
Summary:
Add `objcCategoryImplDecl` which matches ObjC category definitions
(`@implementation`). This matcher complements `objcCategoryDecl` (`@interface`)
which was added in D30854.

Reviewers: aaron.ballman, malcolm.parsons, alexshap

Reviewed By: aaron.ballman

Subscribers: klimek, cfe-commits

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

llvm-svn: 316670
2017-10-26 15:53:37 +00:00
Dave Lee e6d362cea8 Add objcImplementationDecl matcher
Summary:
Add the `objcImplementationDecl` matcher. See related: D30854

Tested with:

```
./tools/clang/unittests/ASTMatchers/ASTMatchersTests
```

Reviewers: aaron.ballman, compnerd, alexshap

Reviewed By: aaron.ballman

Subscribers: klimek, cfe-commits

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

llvm-svn: 312889
2017-09-10 21:00:15 +00:00
Florian Gross 4a72b4db55 [ASTMatcher] Add handling for DeducedType to HasDeclarationMatcher
HasDeclarationMatcher did not handle DeducedType, it always returned false for deduced types.

So with code like this:
struct X{};
auto x = X{};

This did no longer match:
varDecl(hasType(recordDecl(hasName("X"))))

Because HasDeclarationMatcher didn't resolve the DeducedType of x.

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

llvm-svn: 310095
2017-08-04 18:59:19 +00:00
Clement Courbet 43bdba4086 [ASTMatchers][NFC] integerLiteral(): Mention negative integers in
documentation.

Trying to match integerLiteral(-1) will silently fail, because an numeric
literal is always positive.
- Update the documentation to explain how to match negative numeric
  literals.
- Add a unit test.

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

llvm-svn: 307663
2017-07-11 15:45:22 +00:00
Jakub Kuderski 64b6c78e94 Add cxxStdInitializerListExpr AST matcher
Summary:
This adds a new ASTMatcher for CXXStdInitializerListExprs that matches C++ initializer list expressions.

The primary motivation is to use it to fix [[ https://bugs.llvm.org/show_bug.cgi?id=32896 | PR32896 ]] (review here [[ https://reviews.llvm.org/D32767 | D32767 ]]).

Reviewers: alexfh, Prazek, aaron.ballman

Reviewed By: alexfh, aaron.ballman

Subscribers: malcolm.parsons, cfe-commits, klimek

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

llvm-svn: 302287
2017-05-05 21:01:12 +00:00
Eric Liu 285f804282 [ASTMatchers] add typeAliasTemplateDecl matcher.
Reviewers: hokein, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: aaron.ballman, cfe-commits, klimek

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

llvm-svn: 298912
2017-03-28 12:56:47 +00:00
Aaron Ballman 9fd6ee6a78 Add AST matchers for ObjCProtocolDecl, ObjCCategoryDecl, ObjCMethodDecl, ObjCIvarDecl, and ObjCPropertyDecl.
Patch by Dave Lee.

llvm-svn: 297882
2017-03-15 20:14:25 +00:00
Richard Smith 4baaa5ab52 DR616, and part of P0135R1: member access (or pointer-to-member access) on a
temporary produces an xvalue, not a prvalue. Support this by materializing the
temporary prior to performing the member access.

llvm-svn: 288563
2016-12-03 01:14:32 +00:00
Aaron Ballman 5fa302cb65 Complete support for the cxxCtorInitializer() AST matcher so that it can be used as a top-level matcher.
llvm-svn: 282417
2016-09-26 17:04:27 +00:00
Justin Lebar fb2efeb804 Fix ASTMatchersNodeTest to work on Windows.
It was failing because it had an explicit check for whether we're on
Windows.

There are a few other similar explicit checks in this file which I
didn't remove because they serve as reasonable documentation that the
test doesn't work with a Windows triple.

llvm-svn: 274269
2016-06-30 20:29:29 +00:00
Haojian Wu e775de8171 [ASTMatcher] Add a node matcher for EnumType.
Reviewers: aaron.ballman

Subscribers: cfe-commits, klimek

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

llvm-svn: 274217
2016-06-30 07:50:01 +00:00
Tim Shen 4a05bb8d8d Re-commit "[Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr."
Since D21243 fixes relative clang-tidy tests.

This reverts commit a71d9fbd41e99def9159af2b01ef6509394eaeed.

llvm-svn: 273312
2016-06-21 20:29:17 +00:00
Tim Shen 17b3deeff3 Revert "[Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr."
This reverts r272296, since there are clang-tidy failures that appear to
be caused by this change.

llvm-svn: 272310
2016-06-09 21:13:39 +00:00
Tim Shen f120a7b6a3 [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr.
These ExprWithCleanups are added for holding a RunCleanupsScope not
for destructor calls; rather, they are for lifetime marks. This requires
ExprWithCleanups to keep a bit to indicate whether it have cleanups with
side effects (e.g. dtor calls).

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

llvm-svn: 272296
2016-06-09 19:54:46 +00:00
Aaron Ballman ba8dbbe86f Adding an AST matcher to ignore parenthesis in *types* (rather than expressions). This is required for traversing certain types (like function pointer types).
llvm-svn: 271927
2016-06-06 18:52:17 +00:00
Haojian Wu 40b1277135 [ASTMacther] A follow-up on unresolvedLookupExpr test fixing.
llvm-svn: 269957
2016-05-18 16:48:44 +00:00
Haojian Wu da5b1131de [ASTMatcher] Fix a ASTMatcher test failure on Windows.
Reviewers: alexfh, aaron.ballman

Subscribers: thakis, cfe-commits, klimek

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

llvm-svn: 269936
2016-05-18 15:15:12 +00:00
Haojian Wu 7751c92582 [ASTMatcher] Add a node matcher for UnresolvedLookupExpr.
Reviewers: alexfh, aaron.ballman

Subscribers: aaron.ballman, klimek, cfe-commits

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

llvm-svn: 269916
2016-05-18 12:53:59 +00:00
Piotr Padlewski c6e0502997 Dividied ASTMatcherTests into 4 files
fix for long compilation [20061]
http://reviews.llvm.org/D20210

llvm-svn: 269802
2016-05-17 19:22:57 +00:00