systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
SystemCClang.h
Go to the documentation of this file.
1// ===-- src/SystemCClang.h - systec-clang class definition -------*- C++
2// -*-===//
3//
4// systemc-clang: SystemC Parser
5//
6// This file is distributed under the University of Illinois License.
7// See LICENSE.mkd for details.
8//
9// ===----------------------------------------------------------------------===//
10// /
11// / \file
12// / \brief This file contains the class declaration for main SystemC parser.
13// /
14// ===----------------------------------------------------------------------===//
15#ifndef _SYSTEMC_CLANG_H_
16#define _SYSTEMC_CLANG_H_
17
18#include "clang/AST/ASTConsumer.h"
19#include "clang/AST/RecursiveASTVisitor.h"
20#include "clang/Basic/SourceManager.h"
21#include "clang/Frontend/CompilerInstance.h"
22#include "clang/Frontend/FrontendPluginRegistry.h"
23#include "clang/Tooling/CommonOptionsParser.h"
24#include "clang/Tooling/Tooling.h"
25
26#include "model/Model.h"
27#include "matchers/FindSCMain.h"
28#include "matchers/Matchers.h"
29
30//#include "SCuitable/FindGPUMacro.h"
31//#include "SCuitable/GlobalSuspensionAutomata.h"
32//#include "SuspensionAutomata.h"
33
34namespace systemc_clang {
35using namespace clang::tooling;
36using namespace sc_ast_matchers;
45
46class SystemCConsumer : public ASTConsumer,
47 public RecursiveASTVisitor<SystemCConsumer> {
48 // TODO: This should be made private at some point.
49 public:
50 llvm::raw_ostream &os_;
51
52 public:
53 SystemCConsumer(clang::CompilerInstance &, std::string top = "!none");
54 SystemCConsumer(clang::ASTUnit *from_ast, std::string top = "!none");
55 virtual ~SystemCConsumer();
56
57
58 void processNetlist(FindSCMain *scmain, ModuleDeclarationMatcher *module_declaration_handler);
59
61 const std::string &getTopModule() const;
62 void setTopModule(const std::string &top_module_decl);
63 clang::ASTContext &getContext() const;
64 clang::SourceManager &getSourceManager() const;
65
66 // Virtual methods that plugins may override.
67 virtual bool fire();
68 virtual bool preFire();
69 virtual bool postFire();
70
71 virtual void HandleTranslationUnit(clang::ASTContext &context);
72
73 private:
74 std::string top_;
76 clang::ASTContext &context_;
77 clang::SourceManager &sm_;
78}; // End class SystemCConsumer
79
80//
81// SystemCClang
82//
83//
84
98 public:
99 SystemCClang(clang::CompilerInstance &ci, const std::string &top)
100 : SystemCConsumer(ci, top) {}
101};
102
103} // End namespace systemc_clang
104#endif
Class ModuleDeclarationMatcher.
Definition Matchers.h:40
SystemCClang(clang::CompilerInstance &ci, const std::string &top)
This is the main consumer class that beings the parsing of SystemC.
const std::string & getTopModule() const
clang::SourceManager & sm_
clang::SourceManager & getSourceManager() const
clang::ASTContext & context_
SystemCConsumer(clang::CompilerInstance &, std::string top="!none")
virtual void HandleTranslationUnit(clang::ASTContext &context)
void setTopModule(const std::string &top_module_decl)
void processNetlist(FindSCMain *scmain, ModuleDeclarationMatcher *module_declaration_handler)
clang::ASTContext & getContext() const