@@ -55,7 +55,7 @@ class HTMLTag {
5555 operator TagType () const { return Value; }
5656 operator bool () = delete;
5757
58- bool IsSelfClosing () const ;
58+ bool isSelfClosing () const ;
5959 llvm::SmallString<16 > ToString () const ;
6060
6161private:
@@ -71,7 +71,7 @@ struct HTMLNode {
7171 HTMLNode (NodeType Type) : Type(Type) {}
7272 virtual ~HTMLNode () = default ;
7373
74- virtual void Render (llvm::raw_ostream &OS, int IndentationLevel) = 0;
74+ virtual void render (llvm::raw_ostream &OS, int IndentationLevel) = 0;
7575 NodeType Type; // Type of node
7676};
7777
@@ -80,7 +80,7 @@ struct TextNode : public HTMLNode {
8080 : HTMLNode(NodeType::NODE_TEXT), Text(Text.str()) {}
8181
8282 std::string Text; // Content of node
83- void Render (llvm::raw_ostream &OS, int IndentationLevel) override ;
83+ void render (llvm::raw_ostream &OS, int IndentationLevel) override ;
8484};
8585
8686struct TagNode : public HTMLNode {
@@ -94,25 +94,25 @@ struct TagNode : public HTMLNode {
9494 std::vector<std::pair<std::string, std::string>>
9595 Attributes; // List of key-value attributes for tag
9696
97- void Render (llvm::raw_ostream &OS, int IndentationLevel) override ;
97+ void render (llvm::raw_ostream &OS, int IndentationLevel) override ;
9898};
9999
100100constexpr const char *kDoctypeDecl = " <!DOCTYPE html>" ;
101101
102102struct HTMLFile {
103103 std::vector<std::unique_ptr<HTMLNode>> Children; // List of child nodes
104- void Render (llvm::raw_ostream &OS) {
104+ void render (llvm::raw_ostream &OS) {
105105 OS << kDoctypeDecl << " \n " ;
106106 for (const auto &C : Children) {
107- C->Render (OS, 0 );
107+ C->render (OS, 0 );
108108 OS << " \n " ;
109109 }
110110 }
111111};
112112
113113} // namespace
114114
115- bool HTMLTag::IsSelfClosing () const {
115+ bool HTMLTag::isSelfClosing () const {
116116 switch (Value) {
117117 case HTMLTag::TAG_META:
118118 case HTMLTag::TAG_LINK:
@@ -177,12 +177,12 @@ llvm::SmallString<16> HTMLTag::ToString() const {
177177 llvm_unreachable (" Unhandled HTMLTag::TagType" );
178178}
179179
180- void TextNode::Render (llvm::raw_ostream &OS, int IndentationLevel) {
180+ void TextNode::render (llvm::raw_ostream &OS, int IndentationLevel) {
181181 OS.indent (IndentationLevel * 2 );
182182 printHTMLEscaped (Text, OS);
183183}
184184
185- void TagNode::Render (llvm::raw_ostream &OS, int IndentationLevel) {
185+ void TagNode::render (llvm::raw_ostream &OS, int IndentationLevel) {
186186 // Children nodes are rendered in the same line if all of them are text nodes
187187 bool InlineChildren = true ;
188188 for (const auto &C : Children)
@@ -194,7 +194,7 @@ void TagNode::Render(llvm::raw_ostream &OS, int IndentationLevel) {
194194 OS << " <" << Tag.ToString ();
195195 for (const auto &A : Attributes)
196196 OS << " " << A.first << " =\" " << A.second << " \" " ;
197- if (Tag.IsSelfClosing ()) {
197+ if (Tag.isSelfClosing ()) {
198198 OS << " />" ;
199199 return ;
200200 }
@@ -205,7 +205,7 @@ void TagNode::Render(llvm::raw_ostream &OS, int IndentationLevel) {
205205 for (const auto &C : Children) {
206206 int ChildrenIndentation =
207207 InlineChildren || !NewLineRendered ? 0 : IndentationLevel + 1 ;
208- C->Render (OS, ChildrenIndentation);
208+ C->render (OS, ChildrenIndentation);
209209 if (!InlineChildren && (C == Children.back () ||
210210 (C->Type != NodeType::NODE_TEXT ||
211211 (&C + 1 )->get ()->Type != NodeType::NODE_TEXT))) {
@@ -221,7 +221,7 @@ void TagNode::Render(llvm::raw_ostream &OS, int IndentationLevel) {
221221
222222template <typename Derived, typename Base,
223223 typename = std::enable_if<std::is_base_of<Derived, Base>::value>>
224- static void AppendVector (std::vector<Derived> &&New,
224+ static void appendVector (std::vector<Derived> &&New,
225225 std::vector<Base> &Original) {
226226 std::move (New.begin (), New.end (), std::back_inserter (Original));
227227}
@@ -322,8 +322,7 @@ genReference(const Reference &Type, StringRef CurrentDirectory,
322322 if (Type.Path .empty ()) {
323323 if (!JumpToSection)
324324 return std::make_unique<TextNode>(Type.Name );
325- else
326- return genLink (Type.Name , " #" + *JumpToSection);
325+ return genLink (Type.Name , " #" + *JumpToSection);
327326 }
328327 llvm::SmallString<64 > Path = Type.getRelativeFilePath (CurrentDirectory);
329328 llvm::sys::path::append (Path, Type.getFileBaseName () + " .html" );
@@ -366,7 +365,7 @@ genEnumsBlock(const std::vector<EnumInfo> &Enums,
366365 auto &DivBody = Out.back ();
367366 for (const auto &E : Enums) {
368367 std::vector<std::unique_ptr<TagNode>> Nodes = genHTML (E, CDCtx);
369- AppendVector (std::move (Nodes), DivBody->Children );
368+ appendVector (std::move (Nodes), DivBody->Children );
370369 }
371370 return Out;
372371}
@@ -397,7 +396,7 @@ genFunctionsBlock(const std::vector<FunctionInfo> &Functions,
397396 for (const auto &F : Functions) {
398397 std::vector<std::unique_ptr<TagNode>> Nodes =
399398 genHTML (F, CDCtx, ParentInfoDir);
400- AppendVector (std::move (Nodes), DivBody->Children );
399+ appendVector (std::move (Nodes), DivBody->Children );
401400 }
402401 return Out;
403402}
@@ -487,10 +486,10 @@ genFileHeadNodes(StringRef Title, StringRef InfoPath,
487486 Out.emplace_back (std::make_unique<TagNode>(HTMLTag::TAG_TITLE, Title));
488487 std::vector<std::unique_ptr<TagNode>> StylesheetsNodes =
489488 genStylesheetsHTML (InfoPath, CDCtx);
490- AppendVector (std::move (StylesheetsNodes), Out);
489+ appendVector (std::move (StylesheetsNodes), Out);
491490 std::vector<std::unique_ptr<TagNode>> JsNodes =
492491 genJsScriptsHTML (InfoPath, CDCtx);
493- AppendVector (std::move (JsNodes), Out);
492+ appendVector (std::move (JsNodes), Out);
494493 return Out;
495494}
496495
@@ -522,15 +521,15 @@ static std::unique_ptr<TagNode> genInfoFileMainNode(
522521 MainContentNode->Attributes .emplace_back (" id" , " main-content" );
523522 MainContentNode->Attributes .emplace_back (
524523 " class" , " col-xs-12 col-sm-9 col-md-8 main-content" );
525- AppendVector (std::move (MainContentInnerNodes), MainContentNode->Children );
524+ appendVector (std::move (MainContentInnerNodes), MainContentNode->Children );
526525
527526 auto RightSidebarNode = std::make_unique<TagNode>(HTMLTag::TAG_DIV);
528527 RightSidebarNode->Attributes .emplace_back (" id" , " sidebar-right" );
529528 RightSidebarNode->Attributes .emplace_back (
530529 " class" , " col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right" );
531530 std::vector<std::unique_ptr<TagNode>> InfoIndexHTML =
532531 genHTML (InfoIndex, InfoPath, true );
533- AppendVector (std::move (InfoIndexHTML), RightSidebarNode->Children );
532+ appendVector (std::move (InfoIndexHTML), RightSidebarNode->Children );
534533
535534 MainNode->Children .emplace_back (std::move (LeftSidebarNode));
536535 MainNode->Children .emplace_back (std::move (MainContentNode));
@@ -564,7 +563,7 @@ genInfoFile(StringRef Title, StringRef InfoPath,
564563 genInfoFileMainNode (InfoPath, MainContentNodes, InfoIndex);
565564 std::unique_ptr<TagNode> FooterNode = genFileFooterNode ();
566565
567- AppendVector (std::move (HeadNodes), F.Children );
566+ appendVector (std::move (HeadNodes), F.Children );
568567 F.Children .emplace_back (std::move (HeaderNode));
569568 F.Children .emplace_back (std::move (MainNode));
570569 F.Children .emplace_back (std::move (FooterNode));
@@ -603,7 +602,7 @@ genHTML(const Index &Index, StringRef InfoPath, bool IsOutermostList) {
603602 for (const auto &C : Index.Children ) {
604603 auto LiBody = std::make_unique<TagNode>(HTMLTag::TAG_LI);
605604 std::vector<std::unique_ptr<TagNode>> Nodes = genHTML (C, InfoPath, false );
606- AppendVector (std::move (Nodes), LiBody->Children );
605+ appendVector (std::move (Nodes), LiBody->Children );
607606 UlBody->Children .emplace_back (std::move (LiBody));
608607 }
609608 return Out;
@@ -618,7 +617,9 @@ static std::unique_ptr<HTMLNode> genHTML(const CommentInfo &I) {
618617 FullComment->Children .emplace_back (std::move (Node));
619618 }
620619 return std::move (FullComment);
621- } else if (I.Kind == " ParagraphComment" ) {
620+ }
621+
622+ if (I.Kind == " ParagraphComment" ) {
622623 auto ParagraphComment = std::make_unique<TagNode>(HTMLTag::TAG_P);
623624 for (const auto &Child : I.Children ) {
624625 std::unique_ptr<HTMLNode> Node = genHTML (*Child);
@@ -628,7 +629,9 @@ static std::unique_ptr<HTMLNode> genHTML(const CommentInfo &I) {
628629 if (ParagraphComment->Children .empty ())
629630 return nullptr ;
630631 return std::move (ParagraphComment);
631- } else if (I.Kind == " TextComment" ) {
632+ }
633+
634+ if (I.Kind == " TextComment" ) {
632635 if (I.Text == " " )
633636 return nullptr ;
634637 return std::make_unique<TextNode>(I.Text );
@@ -648,11 +651,7 @@ static std::unique_ptr<TagNode> genHTML(const std::vector<CommentInfo> &C) {
648651static std::vector<std::unique_ptr<TagNode>>
649652genHTML (const EnumInfo &I, const ClangDocContext &CDCtx) {
650653 std::vector<std::unique_ptr<TagNode>> Out;
651- std::string EnumType;
652- if (I.Scoped )
653- EnumType = " enum class " ;
654- else
655- EnumType = " enum " ;
654+ std::string EnumType = I.Scoped ? " enum class " : " enum " ;
656655
657656 Out.emplace_back (
658657 std::make_unique<TagNode>(HTMLTag::TAG_H3, EnumType + I.Name ));
@@ -746,17 +745,17 @@ genHTML(const NamespaceInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
746745
747746 std::vector<std::unique_ptr<TagNode>> ChildNamespaces =
748747 genReferencesBlock (I.Children .Namespaces , " Namespaces" , BasePath);
749- AppendVector (std::move (ChildNamespaces), Out);
748+ appendVector (std::move (ChildNamespaces), Out);
750749 std::vector<std::unique_ptr<TagNode>> ChildRecords =
751750 genReferencesBlock (I.Children .Records , " Records" , BasePath);
752- AppendVector (std::move (ChildRecords), Out);
751+ appendVector (std::move (ChildRecords), Out);
753752
754753 std::vector<std::unique_ptr<TagNode>> ChildFunctions =
755754 genFunctionsBlock (I.Children .Functions , CDCtx, BasePath);
756- AppendVector (std::move (ChildFunctions), Out);
755+ appendVector (std::move (ChildFunctions), Out);
757756 std::vector<std::unique_ptr<TagNode>> ChildEnums =
758757 genEnumsBlock (I.Children .Enums , CDCtx);
759- AppendVector (std::move (ChildEnums), Out);
758+ appendVector (std::move (ChildEnums), Out);
760759
761760 if (!I.Children .Namespaces .empty ())
762761 InfoIndex.Children .emplace_back (" Namespaces" , " Namespaces" );
@@ -800,29 +799,29 @@ genHTML(const RecordInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
800799 auto &PBody = Out.back ();
801800 PBody->Children .emplace_back (std::make_unique<TextNode>(" Inherits from " ));
802801 if (Parents.empty ())
803- AppendVector (std::move (VParents), PBody->Children );
802+ appendVector (std::move (VParents), PBody->Children );
804803 else if (VParents.empty ())
805- AppendVector (std::move (Parents), PBody->Children );
804+ appendVector (std::move (Parents), PBody->Children );
806805 else {
807- AppendVector (std::move (Parents), PBody->Children );
806+ appendVector (std::move (Parents), PBody->Children );
808807 PBody->Children .emplace_back (std::make_unique<TextNode>(" , " ));
809- AppendVector (std::move (VParents), PBody->Children );
808+ appendVector (std::move (VParents), PBody->Children );
810809 }
811810 }
812811
813812 std::vector<std::unique_ptr<TagNode>> Members =
814813 genRecordMembersBlock (I.Members , I.Path );
815- AppendVector (std::move (Members), Out);
814+ appendVector (std::move (Members), Out);
816815 std::vector<std::unique_ptr<TagNode>> ChildRecords =
817816 genReferencesBlock (I.Children .Records , " Records" , I.Path );
818- AppendVector (std::move (ChildRecords), Out);
817+ appendVector (std::move (ChildRecords), Out);
819818
820819 std::vector<std::unique_ptr<TagNode>> ChildFunctions =
821820 genFunctionsBlock (I.Children .Functions , CDCtx, I.Path );
822- AppendVector (std::move (ChildFunctions), Out);
821+ appendVector (std::move (ChildFunctions), Out);
823822 std::vector<std::unique_ptr<TagNode>> ChildEnums =
824823 genEnumsBlock (I.Children .Enums , CDCtx);
825- AppendVector (std::move (ChildEnums), Out);
824+ appendVector (std::move (ChildEnums), Out);
826825
827826 if (!I.Members .empty ())
828827 InfoIndex.Children .emplace_back (" Members" , " Members" );
@@ -945,7 +944,7 @@ llvm::Error HTMLGenerator::generateDocForInfo(Info *I, llvm::raw_ostream &OS,
945944
946945 HTMLFile F = genInfoFile (InfoTitle, I->getRelativeFilePath (" " ),
947946 MainContentNodes, InfoIndex, CDCtx);
948- F.Render (OS);
947+ F.render (OS);
949948
950949 return llvm::Error::success ();
951950}
@@ -968,7 +967,7 @@ static std::string getRefType(InfoType IT) {
968967 llvm_unreachable (" Unknown InfoType" );
969968}
970969
971- static llvm::Error SerializeIndex (ClangDocContext &CDCtx) {
970+ static llvm::Error serializeIndex (ClangDocContext &CDCtx) {
972971 std::error_code OK;
973972 std::error_code FileErr;
974973 llvm::SmallString<128 > FilePath;
@@ -1018,7 +1017,7 @@ static std::unique_ptr<TagNode> genIndexFileMainNode() {
10181017 return MainNode;
10191018}
10201019
1021- static llvm::Error GenIndex (const ClangDocContext &CDCtx) {
1020+ static llvm::Error genIndex (const ClangDocContext &CDCtx) {
10221021 std::error_code FileErr, OK;
10231022 llvm::SmallString<128 > IndexPath;
10241023 llvm::sys::path::native (CDCtx.OutDirectory , IndexPath);
@@ -1038,17 +1037,17 @@ static llvm::Error GenIndex(const ClangDocContext &CDCtx) {
10381037 std::unique_ptr<TagNode> MainNode = genIndexFileMainNode ();
10391038 std::unique_ptr<TagNode> FooterNode = genFileFooterNode ();
10401039
1041- AppendVector (std::move (HeadNodes), F.Children );
1040+ appendVector (std::move (HeadNodes), F.Children );
10421041 F.Children .emplace_back (std::move (HeaderNode));
10431042 F.Children .emplace_back (std::move (MainNode));
10441043 F.Children .emplace_back (std::move (FooterNode));
10451044
1046- F.Render (IndexOS);
1045+ F.render (IndexOS);
10471046
10481047 return llvm::Error::success ();
10491048}
10501049
1051- static llvm::Error CopyFile (StringRef FilePath, StringRef OutDirectory) {
1050+ static llvm::Error copyFile (StringRef FilePath, StringRef OutDirectory) {
10521051 llvm::SmallString<128 > PathWrite;
10531052 llvm::sys::path::native (OutDirectory, PathWrite);
10541053 llvm::sys::path::append (PathWrite, llvm::sys::path::filename (FilePath));
@@ -1066,20 +1065,20 @@ static llvm::Error CopyFile(StringRef FilePath, StringRef OutDirectory) {
10661065}
10671066
10681067llvm::Error HTMLGenerator::createResources (ClangDocContext &CDCtx) {
1069- auto Err = SerializeIndex (CDCtx);
1068+ auto Err = serializeIndex (CDCtx);
10701069 if (Err)
10711070 return Err;
1072- Err = GenIndex (CDCtx);
1071+ Err = genIndex (CDCtx);
10731072 if (Err)
10741073 return Err;
10751074
10761075 for (const auto &FilePath : CDCtx.UserStylesheets ) {
1077- Err = CopyFile (FilePath, CDCtx.OutDirectory );
1076+ Err = copyFile (FilePath, CDCtx.OutDirectory );
10781077 if (Err)
10791078 return Err;
10801079 }
10811080 for (const auto &FilePath : CDCtx.JsScripts ) {
1082- Err = CopyFile (FilePath, CDCtx.OutDirectory );
1081+ Err = copyFile (FilePath, CDCtx.OutDirectory );
10831082 if (Err)
10841083 return Err;
10851084 }
0 commit comments