mirror of
https://github.com/nasa/trick.git
synced 2024-12-27 08:32:30 +00:00
14a75508a3
Changed all header file once include variables to follow the same naming convention and not start with any underscores. Also deleted old incorrect copyright notices. Also removed $Id: tags from all files. Fixes #14. Fixes #22.
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
|
|
#ifndef ENUMVISITOR_HH
|
|
#define ENUMVISITOR_HH
|
|
|
|
#include <string>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
#include "clang/AST/RecursiveASTVisitor.h"
|
|
#include "EnumValues.hh"
|
|
|
|
namespace clang {
|
|
class CompilerInstance ;
|
|
}
|
|
class HeaderSearchDirs ;
|
|
|
|
/**
|
|
|
|
This class is a recursive AST visitor that is called when a Enumeration node
|
|
is found. Inside of a Enum we are only interested in 2 types of nodes, the
|
|
Enum itself, And the string enumerations contained within.
|
|
|
|
@author Alexander S. Lin
|
|
|
|
@date July 2012
|
|
|
|
*/
|
|
|
|
class EnumVisitor : public clang::RecursiveASTVisitor<EnumVisitor> {
|
|
public:
|
|
EnumVisitor( clang::CompilerInstance & in_ci , HeaderSearchDirs & in_hsd ) ;
|
|
|
|
/* VisitDecl and VisitType are here for debug printing. */
|
|
bool VisitDecl(clang::Decl *d) ;
|
|
bool VisitType(clang::Type *t) ;
|
|
|
|
/* These routines are called when nodes of the corresponding types are traversed */
|
|
bool VisitEnumDecl(clang::EnumDecl *ed) ;
|
|
bool VisitEnumConstantDecl(clang::EnumConstantDecl *ecd) ;
|
|
bool VisitEnumType(clang::EnumType *et) ;
|
|
|
|
/** Returns the class data */
|
|
EnumValues * get_enum_data() ;
|
|
|
|
private:
|
|
/** The compiler instance. */
|
|
clang::CompilerInstance & ci ;
|
|
|
|
/** The header search directories */
|
|
HeaderSearchDirs & hsd ;
|
|
|
|
/** Holds the class information found, usually returned to caller of this visitor. */
|
|
EnumValues eval ;
|
|
|
|
} ;
|
|
|
|
#endif
|