diff options
Diffstat (limited to 'tools/slang-cpp-extractor/node-tree.h')
| -rw-r--r-- | tools/slang-cpp-extractor/node-tree.h | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/tools/slang-cpp-extractor/node-tree.h b/tools/slang-cpp-extractor/node-tree.h index b54321b09..f1547dbc1 100644 --- a/tools/slang-cpp-extractor/node-tree.h +++ b/tools/slang-cpp-extractor/node-tree.h @@ -1,31 +1,31 @@ #ifndef CPP_EXTRACT_NODE_TREE_H #define CPP_EXTRACT_NODE_TREE_H +#include "../../source/compiler-core/slang-lexer.h" #include "diagnostics.h" -#include "node.h" #include "identifier-lookup.h" +#include "node.h" -#include "../../source/compiler-core/slang-lexer.h" - -namespace CppExtract { +namespace CppExtract +{ using namespace Slang; class TypeSet : public RefObject { public: /// This is the looked up name. - UnownedStringSlice m_macroName; ///< The name extracted from the macro SLANG_ABSTRACT_AST_CLASS -> AST + UnownedStringSlice + m_macroName; ///< The name extracted from the macro SLANG_ABSTRACT_AST_CLASS -> AST - String m_typeName; ///< The enum type name associated with this type for AST it is ASTNode - String m_fileMark; ///< This 'mark' becomes of the output filename + String m_typeName; ///< The enum type name associated with this type for AST it is ASTNode + String m_fileMark; ///< This 'mark' becomes of the output filename - List<ClassLikeNode*> m_baseTypes; ///< The base types for this type set + List<ClassLikeNode*> m_baseTypes; ///< The base types for this type set }; class SourceOrigin : public RefObject { public: - void addNode(Node* node) { if (auto classLike = as<ClassLikeNode>(node)) @@ -37,17 +37,18 @@ public: m_nodes.add(node); } - SourceOrigin(SourceFile* sourceFile, const String& macroOrigin) : - m_sourceFile(sourceFile), - m_macroOrigin(macroOrigin) - {} + SourceOrigin(SourceFile* sourceFile, const String& macroOrigin) + : m_sourceFile(sourceFile), m_macroOrigin(macroOrigin) + { + } - String m_macroOrigin; ///< The macro text is inserted into the macro to identify the origin. It is based on the filename - SourceFile* m_sourceFile; ///< The source file - also holds the path information + String m_macroOrigin; ///< The macro text is inserted into the macro to identify the origin. It + ///< is based on the filename + SourceFile* m_sourceFile; ///< The source file - also holds the path information /// All of the nodes defined in this file in the order they were defined /// Note that the same namespace may be listed multiple times. - List<RefPtr<Node> > m_nodes; + List<RefPtr<Node>> m_nodes; }; struct Options; @@ -59,22 +60,23 @@ class NodeTree { public: friend class Parser; - /// Get all of the parsed source origins - const List<RefPtr<SourceOrigin> >& getSourceOrigins() const { return m_sourceOrigins; } + /// Get all of the parsed source origins + const List<RefPtr<SourceOrigin>>& getSourceOrigins() const { return m_sourceOrigins; } TypeSet* getTypeSet(const UnownedStringSlice& slice); TypeSet* getOrAddTypeSet(const UnownedStringSlice& slice); SourceOrigin* addSourceOrigin(SourceFile* sourceFile, const Options& options); - /// Get all of the type sets + /// Get all of the type sets const List<RefPtr<TypeSet>>& getTypeSets() const { return m_typeSets; } - /// Get the root node + /// Get the root node Node* getRootNode() const { return m_rootNode; } - /// When parsing we don't lookup all up super types/add derived types. This is because - /// we allow files to be processed in any order, so we have to do the type lookup as a separate operation + /// When parsing we don't lookup all up super types/add derived types. This is because + /// we allow files to be processed in any order, so we have to do the type lookup as a separate + /// operation SlangResult calcDerivedTypes(DiagnosticSink* sink); NodeTree(StringSlicePool* typePool, NamePool* namePool, IdentifierLookup* identifierLookup); @@ -84,19 +86,19 @@ public: protected: SlangResult _calcDerivedTypesRec(ScopeNode* node, DiagnosticSink* sink); - StringSlicePool m_typeSetPool; ///< Pool for type set names - List<RefPtr<TypeSet> > m_typeSets; ///< The type sets + StringSlicePool m_typeSetPool; ///< Pool for type set names + List<RefPtr<TypeSet>> m_typeSets; ///< The type sets IdentifierLookup* m_identifierLookup; - StringSlicePool* m_typePool; ///< Pool for just types + StringSlicePool* m_typePool; ///< Pool for just types NamePool* m_namePool; - RefPtr<ScopeNode> m_rootNode; ///< The root scope + RefPtr<ScopeNode> m_rootNode; ///< The root scope List<RefPtr<SourceOrigin>> m_sourceOrigins; }; -} // CppExtract +} // namespace CppExtract #endif |
