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 65 66 67 68 69 70 71 72
|
#ifndef CLANG_H
#define CLANG_H
#include <wx/string.h>
#include <set>
#include <clang-c/Index.h>
class Clang
{
public:
typedef std::set<wxString> Set_t;
enum {
Parse,
//WritePch,
PrintMacros,
ParseMacros,
CC
};
protected:
wxString m_file;
wxString m_astFile;
int m_command;
bool m_isOK;
wxString m_outputFolder;
char** m_argv;
int m_argc;
wxString m_loc;
Set_t m_interestingMacros;
public:
static enum CXChildVisitResult MacrosCallback(CXCursor cursor,
CXCursor parent,
CXClientData clientData);
protected:
int DoParse();
int DoPrintMacros();
int DoCC();
int DoParseMacros();
// Helpers
void DoGetUsedMacros(const wxString &filename);
public:
Clang(const char* file, const char* command, int argc, char **argv);
virtual ~Clang();
int Run();
void SetCommand(int command) {
this->m_command = command;
}
void SetFile(const wxString& file) {
this->m_file = file;
}
void SetIsOK(bool isOK) {
this->m_isOK = isOK;
}
int GetCommand() const {
return m_command;
}
const wxString& GetFile() const {
return m_file;
}
bool IsOK() const {
return m_isOK;
}
};
#endif // CLANG_H
|