Skip to content

Commit 5fc6062

Browse files
committed
refactor xml
1 parent e3de53f commit 5fc6062

File tree

3 files changed

+351
-275
lines changed

3 files changed

+351
-275
lines changed

source/lib/BasicVisitor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,15 @@ bool
125125
BasicVisitor::
126126
VisitTypedefDecl(TypedefDecl const* D)
127127
{
128+
//QualType qt = D->getASTContext().getTypedefType(D);
128129
return mapDecl(D);
129130
}
130131

131132
bool
132133
BasicVisitor::
133134
VisitTypeAliasDecl(TypeAliasDecl const* D)
134135
{
136+
//QualType qt = D->getASTContext().getTypedefType(D);
135137
return mapDecl(D);
136138
}
137139

source/lib/Serialize.cpp

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,12 @@ template <typename T> static std::string serialize(T& I) {
8989
return Buffer.str().str();
9090
}
9191

92-
std::string serialize(std::unique_ptr<Info>& I) {
93-
switch (I->IT) {
92+
std::string
93+
serialize(
94+
std::unique_ptr<Info>& I)
95+
{
96+
switch (I->IT)
97+
{
9498
case InfoType::IT_namespace:
9599
return serialize(*static_cast<NamespaceInfo*>(I.get()));
96100
case InfoType::IT_record:
@@ -99,12 +103,17 @@ std::string serialize(std::unique_ptr<Info>& I) {
99103
return serialize(*static_cast<EnumInfo*>(I.get()));
100104
case InfoType::IT_function:
101105
return serialize(*static_cast<FunctionInfo*>(I.get()));
106+
//case InfoType::IT_typedef:
107+
//return serialize(*static_cast<TypedefInfo*>(I.get()));
102108
default:
103109
return "";
104110
}
105111
}
106112

107-
static SymbolID getUSRForDecl(const Decl* D) {
113+
static
114+
SymbolID
115+
getUSRForDecl(
116+
Decl const* D){
108117
llvm::SmallString<128> USR;
109118
if (index::generateUSRForDecl(D, USR))
110119
return SymbolID();
@@ -420,18 +429,36 @@ void PopulateTemplateParameters(std::optional<TemplateInfo>& TemplateInfo,
420429
}
421430
}
422431

423-
template <typename T>
424-
static void populateInfo(Info& I, const T* D, const FullComment* C,
425-
bool& IsInAnonymousNamespace) {
432+
//------------------------------------------------
433+
434+
template<typename T>
435+
static
436+
void
437+
populateInfo(
438+
Info& I,
439+
T const* D,
440+
FullComment const* C,
441+
bool& IsInAnonymousNamespace)
442+
{
426443
I.USR = getUSRForDecl(D);
427444
I.Name = D->getNameAsString();
428-
populateParentNamespaces(I.Namespace, D, IsInAnonymousNamespace);
429-
if (C) {
445+
populateParentNamespaces(
446+
I.Namespace,
447+
D,
448+
IsInAnonymousNamespace);
449+
if(C)
450+
{
430451
I.Description.emplace_back();
431-
parseComment(C, D->getASTContext(), I.javadoc, I.Description.back());
452+
parseComment(
453+
C,
454+
D->getASTContext(),
455+
I.javadoc,
456+
I.Description.back());
432457
}
433458
}
434459

460+
//------------------------------------------------
461+
435462
template <typename T>
436463
static void populateSymbolInfo(SymbolInfo& I, const T* D, const FullComment* C,
437464
int LineNumber, StringRef Filename,
@@ -734,14 +761,17 @@ emitInfo(
734761
return { nullptr, MakeAndInsertIntoParent<TypedefInfo&&>(std::move(Info)) };
735762
}
736763

737-
// A type alias is a C++ "using" declaration for a type. It gets mapped to a
738-
// TypedefInfo with the IsUsing flag set.
764+
//------------------------------------------------
765+
766+
// A type alias is a C++ "using" declaration for a
767+
// type. It gets mapped to a TypedefInfo with the
768+
// IsUsing flag set.
739769
std::pair<
740770
std::unique_ptr<Info>,
741771
std::unique_ptr<Info>>
742772
emitInfo(
743-
const TypeAliasDecl* D,
744-
const FullComment* FC,
773+
TypeAliasDecl const* D,
774+
FullComment const* FC,
745775
int LineNumber,
746776
StringRef File,
747777
bool IsFileInRootDir,

0 commit comments

Comments
 (0)