[clang] Different info in docs in AST methods (PR #112190)
Mikhnenko Sasha via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 14 05:30:34 PDT 2024
https://github.com/4JustMe4 created https://github.com/llvm/llvm-project/pull/112190
[Here](https://github.com/llvm/llvm-project/blob/6a98c4a1602591c942f01dceb3aa29ffd4cf1e5b/clang/include/clang/ASTMatchers/ASTMatchers.h#L4188-L4203) and [here](https://github.com/llvm/llvm-project/blob/6a98c4a1602591c942f01dceb3aa29ffd4cf1e5b/clang/include/clang/ASTMatchers/ASTMatchers.h#L3679-L3695) we can see similar code samples and same examples:
```
cxxMemberCallExpr(on(callExpr()))
```
In the first case, it is [written](https://github.com/llvm/llvm-project/blob/6a98c4a1602591c942f01dceb3aa29ffd4cf1e5b/clang/include/clang/ASTMatchers/ASTMatchers.h#L4201) that the object must not be matched:
```
/// cxxMemberCallExpr(on(callExpr()))
/// does not match `(g()).m()`, because the parens are not ignored.
```
In the second case, it is [written](https://github.com/llvm/llvm-project/blob/6a98c4a1602591c942f01dceb3aa29ffd4cf1e5b/clang/include/clang/ASTMatchers/ASTMatchers.h#L3693) that the object must be matched:
```
/// cxxMemberCallExpr(on(callExpr()))
/// matches `(g()).m()`.
```
I think that parens are ignored
>From 4cd2e269cec8eb0c0bc31c10ecef4979645e32f1 Mon Sep 17 00:00:00 2001
From: mikhnenko <mikhnenko at yandex-team.com>
Date: Mon, 14 Oct 2024 15:29:16 +0300
Subject: [PATCH] Fix different info
---
clang/include/clang/ASTMatchers/ASTMatchers.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h
index f1c72efc238784..6c8d900927f2d4 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4199,7 +4199,7 @@ AST_MATCHER_P_OVERLOAD(QualType, references, internal::Matcher<Decl>,
/// cxxRecordDecl(hasName("Y")))))
/// matches `y.m()`, `x.m()` and (g()).m(), but not `x.g()`.
/// cxxMemberCallExpr(on(callExpr()))
-/// does not match `(g()).m()`, because the parens are not ignored.
+/// does match `(g()).m()`, because the parens are ignored.
///
/// FIXME: Overload to allow directly matching types?
AST_MATCHER_P(CXXMemberCallExpr, onImplicitObjectArgument,
More information about the cfe-commits
mailing list