systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
FindSCMain.cpp
Go to the documentation of this file.
1#include "FindSCMain.h"
2
3#include "clang/AST/DeclCXX.h"
4
5using namespace systemc_clang;
6
7FindSCMain::FindSCMain(clang::TranslationUnitDecl *tuDecl,
8 llvm::raw_ostream &os)
9 : os_{os}, sc_main_function_declaration_{nullptr} {
10 assert(!(tuDecl == nullptr));
11 TraverseDecl(tuDecl);
12}
13
15
16bool FindSCMain::VisitFunctionDecl(clang::FunctionDecl *function_declaration) {
23 if ((function_declaration->getNameInfo().getAsString() != "sc_main") ||
24 (!function_declaration->hasBody()) || (function_declaration->isMain())) {
25 return true;
26 }
27
28 sc_main_function_declaration_ = function_declaration;
29 return true;
30}
31
32clang::FunctionDecl *FindSCMain::getSCMainFunctionDecl() const {
33 assert(sc_main_function_declaration_ != nullptr);
34
36}
37
39 return (sc_main_function_declaration_ != nullptr);
40}
clang::FunctionDecl * getSCMainFunctionDecl() const
virtual bool VisitFunctionDecl(clang::FunctionDecl *decl)
FindSCMain(clang::TranslationUnitDecl *, llvm::raw_ostream &)
Definition FindSCMain.cpp:7
clang::FunctionDecl * sc_main_function_declaration_
Definition FindSCMain.h:25