systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
FindArgument.cpp
Go to the documentation of this file.
1#include "FindArgument.h"
2
3#include "clang/AST/DeclCXX.h"
4#include "llvm/Support/raw_ostream.h"
5#include "APIntUtils.h"
6
7using namespace systemc_clang;
8using namespace clang;
9
10FindArgument::FindArgument(Expr *e) : expression_(e) {
11 TraverseStmt(expression_);
12}
13
15
16bool FindArgument::VisitMemberExpr(MemberExpr *member_expr) {
17 argument_name_ = member_expr->getMemberNameInfo().getAsString();
18 return true;
19}
20
21bool FindArgument::VisitDeclRefExpr(DeclRefExpr *declaration_ref) {
22 argument_name_ = declaration_ref->getFoundDecl()->getNameAsString();
23 return true;
24}
25
26bool FindArgument::VisitIntegerLiteral(IntegerLiteral *integer_literal) {
28 systemc_clang::utils::apint::toString(integer_literal->getValue());
29 return true;
30}
31
32bool FindArgument::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *boolean_expr) {
33 if (boolean_expr->getValue() == false) {
34 argument_name_ = "false";
35 } else {
36 argument_name_ = "true";
37 }
38 return true;
39}
40
virtual bool VisitIntegerLiteral(clang::IntegerLiteral *il)
virtual bool VisitDeclRefExpr(clang::DeclRefExpr *de)
virtual bool VisitCXXBoolLiteralExpr(clang::CXXBoolLiteralExpr *bl)
virtual bool VisitMemberExpr(clang::MemberExpr *me)
Clang forward declarations.
Definition FindArgument.h:6
std::string toString(const T &i)
Definition APIntUtils.h:14