mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-19 11:35:51 -04:00
[Wdocumentation] Implement \anchor
Differential revision: https://reviews.llvm.org/D69223
This commit is contained in:
parent
2947da9ff7
commit
be1a9b3863
@ -579,6 +579,14 @@
|
|||||||
<param name="pattern">.*\S.*</param>
|
<param name="pattern">.*\S.*</param>
|
||||||
</data>
|
</data>
|
||||||
</element>
|
</element>
|
||||||
|
<element name="anchor">
|
||||||
|
<attribute name="id">
|
||||||
|
<data type="string">
|
||||||
|
<!-- Non-empty text content without whitespace. -->
|
||||||
|
<param name="pattern">\S+</param>
|
||||||
|
</data>
|
||||||
|
</attribute>
|
||||||
|
</element>
|
||||||
<element name="rawHTML">
|
<element name="rawHTML">
|
||||||
<optional>
|
<optional>
|
||||||
<!-- If not specified, the default value is 'false'. -->
|
<!-- If not specified, the default value is 'false'. -->
|
||||||
|
@ -181,7 +181,12 @@ enum CXCommentInlineCommandRenderKind {
|
|||||||
* Command argument should be rendered emphasized (typically italic
|
* Command argument should be rendered emphasized (typically italic
|
||||||
* font).
|
* font).
|
||||||
*/
|
*/
|
||||||
CXCommentInlineCommandRenderKind_Emphasized
|
CXCommentInlineCommandRenderKind_Emphasized,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command argument should not be rendered (since it only defines an anchor).
|
||||||
|
*/
|
||||||
|
CXCommentInlineCommandRenderKind_Anchor
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,10 +94,11 @@ protected:
|
|||||||
|
|
||||||
unsigned : NumInlineContentCommentBits;
|
unsigned : NumInlineContentCommentBits;
|
||||||
|
|
||||||
unsigned RenderKind : 2;
|
unsigned RenderKind : 3;
|
||||||
|
|
||||||
unsigned CommandID : CommandInfo::NumCommandIDBits;
|
unsigned CommandID : CommandInfo::NumCommandIDBits;
|
||||||
};
|
};
|
||||||
enum { NumInlineCommandCommentBits = NumInlineContentCommentBits + 2 +
|
enum { NumInlineCommandCommentBits = NumInlineContentCommentBits + 3 +
|
||||||
CommandInfo::NumCommandIDBits };
|
CommandInfo::NumCommandIDBits };
|
||||||
|
|
||||||
class HTMLTagCommentBitfields {
|
class HTMLTagCommentBitfields {
|
||||||
@ -310,7 +311,8 @@ public:
|
|||||||
RenderNormal,
|
RenderNormal,
|
||||||
RenderBold,
|
RenderBold,
|
||||||
RenderMonospaced,
|
RenderMonospaced,
|
||||||
RenderEmphasized
|
RenderEmphasized,
|
||||||
|
RenderAnchor
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -81,12 +81,13 @@ class RecordLikeDeclarationVerbatimLineCommand<string name> :
|
|||||||
// InlineCommand
|
// InlineCommand
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
def B : InlineCommand<"b">;
|
def B : InlineCommand<"b">;
|
||||||
def C : InlineCommand<"c">;
|
def C : InlineCommand<"c">;
|
||||||
def P : InlineCommand<"p">;
|
def P : InlineCommand<"p">;
|
||||||
def A : InlineCommand<"a">;
|
def A : InlineCommand<"a">;
|
||||||
def E : InlineCommand<"e">;
|
def E : InlineCommand<"e">;
|
||||||
def Em : InlineCommand<"em">;
|
def Em : InlineCommand<"em">;
|
||||||
|
def Anchor : InlineCommand<"anchor">;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// BlockCommand
|
// BlockCommand
|
||||||
|
@ -1143,6 +1143,7 @@ Sema::getInlineCommandRenderKind(StringRef Name) const {
|
|||||||
.Case("b", InlineCommandComment::RenderBold)
|
.Case("b", InlineCommandComment::RenderBold)
|
||||||
.Cases("c", "p", InlineCommandComment::RenderMonospaced)
|
.Cases("c", "p", InlineCommandComment::RenderMonospaced)
|
||||||
.Cases("a", "e", "em", InlineCommandComment::RenderEmphasized)
|
.Cases("a", "e", "em", InlineCommandComment::RenderEmphasized)
|
||||||
|
.Case("anchor", InlineCommandComment::RenderAnchor)
|
||||||
.Default(InlineCommandComment::RenderNormal);
|
.Default(InlineCommandComment::RenderNormal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1518,6 +1518,9 @@ void JSONNodeDumper::visitInlineCommandComment(
|
|||||||
case comments::InlineCommandComment::RenderMonospaced:
|
case comments::InlineCommandComment::RenderMonospaced:
|
||||||
JOS.attribute("renderKind", "monospaced");
|
JOS.attribute("renderKind", "monospaced");
|
||||||
break;
|
break;
|
||||||
|
case comments::InlineCommandComment::RenderAnchor:
|
||||||
|
JOS.attribute("renderKind", "anchor");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::json::Array Args;
|
llvm::json::Array Args;
|
||||||
|
@ -489,6 +489,9 @@ void TextNodeDumper::visitInlineCommandComment(
|
|||||||
case comments::InlineCommandComment::RenderEmphasized:
|
case comments::InlineCommandComment::RenderEmphasized:
|
||||||
OS << " RenderEmphasized";
|
OS << " RenderEmphasized";
|
||||||
break;
|
break;
|
||||||
|
case comments::InlineCommandComment::RenderAnchor:
|
||||||
|
OS << " RenderAnchor";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
|
for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
|
||||||
|
@ -297,6 +297,10 @@ void CommentASTToHTMLConverter::visitInlineCommandComment(
|
|||||||
appendToResultWithHTMLEscaping(Arg0);
|
appendToResultWithHTMLEscaping(Arg0);
|
||||||
Result << "</em>";
|
Result << "</em>";
|
||||||
return;
|
return;
|
||||||
|
case InlineCommandComment::RenderAnchor:
|
||||||
|
assert(C->getNumArgs() == 1);
|
||||||
|
Result << "<span id=\"" << Arg0 << "\"></span>";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,6 +645,10 @@ void CommentASTToXMLConverter::visitInlineCommandComment(
|
|||||||
appendToResultWithXMLEscaping(Arg0);
|
appendToResultWithXMLEscaping(Arg0);
|
||||||
Result << "</emphasized>";
|
Result << "</emphasized>";
|
||||||
return;
|
return;
|
||||||
|
case InlineCommandComment::RenderAnchor:
|
||||||
|
assert(C->getNumArgs() == 1);
|
||||||
|
Result << "<anchor id=\"" << Arg0 << "\"></anchor>";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,11 @@ int Test_InlineCommandComment;
|
|||||||
// CHECK: VarDecl{{.*}}Test_InlineCommandComment
|
// CHECK: VarDecl{{.*}}Test_InlineCommandComment
|
||||||
// CHECK: InlineCommandComment{{.*}} Name="c" RenderMonospaced Arg[0]="Aaa"
|
// CHECK: InlineCommandComment{{.*}} Name="c" RenderMonospaced Arg[0]="Aaa"
|
||||||
|
|
||||||
|
/// \anchor Aaa
|
||||||
|
int Test_InlineCommandCommentAnchor;
|
||||||
|
// CHECK: VarDecl{{.*}}Test_InlineCommandComment
|
||||||
|
// CHECK: InlineCommandComment{{.*}} Name="anchor" RenderAnchor Arg[0]="Aaa"
|
||||||
|
|
||||||
/// <a>Aaa</a>
|
/// <a>Aaa</a>
|
||||||
/// <br/>
|
/// <br/>
|
||||||
int Test_HTMLTagComment;
|
int Test_HTMLTagComment;
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Namespace>
|
||||||
|
<Name>aaa</Name>
|
||||||
|
<Abstract>
|
||||||
|
<Para>
|
||||||
|
<anchor id="aaa"></anchor>
|
||||||
|
</Para>
|
||||||
|
</Abstract>
|
||||||
|
</Namespace>
|
@ -734,6 +734,16 @@ void comment_to_html_conversion_36();
|
|||||||
// CHECK-NEXT: (CXComment_Text Text=[Aaa])
|
// CHECK-NEXT: (CXComment_Text Text=[Aaa])
|
||||||
// CHECK-NEXT: (CXComment_HTMLEndTag Name=[h1])))]
|
// CHECK-NEXT: (CXComment_HTMLEndTag Name=[h1])))]
|
||||||
|
|
||||||
|
/// \anchor A
|
||||||
|
void comment_to_html_conversion_37();
|
||||||
|
|
||||||
|
// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_37:{{.*}} FullCommentAsHTML=[<p class="para-brief"> <span id="A"></span></p>] FullCommentAsXML=[<Function file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="6"><Name>comment_to_html_conversion_37</Name><USR>c:@F@comment_to_html_conversion_37#</USR><Declaration>void comment_to_html_conversion_37()</Declaration><Abstract><Para> <anchor id="A"></anchor></Para></Abstract></Function>]
|
||||||
|
// CHECK-NEXT: CommentAST=[
|
||||||
|
// CHECK-NEXT: (CXComment_FullComment
|
||||||
|
// CHECK-NEXT: (CXComment_Paragraph
|
||||||
|
// CHECK-NEXT: (CXComment_Text Text=[ ] IsWhitespace)
|
||||||
|
// CHECK-NEXT: (CXComment_InlineCommand CommandName=[anchor] RenderAnchor Arg[0]=A)))]
|
||||||
|
|
||||||
|
|
||||||
/// Aaa.
|
/// Aaa.
|
||||||
class comment_to_xml_conversion_01 {
|
class comment_to_xml_conversion_01 {
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
// RUN: xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/valid-enum-01.xml
|
// RUN: xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/valid-enum-01.xml
|
||||||
//
|
//
|
||||||
// RUN: xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/valid-para-kind-01.xml
|
// RUN: xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/valid-para-kind-01.xml
|
||||||
|
//
|
||||||
|
// RUN: xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/valid-inline-command-01.xml
|
||||||
|
|
||||||
// RUN: not xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/invalid-function-01.xml 2>&1 | FileCheck %s -check-prefix=CHECK-INVALID
|
// RUN: not xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/invalid-function-01.xml 2>&1 | FileCheck %s -check-prefix=CHECK-INVALID
|
||||||
// RUN: not xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/invalid-function-02.xml 2>&1 | FileCheck %s -check-prefix=CHECK-INVALID
|
// RUN: not xmllint --noout --relaxng %S/../../bindings/xml/comment-xml-schema.rng %S/Inputs/CommentXML/invalid-function-02.xml 2>&1 | FileCheck %s -check-prefix=CHECK-INVALID
|
||||||
|
@ -1102,6 +1102,13 @@ int test_inline_no_argument_a_bad(int);
|
|||||||
/// \a A
|
/// \a A
|
||||||
int test_inline_no_argument_a_good(int);
|
int test_inline_no_argument_a_good(int);
|
||||||
|
|
||||||
|
// expected-warning@+1 {{'\anchor' command does not have a valid word argument}}
|
||||||
|
/// \anchor
|
||||||
|
int test_inline_no_argument_anchor_bad(int);
|
||||||
|
|
||||||
|
/// \anchor A
|
||||||
|
int test_inline_no_argument_anchor_good(int);
|
||||||
|
|
||||||
// expected-warning@+1 {{'@b' command does not have a valid word argument}}
|
// expected-warning@+1 {{'@b' command does not have a valid word argument}}
|
||||||
/// @b
|
/// @b
|
||||||
int test_inline_no_argument_b_bad(int);
|
int test_inline_no_argument_b_bad(int);
|
||||||
|
@ -497,6 +497,9 @@ static void DumpCXCommentInternal(struct CommentASTDumpingContext *Ctx,
|
|||||||
case CXCommentInlineCommandRenderKind_Emphasized:
|
case CXCommentInlineCommandRenderKind_Emphasized:
|
||||||
printf(" RenderEmphasized");
|
printf(" RenderEmphasized");
|
||||||
break;
|
break;
|
||||||
|
case CXCommentInlineCommandRenderKind_Anchor:
|
||||||
|
printf(" RenderAnchor");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
for (i = 0, e = clang_InlineCommandComment_getNumArgs(Comment);
|
for (i = 0, e = clang_InlineCommandComment_getNumArgs(Comment);
|
||||||
i != e; ++i) {
|
i != e; ++i) {
|
||||||
|
@ -159,6 +159,9 @@ clang_InlineCommandComment_getRenderKind(CXComment CXC) {
|
|||||||
|
|
||||||
case InlineCommandComment::RenderEmphasized:
|
case InlineCommandComment::RenderEmphasized:
|
||||||
return CXCommentInlineCommandRenderKind_Emphasized;
|
return CXCommentInlineCommandRenderKind_Emphasized;
|
||||||
|
|
||||||
|
case InlineCommandComment::RenderAnchor:
|
||||||
|
return CXCommentInlineCommandRenderKind_Anchor;
|
||||||
}
|
}
|
||||||
llvm_unreachable("unknown InlineCommandComment::RenderKind");
|
llvm_unreachable("unknown InlineCommandComment::RenderKind");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user