-
Notifications
You must be signed in to change notification settings - Fork 6
/
CodeHandler.h
64 lines (53 loc) · 1.75 KB
/
CodeHandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef CODE_HANDLER_H
#define CODE_HANDLER_H
#include <string>
#include <vector>
#include <iostream>
using namespace std;
#include <llvm/Support/CommandLine.h>
#include <llvm/Support/MemoryBuffer.h>
using namespace llvm;
#include <clang/Basic/Diagnostic.h>
#include <clang/Basic/FileManager.h>
#include <clang/Basic/IdentifierTable.h>
#include <clang/Basic/TargetInfo.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/PreprocessorOptions.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
#include <clang/Frontend/Utils.h>
#include <clang/Lex/HeaderSearch.h>
#include <clang/Lex/LexDiagnostic.h>
#include <clang/Lex/Preprocessor.h>
#include <clang/Parse/ParseAST.h>
#include <clang/Parse/Parser.h>
using namespace clang;
#include "Defines.h"
#include "Utils.h"
namespace differential {
class CodeHandler {
protected:
LangOptions language_options_;
TargetOptions target_options_;
PreprocessorOptions preprocessor_options_;
HeaderSearchOptions header_search_options_;
FrontendOptions frontend_options_;
TargetInfo* target_info_;
FileManager file_manager_;
HeaderSearch header_search_;
Preprocessor * preprocessor_ptr_;
SourceManager source_manager_;
DiagnosticOptions diagnostic_options_;
DiagnosticsEngine diagnostics_engine_;
TextDiagnosticPrinter * text_diag_printer_;
ASTContext * contex_ptr;
public:
CodeHandler(string filename);
virtual ~CodeHandler();
static void Init(int argc, char *argv[]);
static void DefineBuiltinMacro(vector<char> &Buf, const char *Macro, const char *Command = "#define ");
ASTContext * getAST(void);
DiagnosticsEngine& getDiagnosticsEngine() { return diagnostics_engine_; }
Preprocessor * getPreprocessor() { return preprocessor_ptr_; }
};
}
#endif