From 2248b565d3a0994c7f8970bbb6fc9210a53a77db Mon Sep 17 00:00:00 2001 From: triton Date: Mon, 7 Apr 2014 12:26:58 +0100 Subject: [PATCH] Cleaned up AST.h. * Added some regions make the code easier to work with. * Moved related things together. --- src/CppParser/AST.h | 115 +++++++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 50 deletions(-) diff --git a/src/CppParser/AST.h b/src/CppParser/AST.h index 8f35599f..2372aade 100644 --- a/src/CppParser/AST.h +++ b/src/CppParser/AST.h @@ -11,7 +11,7 @@ namespace CppSharp { namespace CppParser { namespace AST { -// Types +#pragma region Types enum struct TypeKind { @@ -244,33 +244,17 @@ struct CS_API BuiltinType : public Type PrimitiveType Type; }; -// Comments +#pragma endregion -enum struct RawCommentKind -{ - Invalid, - OrdinaryBCPL, - OrdinaryC, - BCPLSlash, - BCPLExcl, - JavaDoc, - Qt, - Merged -}; - -struct FullComment; +#pragma region ABI -struct CS_API RawComment +enum struct CppAbi { - RawComment(); - RawCommentKind Kind; - STRING(Text) - STRING(BriefText) - CppSharp::CppParser::AST::FullComment* FullComment; + Itanium, + Microsoft, + ARM }; -// Class layouts - enum struct VTableComponentKind { VCallOffset, @@ -305,13 +289,6 @@ struct CS_API VFTableInfo VTableLayout Layout; }; -enum struct CppAbi -{ - Itanium, - Microsoft, - ARM -}; - struct CS_API ClassLayout { ClassLayout(); @@ -325,27 +302,9 @@ struct CS_API ClassLayout int DataSize; }; -// Declarations +#pragma endregion -enum struct MacroLocation -{ - Unknown, - ClassHead, - ClassBody, - FunctionHead, - FunctionParameters, - FunctionBody, -}; - -enum struct AccessSpecifier -{ - Private, - Protected, - Public -}; - -struct DeclarationContext; -struct PreprocessedEntity; +#pragma region Declarations enum struct DeclarationKind { @@ -375,6 +334,17 @@ enum struct DeclarationKind #define DECLARE_DECL_KIND(klass, kind) \ klass(); +enum struct AccessSpecifier +{ + Private, + Protected, + Public +}; + +struct DeclarationContext; +struct RawComment; +struct PreprocessedEntity; + struct CS_API Declaration { Declaration(DeclarationKind kind); @@ -583,6 +553,9 @@ struct CS_API Variable : public Declaration CppSharp::CppParser::AST::QualifiedType QualifiedType; }; +struct DeclarationContext; +struct PreprocessedEntity; + struct CS_API BaseClassSpecifier { BaseClassSpecifier(); @@ -680,6 +653,16 @@ struct CS_API Namespace : public DeclarationContext Namespace(); }; +enum struct MacroLocation +{ + Unknown, + ClassHead, + ClassBody, + FunctionHead, + FunctionParameters, + FunctionBody, +}; + struct CS_API PreprocessedEntity : public Declaration { PreprocessedEntity(); @@ -719,4 +702,36 @@ struct CS_API ASTContext VECTOR(TranslationUnit*, TranslationUnits) }; +#pragma endregion + +#pragma region Comments + +#define DECLARE_COMMENT_KIND(kind) \ + kind##Type(); + +enum struct RawCommentKind +{ + Invalid, + OrdinaryBCPL, + OrdinaryC, + BCPLSlash, + BCPLExcl, + JavaDoc, + Qt, + Merged +}; + +struct FullComment; + +struct CS_API RawComment +{ + RawComment(); + RawCommentKind Kind; + STRING(Text) + STRING(BriefText) + CppSharp::CppParser::AST::FullComment* FullComment; +}; + +#pragma endregion + } } } \ No newline at end of file