xref: /src/contrib/llvm-project/clang/include/clang-c/Documentation.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
19f4dbff6SDimitry Andric /*==-- clang-c/Documentation.h - Utilities for comment processing -*- C -*-===*\
29f4dbff6SDimitry Andric |*                                                                            *|
322989816SDimitry Andric |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
422989816SDimitry Andric |* Exceptions.                                                                *|
522989816SDimitry Andric |* See https://llvm.org/LICENSE.txt for license information.                  *|
622989816SDimitry Andric |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
79f4dbff6SDimitry Andric |*                                                                            *|
89f4dbff6SDimitry Andric |*===----------------------------------------------------------------------===*|
99f4dbff6SDimitry Andric |*                                                                            *|
109f4dbff6SDimitry Andric |* This header provides a supplementary interface for inspecting              *|
119f4dbff6SDimitry Andric |* documentation comments.                                                    *|
129f4dbff6SDimitry Andric |*                                                                            *|
139f4dbff6SDimitry Andric \*===----------------------------------------------------------------------===*/
149f4dbff6SDimitry Andric 
1506d4ba38SDimitry Andric #ifndef LLVM_CLANG_C_DOCUMENTATION_H
1606d4ba38SDimitry Andric #define LLVM_CLANG_C_DOCUMENTATION_H
179f4dbff6SDimitry Andric 
18e3b55780SDimitry Andric #include "clang-c/CXErrorCode.h"
19706b4fc4SDimitry Andric #include "clang-c/ExternC.h"
209f4dbff6SDimitry Andric #include "clang-c/Index.h"
219f4dbff6SDimitry Andric 
22706b4fc4SDimitry Andric LLVM_CLANG_C_EXTERN_C_BEGIN
239f4dbff6SDimitry Andric 
249f4dbff6SDimitry Andric /**
259f4dbff6SDimitry Andric  * \defgroup CINDEX_COMMENT Comment introspection
269f4dbff6SDimitry Andric  *
279f4dbff6SDimitry Andric  * The routines in this group provide access to information in documentation
289f4dbff6SDimitry Andric  * comments. These facilities are distinct from the core and may be subject to
299f4dbff6SDimitry Andric  * their own schedule of stability and deprecation.
309f4dbff6SDimitry Andric  *
319f4dbff6SDimitry Andric  * @{
329f4dbff6SDimitry Andric  */
339f4dbff6SDimitry Andric 
349f4dbff6SDimitry Andric /**
3548675466SDimitry Andric  * A parsed comment.
369f4dbff6SDimitry Andric  */
379f4dbff6SDimitry Andric typedef struct {
389f4dbff6SDimitry Andric   const void *ASTNode;
399f4dbff6SDimitry Andric   CXTranslationUnit TranslationUnit;
409f4dbff6SDimitry Andric } CXComment;
419f4dbff6SDimitry Andric 
429f4dbff6SDimitry Andric /**
4348675466SDimitry Andric  * Given a cursor that represents a documentable entity (e.g.,
449f4dbff6SDimitry Andric  * declaration), return the associated parsed comment as a
459f4dbff6SDimitry Andric  * \c CXComment_FullComment AST node.
469f4dbff6SDimitry Andric  */
479f4dbff6SDimitry Andric CINDEX_LINKAGE CXComment clang_Cursor_getParsedComment(CXCursor C);
489f4dbff6SDimitry Andric 
499f4dbff6SDimitry Andric /**
5048675466SDimitry Andric  * Describes the type of the comment AST node (\c CXComment).  A comment
519f4dbff6SDimitry Andric  * node can be considered block content (e. g., paragraph), inline content
529f4dbff6SDimitry Andric  * (plain text) or neither (the root AST node).
539f4dbff6SDimitry Andric  */
549f4dbff6SDimitry Andric enum CXCommentKind {
559f4dbff6SDimitry Andric   /**
5648675466SDimitry Andric    * Null comment.  No AST node is constructed at the requested location
579f4dbff6SDimitry Andric    * because there is no text or a syntax error.
589f4dbff6SDimitry Andric    */
599f4dbff6SDimitry Andric   CXComment_Null = 0,
609f4dbff6SDimitry Andric 
619f4dbff6SDimitry Andric   /**
6248675466SDimitry Andric    * Plain text.  Inline content.
639f4dbff6SDimitry Andric    */
649f4dbff6SDimitry Andric   CXComment_Text = 1,
659f4dbff6SDimitry Andric 
669f4dbff6SDimitry Andric   /**
6748675466SDimitry Andric    * A command with word-like arguments that is considered inline content.
689f4dbff6SDimitry Andric    *
699f4dbff6SDimitry Andric    * For example: \\c command.
709f4dbff6SDimitry Andric    */
719f4dbff6SDimitry Andric   CXComment_InlineCommand = 2,
729f4dbff6SDimitry Andric 
739f4dbff6SDimitry Andric   /**
7448675466SDimitry Andric    * HTML start tag with attributes (name-value pairs).  Considered
759f4dbff6SDimitry Andric    * inline content.
769f4dbff6SDimitry Andric    *
779f4dbff6SDimitry Andric    * For example:
789f4dbff6SDimitry Andric    * \verbatim
799f4dbff6SDimitry Andric    * <br> <br /> <a href="http://example.org/">
809f4dbff6SDimitry Andric    * \endverbatim
819f4dbff6SDimitry Andric    */
829f4dbff6SDimitry Andric   CXComment_HTMLStartTag = 3,
839f4dbff6SDimitry Andric 
849f4dbff6SDimitry Andric   /**
8548675466SDimitry Andric    * HTML end tag.  Considered inline content.
869f4dbff6SDimitry Andric    *
879f4dbff6SDimitry Andric    * For example:
889f4dbff6SDimitry Andric    * \verbatim
899f4dbff6SDimitry Andric    * </a>
909f4dbff6SDimitry Andric    * \endverbatim
919f4dbff6SDimitry Andric    */
929f4dbff6SDimitry Andric   CXComment_HTMLEndTag = 4,
939f4dbff6SDimitry Andric 
949f4dbff6SDimitry Andric   /**
9548675466SDimitry Andric    * A paragraph, contains inline comment.  The paragraph itself is
969f4dbff6SDimitry Andric    * block content.
979f4dbff6SDimitry Andric    */
989f4dbff6SDimitry Andric   CXComment_Paragraph = 5,
999f4dbff6SDimitry Andric 
1009f4dbff6SDimitry Andric   /**
10148675466SDimitry Andric    * A command that has zero or more word-like arguments (number of
1029f4dbff6SDimitry Andric    * word-like arguments depends on command name) and a paragraph as an
1039f4dbff6SDimitry Andric    * argument.  Block command is block content.
1049f4dbff6SDimitry Andric    *
1059f4dbff6SDimitry Andric    * Paragraph argument is also a child of the block command.
1069f4dbff6SDimitry Andric    *
10748675466SDimitry Andric    * For example: \has 0 word-like arguments and a paragraph argument.
1089f4dbff6SDimitry Andric    *
1099f4dbff6SDimitry Andric    * AST nodes of special kinds that parser knows about (e. g., \\param
1109f4dbff6SDimitry Andric    * command) have their own node kinds.
1119f4dbff6SDimitry Andric    */
1129f4dbff6SDimitry Andric   CXComment_BlockCommand = 6,
1139f4dbff6SDimitry Andric 
1149f4dbff6SDimitry Andric   /**
11548675466SDimitry Andric    * A \\param or \\arg command that describes the function parameter
1169f4dbff6SDimitry Andric    * (name, passing direction, description).
1179f4dbff6SDimitry Andric    *
1189f4dbff6SDimitry Andric    * For example: \\param [in] ParamName description.
1199f4dbff6SDimitry Andric    */
1209f4dbff6SDimitry Andric   CXComment_ParamCommand = 7,
1219f4dbff6SDimitry Andric 
1229f4dbff6SDimitry Andric   /**
12348675466SDimitry Andric    * A \\tparam command that describes a template parameter (name and
1249f4dbff6SDimitry Andric    * description).
1259f4dbff6SDimitry Andric    *
1269f4dbff6SDimitry Andric    * For example: \\tparam T description.
1279f4dbff6SDimitry Andric    */
1289f4dbff6SDimitry Andric   CXComment_TParamCommand = 8,
1299f4dbff6SDimitry Andric 
1309f4dbff6SDimitry Andric   /**
13148675466SDimitry Andric    * A verbatim block command (e. g., preformatted code).  Verbatim
1329f4dbff6SDimitry Andric    * block has an opening and a closing command and contains multiple lines of
1339f4dbff6SDimitry Andric    * text (\c CXComment_VerbatimBlockLine child nodes).
1349f4dbff6SDimitry Andric    *
1359f4dbff6SDimitry Andric    * For example:
1369f4dbff6SDimitry Andric    * \\verbatim
1379f4dbff6SDimitry Andric    * aaa
1389f4dbff6SDimitry Andric    * \\endverbatim
1399f4dbff6SDimitry Andric    */
1409f4dbff6SDimitry Andric   CXComment_VerbatimBlockCommand = 9,
1419f4dbff6SDimitry Andric 
1429f4dbff6SDimitry Andric   /**
14348675466SDimitry Andric    * A line of text that is contained within a
1449f4dbff6SDimitry Andric    * CXComment_VerbatimBlockCommand node.
1459f4dbff6SDimitry Andric    */
1469f4dbff6SDimitry Andric   CXComment_VerbatimBlockLine = 10,
1479f4dbff6SDimitry Andric 
1489f4dbff6SDimitry Andric   /**
14948675466SDimitry Andric    * A verbatim line command.  Verbatim line has an opening command,
1509f4dbff6SDimitry Andric    * a single line of text (up to the newline after the opening command) and
1519f4dbff6SDimitry Andric    * has no closing command.
1529f4dbff6SDimitry Andric    */
1539f4dbff6SDimitry Andric   CXComment_VerbatimLine = 11,
1549f4dbff6SDimitry Andric 
1559f4dbff6SDimitry Andric   /**
15648675466SDimitry Andric    * A full comment attached to a declaration, contains block content.
1579f4dbff6SDimitry Andric    */
1589f4dbff6SDimitry Andric   CXComment_FullComment = 12
1599f4dbff6SDimitry Andric };
1609f4dbff6SDimitry Andric 
1619f4dbff6SDimitry Andric /**
16248675466SDimitry Andric  * The most appropriate rendering mode for an inline command, chosen on
1639f4dbff6SDimitry Andric  * command semantics in Doxygen.
1649f4dbff6SDimitry Andric  */
1659f4dbff6SDimitry Andric enum CXCommentInlineCommandRenderKind {
1669f4dbff6SDimitry Andric   /**
16748675466SDimitry Andric    * Command argument should be rendered in a normal font.
1689f4dbff6SDimitry Andric    */
1699f4dbff6SDimitry Andric   CXCommentInlineCommandRenderKind_Normal,
1709f4dbff6SDimitry Andric 
1719f4dbff6SDimitry Andric   /**
17248675466SDimitry Andric    * Command argument should be rendered in a bold font.
1739f4dbff6SDimitry Andric    */
1749f4dbff6SDimitry Andric   CXCommentInlineCommandRenderKind_Bold,
1759f4dbff6SDimitry Andric 
1769f4dbff6SDimitry Andric   /**
17748675466SDimitry Andric    * Command argument should be rendered in a monospaced font.
1789f4dbff6SDimitry Andric    */
1799f4dbff6SDimitry Andric   CXCommentInlineCommandRenderKind_Monospaced,
1809f4dbff6SDimitry Andric 
1819f4dbff6SDimitry Andric   /**
18248675466SDimitry Andric    * Command argument should be rendered emphasized (typically italic
1839f4dbff6SDimitry Andric    * font).
1849f4dbff6SDimitry Andric    */
185706b4fc4SDimitry Andric   CXCommentInlineCommandRenderKind_Emphasized,
186706b4fc4SDimitry Andric 
187706b4fc4SDimitry Andric   /**
188706b4fc4SDimitry Andric    * Command argument should not be rendered (since it only defines an anchor).
189706b4fc4SDimitry Andric    */
190706b4fc4SDimitry Andric   CXCommentInlineCommandRenderKind_Anchor
1919f4dbff6SDimitry Andric };
1929f4dbff6SDimitry Andric 
1939f4dbff6SDimitry Andric /**
19448675466SDimitry Andric  * Describes parameter passing direction for \\param or \\arg command.
1959f4dbff6SDimitry Andric  */
1969f4dbff6SDimitry Andric enum CXCommentParamPassDirection {
1979f4dbff6SDimitry Andric   /**
19848675466SDimitry Andric    * The parameter is an input parameter.
1999f4dbff6SDimitry Andric    */
2009f4dbff6SDimitry Andric   CXCommentParamPassDirection_In,
2019f4dbff6SDimitry Andric 
2029f4dbff6SDimitry Andric   /**
20348675466SDimitry Andric    * The parameter is an output parameter.
2049f4dbff6SDimitry Andric    */
2059f4dbff6SDimitry Andric   CXCommentParamPassDirection_Out,
2069f4dbff6SDimitry Andric 
2079f4dbff6SDimitry Andric   /**
20848675466SDimitry Andric    * The parameter is an input and output parameter.
2099f4dbff6SDimitry Andric    */
2109f4dbff6SDimitry Andric   CXCommentParamPassDirection_InOut
2119f4dbff6SDimitry Andric };
2129f4dbff6SDimitry Andric 
2139f4dbff6SDimitry Andric /**
2149f4dbff6SDimitry Andric  * \param Comment AST node of any kind.
2159f4dbff6SDimitry Andric  *
2169f4dbff6SDimitry Andric  * \returns the type of the AST node.
2179f4dbff6SDimitry Andric  */
2189f4dbff6SDimitry Andric CINDEX_LINKAGE enum CXCommentKind clang_Comment_getKind(CXComment Comment);
2199f4dbff6SDimitry Andric 
2209f4dbff6SDimitry Andric /**
2219f4dbff6SDimitry Andric  * \param Comment AST node of any kind.
2229f4dbff6SDimitry Andric  *
2239f4dbff6SDimitry Andric  * \returns number of children of the AST node.
2249f4dbff6SDimitry Andric  */
2259f4dbff6SDimitry Andric CINDEX_LINKAGE unsigned clang_Comment_getNumChildren(CXComment Comment);
2269f4dbff6SDimitry Andric 
2279f4dbff6SDimitry Andric /**
2289f4dbff6SDimitry Andric  * \param Comment AST node of any kind.
2299f4dbff6SDimitry Andric  *
2309f4dbff6SDimitry Andric  * \param ChildIdx child index (zero-based).
2319f4dbff6SDimitry Andric  *
2329f4dbff6SDimitry Andric  * \returns the specified child of the AST node.
2339f4dbff6SDimitry Andric  */
2349f4dbff6SDimitry Andric CINDEX_LINKAGE
2359f4dbff6SDimitry Andric CXComment clang_Comment_getChild(CXComment Comment, unsigned ChildIdx);
2369f4dbff6SDimitry Andric 
2379f4dbff6SDimitry Andric /**
23848675466SDimitry Andric  * A \c CXComment_Paragraph node is considered whitespace if it contains
2399f4dbff6SDimitry Andric  * only \c CXComment_Text nodes that are empty or whitespace.
2409f4dbff6SDimitry Andric  *
2419f4dbff6SDimitry Andric  * Other AST nodes (except \c CXComment_Paragraph and \c CXComment_Text) are
2429f4dbff6SDimitry Andric  * never considered whitespace.
2439f4dbff6SDimitry Andric  *
2449f4dbff6SDimitry Andric  * \returns non-zero if \c Comment is whitespace.
2459f4dbff6SDimitry Andric  */
2469f4dbff6SDimitry Andric CINDEX_LINKAGE unsigned clang_Comment_isWhitespace(CXComment Comment);
2479f4dbff6SDimitry Andric 
2489f4dbff6SDimitry Andric /**
2499f4dbff6SDimitry Andric  * \returns non-zero if \c Comment is inline content and has a newline
2509f4dbff6SDimitry Andric  * immediately following it in the comment text.  Newlines between paragraphs
2519f4dbff6SDimitry Andric  * do not count.
2529f4dbff6SDimitry Andric  */
2539f4dbff6SDimitry Andric CINDEX_LINKAGE
2549f4dbff6SDimitry Andric unsigned clang_InlineContentComment_hasTrailingNewline(CXComment Comment);
2559f4dbff6SDimitry Andric 
2569f4dbff6SDimitry Andric /**
2579f4dbff6SDimitry Andric  * \param Comment a \c CXComment_Text AST node.
2589f4dbff6SDimitry Andric  *
2599f4dbff6SDimitry Andric  * \returns text contained in the AST node.
2609f4dbff6SDimitry Andric  */
2619f4dbff6SDimitry Andric CINDEX_LINKAGE CXString clang_TextComment_getText(CXComment Comment);
2629f4dbff6SDimitry Andric 
2639f4dbff6SDimitry Andric /**
2649f4dbff6SDimitry Andric  * \param Comment a \c CXComment_InlineCommand AST node.
2659f4dbff6SDimitry Andric  *
2669f4dbff6SDimitry Andric  * \returns name of the inline command.
2679f4dbff6SDimitry Andric  */
2689f4dbff6SDimitry Andric CINDEX_LINKAGE
2699f4dbff6SDimitry Andric CXString clang_InlineCommandComment_getCommandName(CXComment Comment);
2709f4dbff6SDimitry Andric 
2719f4dbff6SDimitry Andric /**
2729f4dbff6SDimitry Andric  * \param Comment a \c CXComment_InlineCommand AST node.
2739f4dbff6SDimitry Andric  *
2749f4dbff6SDimitry Andric  * \returns the most appropriate rendering mode, chosen on command
2759f4dbff6SDimitry Andric  * semantics in Doxygen.
2769f4dbff6SDimitry Andric  */
2779f4dbff6SDimitry Andric CINDEX_LINKAGE enum CXCommentInlineCommandRenderKind
2789f4dbff6SDimitry Andric clang_InlineCommandComment_getRenderKind(CXComment Comment);
2799f4dbff6SDimitry Andric 
2809f4dbff6SDimitry Andric /**
2819f4dbff6SDimitry Andric  * \param Comment a \c CXComment_InlineCommand AST node.
2829f4dbff6SDimitry Andric  *
2839f4dbff6SDimitry Andric  * \returns number of command arguments.
2849f4dbff6SDimitry Andric  */
2859f4dbff6SDimitry Andric CINDEX_LINKAGE
2869f4dbff6SDimitry Andric unsigned clang_InlineCommandComment_getNumArgs(CXComment Comment);
2879f4dbff6SDimitry Andric 
2889f4dbff6SDimitry Andric /**
2899f4dbff6SDimitry Andric  * \param Comment a \c CXComment_InlineCommand AST node.
2909f4dbff6SDimitry Andric  *
2919f4dbff6SDimitry Andric  * \param ArgIdx argument index (zero-based).
2929f4dbff6SDimitry Andric  *
2939f4dbff6SDimitry Andric  * \returns text of the specified argument.
2949f4dbff6SDimitry Andric  */
2959f4dbff6SDimitry Andric CINDEX_LINKAGE
2969f4dbff6SDimitry Andric CXString clang_InlineCommandComment_getArgText(CXComment Comment,
2979f4dbff6SDimitry Andric                                                unsigned ArgIdx);
2989f4dbff6SDimitry Andric 
2999f4dbff6SDimitry Andric /**
3009f4dbff6SDimitry Andric  * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
3019f4dbff6SDimitry Andric  * node.
3029f4dbff6SDimitry Andric  *
3039f4dbff6SDimitry Andric  * \returns HTML tag name.
3049f4dbff6SDimitry Andric  */
3059f4dbff6SDimitry Andric CINDEX_LINKAGE CXString clang_HTMLTagComment_getTagName(CXComment Comment);
3069f4dbff6SDimitry Andric 
3079f4dbff6SDimitry Andric /**
3089f4dbff6SDimitry Andric  * \param Comment a \c CXComment_HTMLStartTag AST node.
3099f4dbff6SDimitry Andric  *
3109f4dbff6SDimitry Andric  * \returns non-zero if tag is self-closing (for example, &lt;br /&gt;).
3119f4dbff6SDimitry Andric  */
3129f4dbff6SDimitry Andric CINDEX_LINKAGE
3139f4dbff6SDimitry Andric unsigned clang_HTMLStartTagComment_isSelfClosing(CXComment Comment);
3149f4dbff6SDimitry Andric 
3159f4dbff6SDimitry Andric /**
3169f4dbff6SDimitry Andric  * \param Comment a \c CXComment_HTMLStartTag AST node.
3179f4dbff6SDimitry Andric  *
3189f4dbff6SDimitry Andric  * \returns number of attributes (name-value pairs) attached to the start tag.
3199f4dbff6SDimitry Andric  */
3209f4dbff6SDimitry Andric CINDEX_LINKAGE unsigned clang_HTMLStartTag_getNumAttrs(CXComment Comment);
3219f4dbff6SDimitry Andric 
3229f4dbff6SDimitry Andric /**
3239f4dbff6SDimitry Andric  * \param Comment a \c CXComment_HTMLStartTag AST node.
3249f4dbff6SDimitry Andric  *
3259f4dbff6SDimitry Andric  * \param AttrIdx attribute index (zero-based).
3269f4dbff6SDimitry Andric  *
3279f4dbff6SDimitry Andric  * \returns name of the specified attribute.
3289f4dbff6SDimitry Andric  */
3299f4dbff6SDimitry Andric CINDEX_LINKAGE
3309f4dbff6SDimitry Andric CXString clang_HTMLStartTag_getAttrName(CXComment Comment, unsigned AttrIdx);
3319f4dbff6SDimitry Andric 
3329f4dbff6SDimitry Andric /**
3339f4dbff6SDimitry Andric  * \param Comment a \c CXComment_HTMLStartTag AST node.
3349f4dbff6SDimitry Andric  *
3359f4dbff6SDimitry Andric  * \param AttrIdx attribute index (zero-based).
3369f4dbff6SDimitry Andric  *
3379f4dbff6SDimitry Andric  * \returns value of the specified attribute.
3389f4dbff6SDimitry Andric  */
3399f4dbff6SDimitry Andric CINDEX_LINKAGE
3409f4dbff6SDimitry Andric CXString clang_HTMLStartTag_getAttrValue(CXComment Comment, unsigned AttrIdx);
3419f4dbff6SDimitry Andric 
3429f4dbff6SDimitry Andric /**
3439f4dbff6SDimitry Andric  * \param Comment a \c CXComment_BlockCommand AST node.
3449f4dbff6SDimitry Andric  *
3459f4dbff6SDimitry Andric  * \returns name of the block command.
3469f4dbff6SDimitry Andric  */
3479f4dbff6SDimitry Andric CINDEX_LINKAGE
3489f4dbff6SDimitry Andric CXString clang_BlockCommandComment_getCommandName(CXComment Comment);
3499f4dbff6SDimitry Andric 
3509f4dbff6SDimitry Andric /**
3519f4dbff6SDimitry Andric  * \param Comment a \c CXComment_BlockCommand AST node.
3529f4dbff6SDimitry Andric  *
3539f4dbff6SDimitry Andric  * \returns number of word-like arguments.
3549f4dbff6SDimitry Andric  */
3559f4dbff6SDimitry Andric CINDEX_LINKAGE
3569f4dbff6SDimitry Andric unsigned clang_BlockCommandComment_getNumArgs(CXComment Comment);
3579f4dbff6SDimitry Andric 
3589f4dbff6SDimitry Andric /**
3599f4dbff6SDimitry Andric  * \param Comment a \c CXComment_BlockCommand AST node.
3609f4dbff6SDimitry Andric  *
3619f4dbff6SDimitry Andric  * \param ArgIdx argument index (zero-based).
3629f4dbff6SDimitry Andric  *
3639f4dbff6SDimitry Andric  * \returns text of the specified word-like argument.
3649f4dbff6SDimitry Andric  */
3659f4dbff6SDimitry Andric CINDEX_LINKAGE
3669f4dbff6SDimitry Andric CXString clang_BlockCommandComment_getArgText(CXComment Comment,
3679f4dbff6SDimitry Andric                                               unsigned ArgIdx);
3689f4dbff6SDimitry Andric 
3699f4dbff6SDimitry Andric /**
3709f4dbff6SDimitry Andric  * \param Comment a \c CXComment_BlockCommand or
3719f4dbff6SDimitry Andric  * \c CXComment_VerbatimBlockCommand AST node.
3729f4dbff6SDimitry Andric  *
3739f4dbff6SDimitry Andric  * \returns paragraph argument of the block command.
3749f4dbff6SDimitry Andric  */
3759f4dbff6SDimitry Andric CINDEX_LINKAGE
3769f4dbff6SDimitry Andric CXComment clang_BlockCommandComment_getParagraph(CXComment Comment);
3779f4dbff6SDimitry Andric 
3789f4dbff6SDimitry Andric /**
3799f4dbff6SDimitry Andric  * \param Comment a \c CXComment_ParamCommand AST node.
3809f4dbff6SDimitry Andric  *
3819f4dbff6SDimitry Andric  * \returns parameter name.
3829f4dbff6SDimitry Andric  */
3839f4dbff6SDimitry Andric CINDEX_LINKAGE
3849f4dbff6SDimitry Andric CXString clang_ParamCommandComment_getParamName(CXComment Comment);
3859f4dbff6SDimitry Andric 
3869f4dbff6SDimitry Andric /**
3879f4dbff6SDimitry Andric  * \param Comment a \c CXComment_ParamCommand AST node.
3889f4dbff6SDimitry Andric  *
3899f4dbff6SDimitry Andric  * \returns non-zero if the parameter that this AST node represents was found
3909f4dbff6SDimitry Andric  * in the function prototype and \c clang_ParamCommandComment_getParamIndex
3919f4dbff6SDimitry Andric  * function will return a meaningful value.
3929f4dbff6SDimitry Andric  */
3939f4dbff6SDimitry Andric CINDEX_LINKAGE
3949f4dbff6SDimitry Andric unsigned clang_ParamCommandComment_isParamIndexValid(CXComment Comment);
3959f4dbff6SDimitry Andric 
3969f4dbff6SDimitry Andric /**
3979f4dbff6SDimitry Andric  * \param Comment a \c CXComment_ParamCommand AST node.
3989f4dbff6SDimitry Andric  *
3999f4dbff6SDimitry Andric  * \returns zero-based parameter index in function prototype.
4009f4dbff6SDimitry Andric  */
4019f4dbff6SDimitry Andric CINDEX_LINKAGE
4029f4dbff6SDimitry Andric unsigned clang_ParamCommandComment_getParamIndex(CXComment Comment);
4039f4dbff6SDimitry Andric 
4049f4dbff6SDimitry Andric /**
4059f4dbff6SDimitry Andric  * \param Comment a \c CXComment_ParamCommand AST node.
4069f4dbff6SDimitry Andric  *
4079f4dbff6SDimitry Andric  * \returns non-zero if parameter passing direction was specified explicitly in
4089f4dbff6SDimitry Andric  * the comment.
4099f4dbff6SDimitry Andric  */
4109f4dbff6SDimitry Andric CINDEX_LINKAGE
4119f4dbff6SDimitry Andric unsigned clang_ParamCommandComment_isDirectionExplicit(CXComment Comment);
4129f4dbff6SDimitry Andric 
4139f4dbff6SDimitry Andric /**
4149f4dbff6SDimitry Andric  * \param Comment a \c CXComment_ParamCommand AST node.
4159f4dbff6SDimitry Andric  *
4169f4dbff6SDimitry Andric  * \returns parameter passing direction.
4179f4dbff6SDimitry Andric  */
4189f4dbff6SDimitry Andric CINDEX_LINKAGE
4199f4dbff6SDimitry Andric enum CXCommentParamPassDirection clang_ParamCommandComment_getDirection(
4209f4dbff6SDimitry Andric                                                             CXComment Comment);
4219f4dbff6SDimitry Andric 
4229f4dbff6SDimitry Andric /**
4239f4dbff6SDimitry Andric  * \param Comment a \c CXComment_TParamCommand AST node.
4249f4dbff6SDimitry Andric  *
4259f4dbff6SDimitry Andric  * \returns template parameter name.
4269f4dbff6SDimitry Andric  */
4279f4dbff6SDimitry Andric CINDEX_LINKAGE
4289f4dbff6SDimitry Andric CXString clang_TParamCommandComment_getParamName(CXComment Comment);
4299f4dbff6SDimitry Andric 
4309f4dbff6SDimitry Andric /**
4319f4dbff6SDimitry Andric  * \param Comment a \c CXComment_TParamCommand AST node.
4329f4dbff6SDimitry Andric  *
4339f4dbff6SDimitry Andric  * \returns non-zero if the parameter that this AST node represents was found
4349f4dbff6SDimitry Andric  * in the template parameter list and
4359f4dbff6SDimitry Andric  * \c clang_TParamCommandComment_getDepth and
4369f4dbff6SDimitry Andric  * \c clang_TParamCommandComment_getIndex functions will return a meaningful
4379f4dbff6SDimitry Andric  * value.
4389f4dbff6SDimitry Andric  */
4399f4dbff6SDimitry Andric CINDEX_LINKAGE
4409f4dbff6SDimitry Andric unsigned clang_TParamCommandComment_isParamPositionValid(CXComment Comment);
4419f4dbff6SDimitry Andric 
4429f4dbff6SDimitry Andric /**
4439f4dbff6SDimitry Andric  * \param Comment a \c CXComment_TParamCommand AST node.
4449f4dbff6SDimitry Andric  *
4459f4dbff6SDimitry Andric  * \returns zero-based nesting depth of this parameter in the template parameter list.
4469f4dbff6SDimitry Andric  *
4479f4dbff6SDimitry Andric  * For example,
4489f4dbff6SDimitry Andric  * \verbatim
4499f4dbff6SDimitry Andric  *     template<typename C, template<typename T> class TT>
4509f4dbff6SDimitry Andric  *     void test(TT<int> aaa);
4519f4dbff6SDimitry Andric  * \endverbatim
4529f4dbff6SDimitry Andric  * for C and TT nesting depth is 0,
4539f4dbff6SDimitry Andric  * for T nesting depth is 1.
4549f4dbff6SDimitry Andric  */
4559f4dbff6SDimitry Andric CINDEX_LINKAGE
4569f4dbff6SDimitry Andric unsigned clang_TParamCommandComment_getDepth(CXComment Comment);
4579f4dbff6SDimitry Andric 
4589f4dbff6SDimitry Andric /**
4599f4dbff6SDimitry Andric  * \param Comment a \c CXComment_TParamCommand AST node.
4609f4dbff6SDimitry Andric  *
4619f4dbff6SDimitry Andric  * \returns zero-based parameter index in the template parameter list at a
4629f4dbff6SDimitry Andric  * given nesting depth.
4639f4dbff6SDimitry Andric  *
4649f4dbff6SDimitry Andric  * For example,
4659f4dbff6SDimitry Andric  * \verbatim
4669f4dbff6SDimitry Andric  *     template<typename C, template<typename T> class TT>
4679f4dbff6SDimitry Andric  *     void test(TT<int> aaa);
4689f4dbff6SDimitry Andric  * \endverbatim
4699f4dbff6SDimitry Andric  * for C and TT nesting depth is 0, so we can ask for index at depth 0:
4709f4dbff6SDimitry Andric  * at depth 0 C's index is 0, TT's index is 1.
4719f4dbff6SDimitry Andric  *
4729f4dbff6SDimitry Andric  * For T nesting depth is 1, so we can ask for index at depth 0 and 1:
4739f4dbff6SDimitry Andric  * at depth 0 T's index is 1 (same as TT's),
4749f4dbff6SDimitry Andric  * at depth 1 T's index is 0.
4759f4dbff6SDimitry Andric  */
4769f4dbff6SDimitry Andric CINDEX_LINKAGE
4779f4dbff6SDimitry Andric unsigned clang_TParamCommandComment_getIndex(CXComment Comment, unsigned Depth);
4789f4dbff6SDimitry Andric 
4799f4dbff6SDimitry Andric /**
4809f4dbff6SDimitry Andric  * \param Comment a \c CXComment_VerbatimBlockLine AST node.
4819f4dbff6SDimitry Andric  *
4829f4dbff6SDimitry Andric  * \returns text contained in the AST node.
4839f4dbff6SDimitry Andric  */
4849f4dbff6SDimitry Andric CINDEX_LINKAGE
4859f4dbff6SDimitry Andric CXString clang_VerbatimBlockLineComment_getText(CXComment Comment);
4869f4dbff6SDimitry Andric 
4879f4dbff6SDimitry Andric /**
4889f4dbff6SDimitry Andric  * \param Comment a \c CXComment_VerbatimLine AST node.
4899f4dbff6SDimitry Andric  *
4909f4dbff6SDimitry Andric  * \returns text contained in the AST node.
4919f4dbff6SDimitry Andric  */
4929f4dbff6SDimitry Andric CINDEX_LINKAGE CXString clang_VerbatimLineComment_getText(CXComment Comment);
4939f4dbff6SDimitry Andric 
4949f4dbff6SDimitry Andric /**
49548675466SDimitry Andric  * Convert an HTML tag AST node to string.
4969f4dbff6SDimitry Andric  *
4979f4dbff6SDimitry Andric  * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
4989f4dbff6SDimitry Andric  * node.
4999f4dbff6SDimitry Andric  *
5009f4dbff6SDimitry Andric  * \returns string containing an HTML tag.
5019f4dbff6SDimitry Andric  */
5029f4dbff6SDimitry Andric CINDEX_LINKAGE CXString clang_HTMLTagComment_getAsString(CXComment Comment);
5039f4dbff6SDimitry Andric 
5049f4dbff6SDimitry Andric /**
50548675466SDimitry Andric  * Convert a given full parsed comment to an HTML fragment.
5069f4dbff6SDimitry Andric  *
5079f4dbff6SDimitry Andric  * Specific details of HTML layout are subject to change.  Don't try to parse
5089f4dbff6SDimitry Andric  * this HTML back into an AST, use other APIs instead.
5099f4dbff6SDimitry Andric  *
5109f4dbff6SDimitry Andric  * Currently the following CSS classes are used:
51148675466SDimitry Andric  * \li "para-brief" for \paragraph and equivalent commands;
5129f4dbff6SDimitry Andric  * \li "para-returns" for \\returns paragraph and equivalent commands;
5139f4dbff6SDimitry Andric  * \li "word-returns" for the "Returns" word in \\returns paragraph.
5149f4dbff6SDimitry Andric  *
5159f4dbff6SDimitry Andric  * Function argument documentation is rendered as a \<dl\> list with arguments
5169f4dbff6SDimitry Andric  * sorted in function prototype order.  CSS classes used:
5179f4dbff6SDimitry Andric  * \li "param-name-index-NUMBER" for parameter name (\<dt\>);
5189f4dbff6SDimitry Andric  * \li "param-descr-index-NUMBER" for parameter description (\<dd\>);
5199f4dbff6SDimitry Andric  * \li "param-name-index-invalid" and "param-descr-index-invalid" are used if
5209f4dbff6SDimitry Andric  * parameter index is invalid.
5219f4dbff6SDimitry Andric  *
5229f4dbff6SDimitry Andric  * Template parameter documentation is rendered as a \<dl\> list with
5239f4dbff6SDimitry Andric  * parameters sorted in template parameter list order.  CSS classes used:
5249f4dbff6SDimitry Andric  * \li "tparam-name-index-NUMBER" for parameter name (\<dt\>);
5259f4dbff6SDimitry Andric  * \li "tparam-descr-index-NUMBER" for parameter description (\<dd\>);
5269f4dbff6SDimitry Andric  * \li "tparam-name-index-other" and "tparam-descr-index-other" are used for
5279f4dbff6SDimitry Andric  * names inside template template parameters;
5289f4dbff6SDimitry Andric  * \li "tparam-name-index-invalid" and "tparam-descr-index-invalid" are used if
5299f4dbff6SDimitry Andric  * parameter position is invalid.
5309f4dbff6SDimitry Andric  *
5319f4dbff6SDimitry Andric  * \param Comment a \c CXComment_FullComment AST node.
5329f4dbff6SDimitry Andric  *
5339f4dbff6SDimitry Andric  * \returns string containing an HTML fragment.
5349f4dbff6SDimitry Andric  */
5359f4dbff6SDimitry Andric CINDEX_LINKAGE CXString clang_FullComment_getAsHTML(CXComment Comment);
5369f4dbff6SDimitry Andric 
5379f4dbff6SDimitry Andric /**
53848675466SDimitry Andric  * Convert a given full parsed comment to an XML document.
5399f4dbff6SDimitry Andric  *
5409f4dbff6SDimitry Andric  * A Relax NG schema for the XML can be found in comment-xml-schema.rng file
5419f4dbff6SDimitry Andric  * inside clang source tree.
5429f4dbff6SDimitry Andric  *
5439f4dbff6SDimitry Andric  * \param Comment a \c CXComment_FullComment AST node.
5449f4dbff6SDimitry Andric  *
5459f4dbff6SDimitry Andric  * \returns string containing an XML document.
5469f4dbff6SDimitry Andric  */
5479f4dbff6SDimitry Andric CINDEX_LINKAGE CXString clang_FullComment_getAsXML(CXComment Comment);
5489f4dbff6SDimitry Andric 
5499f4dbff6SDimitry Andric /**
550e3b55780SDimitry Andric  * CXAPISet is an opaque type that represents a data structure containing all
551e3b55780SDimitry Andric  * the API information for a given translation unit. This can be used for a
552e3b55780SDimitry Andric  * single symbol symbol graph for a given symbol.
553e3b55780SDimitry Andric  */
554e3b55780SDimitry Andric typedef struct CXAPISetImpl *CXAPISet;
555e3b55780SDimitry Andric 
556e3b55780SDimitry Andric /**
557e3b55780SDimitry Andric  * Traverses the translation unit to create a \c CXAPISet.
558e3b55780SDimitry Andric  *
559e3b55780SDimitry Andric  * \param tu is the \c CXTranslationUnit to build the \c CXAPISet for.
560e3b55780SDimitry Andric  *
561e3b55780SDimitry Andric  * \param out_api is a pointer to the output of this function. It is needs to be
562e3b55780SDimitry Andric  * disposed of by calling clang_disposeAPISet.
563e3b55780SDimitry Andric  *
564e3b55780SDimitry Andric  * \returns Error code indicating success or failure of the APISet creation.
565e3b55780SDimitry Andric  */
566e3b55780SDimitry Andric CINDEX_LINKAGE enum CXErrorCode clang_createAPISet(CXTranslationUnit tu,
567e3b55780SDimitry Andric                                                    CXAPISet *out_api);
568e3b55780SDimitry Andric 
569e3b55780SDimitry Andric /**
570e3b55780SDimitry Andric  * Dispose of an APISet.
571e3b55780SDimitry Andric  *
572e3b55780SDimitry Andric  * The provided \c CXAPISet can not be used after this function is called.
573e3b55780SDimitry Andric  */
574e3b55780SDimitry Andric CINDEX_LINKAGE void clang_disposeAPISet(CXAPISet api);
575e3b55780SDimitry Andric 
576e3b55780SDimitry Andric /**
577e3b55780SDimitry Andric  * Generate a single symbol symbol graph for the given USR. Returns a null
578e3b55780SDimitry Andric  * string if the associated symbol can not be found in the provided \c CXAPISet.
579e3b55780SDimitry Andric  *
580e3b55780SDimitry Andric  * The output contains the symbol graph as well as some additional information
581e3b55780SDimitry Andric  * about related symbols.
582e3b55780SDimitry Andric  *
583e3b55780SDimitry Andric  * \param usr is a string containing the USR of the symbol to generate the
584e3b55780SDimitry Andric  * symbol graph for.
585e3b55780SDimitry Andric  *
586e3b55780SDimitry Andric  * \param api the \c CXAPISet to look for the symbol in.
587e3b55780SDimitry Andric  *
588e3b55780SDimitry Andric  * \returns a string containing the serialized symbol graph representation for
589e3b55780SDimitry Andric  * the symbol being queried or a null string if it can not be found in the
590e3b55780SDimitry Andric  * APISet.
591e3b55780SDimitry Andric  */
592e3b55780SDimitry Andric CINDEX_LINKAGE CXString clang_getSymbolGraphForUSR(const char *usr,
593e3b55780SDimitry Andric                                                    CXAPISet api);
594e3b55780SDimitry Andric 
595e3b55780SDimitry Andric /**
596e3b55780SDimitry Andric  * Generate a single symbol symbol graph for the declaration at the given
597e3b55780SDimitry Andric  * cursor. Returns a null string if the AST node for the cursor isn't a
598e3b55780SDimitry Andric  * declaration.
599e3b55780SDimitry Andric  *
600e3b55780SDimitry Andric  * The output contains the symbol graph as well as some additional information
601e3b55780SDimitry Andric  * about related symbols.
602e3b55780SDimitry Andric  *
603e3b55780SDimitry Andric  * \param cursor the declaration for which to generate the single symbol symbol
604e3b55780SDimitry Andric  * graph.
605e3b55780SDimitry Andric  *
606e3b55780SDimitry Andric  * \returns a string containing the serialized symbol graph representation for
607e3b55780SDimitry Andric  * the symbol being queried or a null string if it can not be found in the
608e3b55780SDimitry Andric  * APISet.
609e3b55780SDimitry Andric  */
610e3b55780SDimitry Andric CINDEX_LINKAGE CXString clang_getSymbolGraphForCursor(CXCursor cursor);
611e3b55780SDimitry Andric 
612e3b55780SDimitry Andric /**
6139f4dbff6SDimitry Andric  * @}
6149f4dbff6SDimitry Andric  */
6159f4dbff6SDimitry Andric 
616706b4fc4SDimitry Andric LLVM_CLANG_C_EXTERN_C_END
6179f4dbff6SDimitry Andric 
6189f4dbff6SDimitry Andric #endif /* CLANG_C_DOCUMENTATION_H */
6199f4dbff6SDimitry Andric 
620