@@ -54,6 +54,7 @@ class MustacheTemplateFile : public Template {
5454 std::unique_ptr<llvm::MemoryBuffer> Buffer = std::move (BufferOrError.get ());
5555 llvm::StringRef FileContent = Buffer->getBuffer ();
5656 registerPartial (Name, FileContent);
57+ return llvm::Error::success ();
5758 }
5859
5960 MustacheTemplateFile (StringRef TemplateStr) : Template(TemplateStr) {}
@@ -72,6 +73,7 @@ setupTemplateFiles(const clang::doc::ClangDocContext &CDCtx) {
7273 return llvm::createFileError (" cannot open file" , EC);
7374 }
7475 NamespaceTemplate = std::move (Template.get ());
76+ return llvm::Error::success ();
7577}
7678
7779llvm::Error
@@ -118,6 +120,7 @@ MustacheHTMLGenerator::generateDocs(llvm::StringRef RootDir,
118120 }
119121 }
120122 }
123+ return llvm::Error::success ();
121124}
122125
123126Value extractValue (const Location &L,
@@ -130,6 +133,8 @@ Value extractValue(const Location &L,
130133 SmallString<128 > FileURL (*RepositoryUrl);
131134 llvm::sys::path::append (FileURL, llvm::sys::path::Style::posix, L.Filename );
132135 Obj.insert ({" FileURL" , FileURL});
136+
137+ return Obj;
133138}
134139
135140Value extractValue (const Reference &I, StringRef CurrentDirectory) {
@@ -280,29 +285,39 @@ Value extractValue(const NamespaceInfo &I, const ClangDocContext &CDCtx) {
280285 Value ArrNamespace = Array ();
281286 for (const Reference& Child : I.Children .Namespaces )
282287 ArrNamespace.getAsArray ()->emplace_back (extractValue (Child, BasePath));
283- NamespaceValue.insert ({" Namespace" , ArrNamespace});
288+
289+ if (!ArrNamespace.getAsArray ()->empty ())
290+ NamespaceValue.insert ({" Namespace" , Object{{" Links" , ArrNamespace}}});
284291
285292 Value ArrRecord = Array ();
286293 for (const Reference& Child : I.Children .Records )
287294 ArrRecord.getAsArray ()->emplace_back (extractValue (Child, BasePath));
288- NamespaceValue.insert ({" Record" , ArrRecord});
295+
296+ if (!ArrRecord.getAsArray ()->empty ())
297+ NamespaceValue.insert ({" Record" , Object{{" Links" , ArrRecord}}});
289298
290299 Value ArrFunction = Array ();
291300 for (const FunctionInfo& Child : I.Children .Functions )
292301 ArrFunction.getAsArray ()->emplace_back (extractValue (Child, BasePath,
293302 CDCtx));
294- NamespaceValue.insert ({" Function" , ArrRecord});
303+ if (!ArrFunction.getAsArray ()->empty ())
304+ NamespaceValue.insert ({" Function" , Object{{" Obj" , ArrFunction}}});
295305
296306 Value ArrEnum = Array ();
297307 for (const EnumInfo& Child : I.Children .Enums )
298308 ArrEnum.getAsArray ()->emplace_back (extractValue (Child, CDCtx));
299- NamespaceValue.insert ({" Enums" , ArrEnum });
309+
310+ if (!ArrEnum.getAsArray ()->empty ())
311+ NamespaceValue.insert ({" Enums" , Object{{" Obj" , ArrEnum }}});
300312
301313 Value ArrTypedefs = Array ();
302314 for (const TypedefInfo& Child : I.Children .Typedefs )
303315 ArrTypedefs.getAsArray ()->emplace_back (extractValue (Child));
304- NamespaceValue.insert ({" Typedefs" , ArrTypedefs });
305316
317+ if (!ArrTypedefs.getAsArray ()->empty ())
318+ NamespaceValue.insert ({" Typedefs" , Object{{" Obj" , ArrTypedefs }}});
319+
320+ return NamespaceValue;
306321}
307322
308323
@@ -313,6 +328,7 @@ MustacheHTMLGenerator::generateDocForInfo(Info *I, llvm::raw_ostream &OS,
313328 switch (I->IT ) {
314329 case InfoType::IT_namespace: {
315330 Value V = extractValue (*static_cast <clang::doc::NamespaceInfo *>(I), CDCtx);
331+ llvm::outs () << V << " \n " ;
316332 OS << NamespaceTemplate->render (V);
317333 break ;
318334 }
@@ -332,18 +348,18 @@ MustacheHTMLGenerator::generateDocForInfo(Info *I, llvm::raw_ostream &OS,
332348}
333349
334350llvm::Error MustacheHTMLGenerator::createResources (ClangDocContext &CDCtx) {
335-
351+ return llvm::Error::success ();
336352}
337353
338- const char *MustacheHTMLGenerator::Format = " mustache " ;
354+ const char *MustacheHTMLGenerator::Format = " mhtml " ;
339355
340356
341357static GeneratorRegistry::Add<MustacheHTMLGenerator> MHTML (MustacheHTMLGenerator::Format,
342358 " Generator for mustache HTML output." );
343359
344360// This anchor is used to force the linker to link in the generated object
345361// file and thus register the generator.
346- volatile int HTMLGeneratorAnchorSource = 0 ;
362+ volatile int MHTMLGeneratorAnchorSource = 0 ;
347363
348364} // namespace doc
349365} // namespace clang
0 commit comments