Skip to content

Commit ead4cd7

Browse files
committed
more function metadata
fix #68
1 parent 6db7a4a commit ead4cd7

File tree

2 files changed

+44
-11
lines changed

2 files changed

+44
-11
lines changed

include/mrdox/meta/Function.hpp

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,6 @@ using UnqualifiedName = llvm::SmallString<16>;
3333
// Info for functions.
3434
struct FunctionInfo : SymbolInfo
3535
{
36-
static constexpr InfoType type_id = InfoType::IT_function;
37-
38-
explicit
39-
FunctionInfo(
40-
SymbolID id_ = SymbolID())
41-
: SymbolInfo(InfoType::IT_function, id_)
42-
{
43-
}
44-
45-
void merge(FunctionInfo&& I);
46-
4736
bool IsMethod = false; // Indicates whether this function is a class method.
4837
Reference Parent; // Reference to the parent class decl for this method.
4938
TypeInfo ReturnType; // Info about the return type of this function.
@@ -60,6 +49,33 @@ struct FunctionInfo : SymbolInfo
6049

6150
// When present, this function is a template or specialization.
6251
llvm::Optional<TemplateInfo> Template;
52+
53+
StorageClass storageClass = SC_None;
54+
RefQualifierKind refQualifier = RQ_None;
55+
56+
bool isConst : 1 = false;
57+
bool isConsteval : 1 = false;
58+
bool isConstexpr : 1 = false;
59+
bool isInline : 1 = false;
60+
bool isNoExcept : 1 = false;
61+
bool isSpecialMember : 1 = false; // dtor, move/copy construct or assign
62+
bool isTrailingReturn : 1 = false;
63+
bool isVariadic : 1 = false; // has a C-style "..." variadic
64+
bool isVirtual : 1 = false;
65+
bool isVolatile : 1 = false;
66+
67+
//--------------------------------------------
68+
69+
static constexpr InfoType type_id = InfoType::IT_function;
70+
71+
explicit
72+
FunctionInfo(
73+
SymbolID id_ = SymbolID())
74+
: SymbolInfo(InfoType::IT_function, id_)
75+
{
76+
}
77+
78+
void merge(FunctionInfo&& I);
6379
};
6480

6581
//------------------------------------------------

source/lib/ast/Serialize.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,23 @@ build(
967967
InfoType::IT_record);
968968
I.Access = D->getAccess();
969969

970+
I.refQualifier = D->getRefQualifier();
971+
972+
I.isConst = D->isConst();
973+
I.isConsteval = D->isConsteval();
974+
I.isConstexpr = D->isConstexprSpecified() && ! D->isExplicitlyDefaulted();
975+
I.isInline = D->isInlineSpecified();
976+
I.isNoExcept = isNoexceptExceptionSpec(D->getExceptionSpecType());
977+
//I.isSpecialMember =
978+
I.isVariadic = D->isVariadic();
979+
I.isVirtual = D->isVirtualAsWritten();
980+
I.isVolatile = D->isVolatile();
981+
982+
if(auto const* FP = D->getType()->getAs<FunctionProtoType>())
983+
{
984+
I.isTrailingReturn = FP->hasTrailingReturn();
985+
}
986+
970987
// Functions are inserted into the parent by
971988
// reference, so we need to return both the
972989
// parent and the record itself.

0 commit comments

Comments
 (0)