gpt4 book ai didi

Clang AST 匹配器的 "AND"和 "OR"

转载 作者:行者123 更新时间:2023-12-01 09:47:44 35 4
gpt4 key购买 nike

是否可以使用 or在函数声明中?喜欢:

functionDecl(hasName("a") or hasName("b"))
或者我们必须使用 addMatcher添加更多匹配器以获得相同的结果?

最佳答案

有几个缩小匹配器形成其他匹配器的逻辑组合:anyOf就像“或”,allOf可以实现“和”,和unless就像“不是”。你的例子可能看起来像

functionDecl(
anyOf(
hasName("a"),
hasName("b") ))

关于Clang AST 匹配器的 "AND"和 "OR",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45422806/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com