-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
Bindings enclosed within a hasAnyBase()
expression don't work. Fortunately, isDerivedFrom()
does work. The issue appears in both clang-query
and in matchers built as a Clang plugin.
Given the sample program:
class B {};
class D: public B {};
The matcher
m cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("B")).bind("b"))))
causes clang-query to return
Match #1:
C:\ast\clang_ast_bug_1.cpp:3:1: note: "root" binds here
class C: public B {};
^~~~~~~~~~~~~~~~~~~~
1 match.
But the query
m cxxRecordDecl(isDerivedFrom(cxxRecordDecl(hasName("B")).bind("b")))
produces:
Match #1:
C:\ast\clang_ast_bug_1.cpp:1:1: note: "b" binds here
class B {};
^~~~~~~~~~
C:\ast\clang_ast_bug_1.cpp:3:1: note: "root" binds here
class C: public B {};
^~~~~~~~~~~~~~~~~~~~
1 match.
I am using Clang v.16.0.4, which I believe Mozilla built.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"