Skip to content

Commit

Permalink
refactor metadata extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
vinniefalco committed May 4, 2023
1 parent 81d2d91 commit 1cee02e
Show file tree
Hide file tree
Showing 38 changed files with 1,405 additions and 1,683 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ file(GLOB_RECURSE LIB_SOURCES CONFIGURE_DEPENDS
source/api/*.h
source/api/*.hpp
source/api/*.cpp
#source/api/*.natvis
source/api/*.natvis
)

add_library(mrdox-api ${MRDOX_LINK_MODE} ${LIB_INCLUDES} ${LIB_SOURCES})
Expand Down
4 changes: 2 additions & 2 deletions include/mrdox/Corpus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class MRDOX_VISIBLE
MRDOX_DECL virtual bool visit(FunctionInfo const&);
MRDOX_DECL virtual bool visit(TypedefInfo const&);
MRDOX_DECL virtual bool visit(EnumInfo const&);
MRDOX_DECL virtual bool visit(VariableInfo const&);
MRDOX_DECL virtual bool visit(VarInfo const&);
};

/** Visit the specified symbol ID or node.
Expand Down Expand Up @@ -160,7 +160,7 @@ get(
Assert(t->IT == InfoType::IT_typedef);
else if constexpr(std::is_same_v<T, EnumInfo>)
Assert(t->IT == InfoType::IT_enum);
else if constexpr(std::is_same_v<T, VariableInfo>)
else if constexpr(std::is_same_v<T, VarInfo>)
Assert(t->IT == InfoType::IT_variable);
return *t;
}
Expand Down
2 changes: 1 addition & 1 deletion include/mrdox/Metadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
#include <mrdox/Metadata/TemplateParam.hpp>
#include <mrdox/Metadata/Type.hpp>
#include <mrdox/Metadata/Typedef.hpp>
#include <mrdox/Metadata/Variable.hpp>
#include <mrdox/Metadata/Var.hpp>

#endif
4 changes: 3 additions & 1 deletion include/mrdox/Metadata/Function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ enum class FnFlags1 : std::uint32_t
0x00000008 +
0x00000010,

isExplicit = 0x00000020
isExplicit = 0x00000020,

functionKind = 0b00000000'00000000'00011111'11000000
};

// TODO: Expand to allow for documenting templating and default args.
Expand Down
2 changes: 1 addition & 1 deletion include/mrdox/Metadata/Scope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct Scope
std::vector<Reference> Functions;
std::vector<Reference> Typedefs;
std::vector<Reference> Enums;
std::vector<Reference> Variables;
std::vector<Reference> Vars;

explicit
Scope(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum class VarFlags0 : std::uint32_t
This includes variables at namespace
scope, and static variables at class scope.
*/
struct VariableInfo
struct VarInfo
: SymbolInfo
, TypeInfo // holds the type of this variable
{
Expand All @@ -42,7 +42,7 @@ struct VariableInfo
static constexpr InfoType type_id = InfoType::IT_variable;

explicit
VariableInfo(
VarInfo(
SymbolID ID = SymbolID(),
llvm::StringRef Name = llvm::StringRef())
: SymbolInfo(InfoType::IT_variable, ID, Name)
Expand Down
2 changes: 1 addition & 1 deletion include/mrdox/MetadataFwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct TemplateParamInfo;
struct TemplateSpecializationInfo;
struct TypeInfo;
struct TypedefInfo;
struct VariableInfo;
struct VarInfo;
struct VerbatimBlock;

} // mrdox
Expand Down
2 changes: 1 addition & 1 deletion mrdox.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ grammar {
Javadoc?
}

VariableInfo = element variable {
VarInfo = element var {
Name,
Id,
(Location &
Expand Down
6 changes: 3 additions & 3 deletions mrdox.rng
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@
</optional>
</element>
</define>
<define name="VariableInfo">
<element name="variable">
<define name="VarInfo">
<element name="var">
<ref name="Name"/>
<ref name="Id"/>
<interleave>
Expand Down Expand Up @@ -302,7 +302,7 @@
<ref name="FunctionInfo"/>
<ref name="TypedefInfo"/>
<ref name="EnumInfo"/>
<ref name="VariableInfo"/>
<ref name="VarInfo"/>
</choice>
</zeroOrMore>
</define>
Expand Down
Loading

0 comments on commit 1cee02e

Please sign in to comment.