systemc-clang
2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
src
matchers
FindMemberFieldMatcher.h
Go to the documentation of this file.
1
#ifndef _FIND_MEMBER_FIELD_MATCHER_H_
2
#define _FIND_MEMBER_FIELD_MATCHER_H_
3
4
#include <vector>
5
6
#include "clang/ASTMatchers/ASTMatchFinder.h"
7
#include "clang/ASTMatchers/ASTMatchers.h"
8
#include "clang/ASTMatchers/ASTMatchersInternal.h"
9
#include "clang/ASTMatchers/ASTMatchersMacros.h"
10
11
using namespace
clang::ast_matchers;
12
using namespace
clang
;
13
14
namespace
clang
{
15
class
Type;
16
}
17
18
namespace
sc_ast_matchers
{
19
20
class
FindMemberFieldMatcher
:
public
MatchFinder::MatchCallback {
21
private
:
22
std::vector<clang::FieldDecl *>
found_fields_
;
23
24
public
:
25
const
std::vector<clang::FieldDecl *> &
getFieldDecls
() {
26
return
found_fields_
;
27
}
28
29
void
registerMatchers
(MatchFinder &finder) {
30
auto
member_fields_match =
31
recordDecl(forEach(fieldDecl().bind(
"field_decl"
)));
32
33
finder.addMatcher(member_fields_match,
this
);
34
}
35
36
virtual
void
run
(
const
MatchFinder::MatchResult &result) {
37
auto
fd =
const_cast<
FieldDecl *
>
(
38
result.Nodes.getNodeAs<FieldDecl>(
"field_decl"
));
39
40
found_fields_
.push_back(fd);
41
}
42
43
void
dump
() {
44
for
(
auto
const
&field :
found_fields_
) {
45
field->dump();
46
}
47
}
48
};
49
50
};
// namespace sc_ast_matchers
51
52
#endif
sc_ast_matchers::FindMemberFieldMatcher
Definition
FindMemberFieldMatcher.h:20
sc_ast_matchers::FindMemberFieldMatcher::getFieldDecls
const std::vector< clang::FieldDecl * > & getFieldDecls()
Definition
FindMemberFieldMatcher.h:25
sc_ast_matchers::FindMemberFieldMatcher::found_fields_
std::vector< clang::FieldDecl * > found_fields_
Definition
FindMemberFieldMatcher.h:22
sc_ast_matchers::FindMemberFieldMatcher::dump
void dump()
Definition
FindMemberFieldMatcher.h:43
sc_ast_matchers::FindMemberFieldMatcher::run
virtual void run(const MatchFinder::MatchResult &result)
Definition
FindMemberFieldMatcher.h:36
sc_ast_matchers::FindMemberFieldMatcher::registerMatchers
void registerMatchers(MatchFinder &finder)
Definition
FindMemberFieldMatcher.h:29
clang
Clang forward declarations.
Definition
FindArgument.h:6
sc_ast_matchers
Definition
FindMemberFieldMatcher.h:18
Generated by
1.12.0