llvm/llvm-project

hasAnyArgument() spuriously ignores match

Open

#75,754 建立於 2023年12月17日

在 GitHub 查看
 (18 留言) (0 反應) (1 負責人)C++ (10,782 fork)batch import
clang-queryclang:frontendconfirmedgood first issue

倉庫指標

Star
 (26,378 star)
PR 合併指標
 (平均合併 1天 2小時) (30 天內合併 1,000 個 PR)

描述

hasAnyArgument() spuriously ignores a match with the program:

void foo (void *, void *);

struct S {
};

void f() {
   S s;
   foo(&s, &s);
}

and the query:

m callExpr(hasAnyArgument(hasType(asString("S *"))))
0 matches. 

However, the query:

m callExpr(hasArgument(0,hasType(asString("S *"))))

returns the expected result:

...clang_ast_bug_2.cpp:10:2: note: "root" binds here
 10 |         foo(&s, &s);
      |         ^~~~~~~~~~~
1 match.

I am using clang-query 17.0.2 built, I believe, by Mozilla.

貢獻者指南