systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
FindConstructor.cpp
Go to the documentation of this file.
1#include "FindConstructor.h"
2
3using namespace systemc_clang;
4
5FindConstructor::FindConstructor(const clang::CXXRecordDecl *declaration,
6 llvm::raw_ostream &os)
7 : os_{os},
8 declaration_{declaration},
9 constructor_stmt_{nullptr},
10 constructor_decl_{nullptr},
11 pass_{1} {
12 TraverseDecl(const_cast<clang::CXXRecordDecl *>(declaration_));
13 pass_ = 2;
14 TraverseStmt(constructor_stmt_);
15}
16
21
23
25 clang::CXXConstructorDecl *ctor_decl) {
26 constructor_decl_ = ctor_decl;
27
28 return true;
29}
30
32 clang::CXXMethodDecl *method_declaration) {
33 switch (pass_) {
34 case 1: {
35 // constructor_decl_ = dyn_cast<CXXConstructorDecl>(method_declaration);
36 // llvm::outs() << "setting the constructor_decl_ to " <<
37 // constructor_decl_
38 // << "\n ";
40 const clang::FunctionDecl *fd{nullptr};
41 constructor_decl_->getBody(fd);
42 if (constructor_decl_->hasBody()) {
44 }
45 }
46 break;
47 }
48 case 2: {
49 // os_ << "\n\nPass 2 of VisitCXXMethodDecl\n\n";
50 break;
51 }
52 case 3: {
53 break;
54 }
55 }
56 return true;
57}
58
59clang::CXXConstructorDecl *FindConstructor::getConstructorDecl() const {
60 return constructor_decl_;
61}
62
63const clang::CXXRecordDecl *FindConstructor::getAsCXXRecordDecl() const {
64 return declaration_;
65}
66
68 return constructor_stmt_;
69}
70
FindConstructor(const clang::CXXRecordDecl *, llvm::raw_ostream &)
const clang::CXXRecordDecl * declaration_
const clang::CXXRecordDecl * getAsCXXRecordDecl() const
clang::CXXConstructorDecl * getConstructorDecl() const
clang::Stmt * getConstructorStmt() const
virtual bool VisitCXXConstructorDecl(clang::CXXConstructorDecl *ctor_decl)
clang::CXXConstructorDecl * constructor_decl_
virtual bool VisitCXXMethodDecl(clang::CXXMethodDecl *)