1e5dd7070Spatrick /*==-- clang-c/Documentation.h - Utilities for comment processing -*- C -*-===*\ 2e5dd7070Spatrick |* *| 3e5dd7070Spatrick |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| 4e5dd7070Spatrick |* Exceptions. *| 5e5dd7070Spatrick |* See https://llvm.org/LICENSE.txt for license information. *| 6e5dd7070Spatrick |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| 7e5dd7070Spatrick |* *| 8e5dd7070Spatrick |*===----------------------------------------------------------------------===*| 9e5dd7070Spatrick |* *| 10e5dd7070Spatrick |* This header provides a supplementary interface for inspecting *| 11e5dd7070Spatrick |* documentation comments. *| 12e5dd7070Spatrick |* *| 13e5dd7070Spatrick \*===----------------------------------------------------------------------===*/ 14e5dd7070Spatrick 15e5dd7070Spatrick #ifndef LLVM_CLANG_C_DOCUMENTATION_H 16e5dd7070Spatrick #define LLVM_CLANG_C_DOCUMENTATION_H 17e5dd7070Spatrick 18*12c85518Srobert #include "clang-c/CXErrorCode.h" 19e5dd7070Spatrick #include "clang-c/ExternC.h" 20e5dd7070Spatrick #include "clang-c/Index.h" 21e5dd7070Spatrick 22e5dd7070Spatrick LLVM_CLANG_C_EXTERN_C_BEGIN 23e5dd7070Spatrick 24e5dd7070Spatrick /** 25e5dd7070Spatrick * \defgroup CINDEX_COMMENT Comment introspection 26e5dd7070Spatrick * 27e5dd7070Spatrick * The routines in this group provide access to information in documentation 28e5dd7070Spatrick * comments. These facilities are distinct from the core and may be subject to 29e5dd7070Spatrick * their own schedule of stability and deprecation. 30e5dd7070Spatrick * 31e5dd7070Spatrick * @{ 32e5dd7070Spatrick */ 33e5dd7070Spatrick 34e5dd7070Spatrick /** 35e5dd7070Spatrick * A parsed comment. 36e5dd7070Spatrick */ 37e5dd7070Spatrick typedef struct { 38e5dd7070Spatrick const void *ASTNode; 39e5dd7070Spatrick CXTranslationUnit TranslationUnit; 40e5dd7070Spatrick } CXComment; 41e5dd7070Spatrick 42e5dd7070Spatrick /** 43e5dd7070Spatrick * Given a cursor that represents a documentable entity (e.g., 44e5dd7070Spatrick * declaration), return the associated parsed comment as a 45e5dd7070Spatrick * \c CXComment_FullComment AST node. 46e5dd7070Spatrick */ 47e5dd7070Spatrick CINDEX_LINKAGE CXComment clang_Cursor_getParsedComment(CXCursor C); 48e5dd7070Spatrick 49e5dd7070Spatrick /** 50e5dd7070Spatrick * Describes the type of the comment AST node (\c CXComment). A comment 51e5dd7070Spatrick * node can be considered block content (e. g., paragraph), inline content 52e5dd7070Spatrick * (plain text) or neither (the root AST node). 53e5dd7070Spatrick */ 54e5dd7070Spatrick enum CXCommentKind { 55e5dd7070Spatrick /** 56e5dd7070Spatrick * Null comment. No AST node is constructed at the requested location 57e5dd7070Spatrick * because there is no text or a syntax error. 58e5dd7070Spatrick */ 59e5dd7070Spatrick CXComment_Null = 0, 60e5dd7070Spatrick 61e5dd7070Spatrick /** 62e5dd7070Spatrick * Plain text. Inline content. 63e5dd7070Spatrick */ 64e5dd7070Spatrick CXComment_Text = 1, 65e5dd7070Spatrick 66e5dd7070Spatrick /** 67e5dd7070Spatrick * A command with word-like arguments that is considered inline content. 68e5dd7070Spatrick * 69e5dd7070Spatrick * For example: \\c command. 70e5dd7070Spatrick */ 71e5dd7070Spatrick CXComment_InlineCommand = 2, 72e5dd7070Spatrick 73e5dd7070Spatrick /** 74e5dd7070Spatrick * HTML start tag with attributes (name-value pairs). Considered 75e5dd7070Spatrick * inline content. 76e5dd7070Spatrick * 77e5dd7070Spatrick * For example: 78e5dd7070Spatrick * \verbatim 79e5dd7070Spatrick * <br> <br /> <a href="http://example.org/"> 80e5dd7070Spatrick * \endverbatim 81e5dd7070Spatrick */ 82e5dd7070Spatrick CXComment_HTMLStartTag = 3, 83e5dd7070Spatrick 84e5dd7070Spatrick /** 85e5dd7070Spatrick * HTML end tag. Considered inline content. 86e5dd7070Spatrick * 87e5dd7070Spatrick * For example: 88e5dd7070Spatrick * \verbatim 89e5dd7070Spatrick * </a> 90e5dd7070Spatrick * \endverbatim 91e5dd7070Spatrick */ 92e5dd7070Spatrick CXComment_HTMLEndTag = 4, 93e5dd7070Spatrick 94e5dd7070Spatrick /** 95e5dd7070Spatrick * A paragraph, contains inline comment. The paragraph itself is 96e5dd7070Spatrick * block content. 97e5dd7070Spatrick */ 98e5dd7070Spatrick CXComment_Paragraph = 5, 99e5dd7070Spatrick 100e5dd7070Spatrick /** 101e5dd7070Spatrick * A command that has zero or more word-like arguments (number of 102e5dd7070Spatrick * word-like arguments depends on command name) and a paragraph as an 103e5dd7070Spatrick * argument. Block command is block content. 104e5dd7070Spatrick * 105e5dd7070Spatrick * Paragraph argument is also a child of the block command. 106e5dd7070Spatrick * 107e5dd7070Spatrick * For example: \has 0 word-like arguments and a paragraph argument. 108e5dd7070Spatrick * 109e5dd7070Spatrick * AST nodes of special kinds that parser knows about (e. g., \\param 110e5dd7070Spatrick * command) have their own node kinds. 111e5dd7070Spatrick */ 112e5dd7070Spatrick CXComment_BlockCommand = 6, 113e5dd7070Spatrick 114e5dd7070Spatrick /** 115e5dd7070Spatrick * A \\param or \\arg command that describes the function parameter 116e5dd7070Spatrick * (name, passing direction, description). 117e5dd7070Spatrick * 118e5dd7070Spatrick * For example: \\param [in] ParamName description. 119e5dd7070Spatrick */ 120e5dd7070Spatrick CXComment_ParamCommand = 7, 121e5dd7070Spatrick 122e5dd7070Spatrick /** 123e5dd7070Spatrick * A \\tparam command that describes a template parameter (name and 124e5dd7070Spatrick * description). 125e5dd7070Spatrick * 126e5dd7070Spatrick * For example: \\tparam T description. 127e5dd7070Spatrick */ 128e5dd7070Spatrick CXComment_TParamCommand = 8, 129e5dd7070Spatrick 130e5dd7070Spatrick /** 131e5dd7070Spatrick * A verbatim block command (e. g., preformatted code). Verbatim 132e5dd7070Spatrick * block has an opening and a closing command and contains multiple lines of 133e5dd7070Spatrick * text (\c CXComment_VerbatimBlockLine child nodes). 134e5dd7070Spatrick * 135e5dd7070Spatrick * For example: 136e5dd7070Spatrick * \\verbatim 137e5dd7070Spatrick * aaa 138e5dd7070Spatrick * \\endverbatim 139e5dd7070Spatrick */ 140e5dd7070Spatrick CXComment_VerbatimBlockCommand = 9, 141e5dd7070Spatrick 142e5dd7070Spatrick /** 143e5dd7070Spatrick * A line of text that is contained within a 144e5dd7070Spatrick * CXComment_VerbatimBlockCommand node. 145e5dd7070Spatrick */ 146e5dd7070Spatrick CXComment_VerbatimBlockLine = 10, 147e5dd7070Spatrick 148e5dd7070Spatrick /** 149e5dd7070Spatrick * A verbatim line command. Verbatim line has an opening command, 150e5dd7070Spatrick * a single line of text (up to the newline after the opening command) and 151e5dd7070Spatrick * has no closing command. 152e5dd7070Spatrick */ 153e5dd7070Spatrick CXComment_VerbatimLine = 11, 154e5dd7070Spatrick 155e5dd7070Spatrick /** 156e5dd7070Spatrick * A full comment attached to a declaration, contains block content. 157e5dd7070Spatrick */ 158e5dd7070Spatrick CXComment_FullComment = 12 159e5dd7070Spatrick }; 160e5dd7070Spatrick 161e5dd7070Spatrick /** 162e5dd7070Spatrick * The most appropriate rendering mode for an inline command, chosen on 163e5dd7070Spatrick * command semantics in Doxygen. 164e5dd7070Spatrick */ 165e5dd7070Spatrick enum CXCommentInlineCommandRenderKind { 166e5dd7070Spatrick /** 167e5dd7070Spatrick * Command argument should be rendered in a normal font. 168e5dd7070Spatrick */ 169e5dd7070Spatrick CXCommentInlineCommandRenderKind_Normal, 170e5dd7070Spatrick 171e5dd7070Spatrick /** 172e5dd7070Spatrick * Command argument should be rendered in a bold font. 173e5dd7070Spatrick */ 174e5dd7070Spatrick CXCommentInlineCommandRenderKind_Bold, 175e5dd7070Spatrick 176e5dd7070Spatrick /** 177e5dd7070Spatrick * Command argument should be rendered in a monospaced font. 178e5dd7070Spatrick */ 179e5dd7070Spatrick CXCommentInlineCommandRenderKind_Monospaced, 180e5dd7070Spatrick 181e5dd7070Spatrick /** 182e5dd7070Spatrick * Command argument should be rendered emphasized (typically italic 183e5dd7070Spatrick * font). 184e5dd7070Spatrick */ 185e5dd7070Spatrick CXCommentInlineCommandRenderKind_Emphasized, 186e5dd7070Spatrick 187e5dd7070Spatrick /** 188e5dd7070Spatrick * Command argument should not be rendered (since it only defines an anchor). 189e5dd7070Spatrick */ 190e5dd7070Spatrick CXCommentInlineCommandRenderKind_Anchor 191e5dd7070Spatrick }; 192e5dd7070Spatrick 193e5dd7070Spatrick /** 194e5dd7070Spatrick * Describes parameter passing direction for \\param or \\arg command. 195e5dd7070Spatrick */ 196e5dd7070Spatrick enum CXCommentParamPassDirection { 197e5dd7070Spatrick /** 198e5dd7070Spatrick * The parameter is an input parameter. 199e5dd7070Spatrick */ 200e5dd7070Spatrick CXCommentParamPassDirection_In, 201e5dd7070Spatrick 202e5dd7070Spatrick /** 203e5dd7070Spatrick * The parameter is an output parameter. 204e5dd7070Spatrick */ 205e5dd7070Spatrick CXCommentParamPassDirection_Out, 206e5dd7070Spatrick 207e5dd7070Spatrick /** 208e5dd7070Spatrick * The parameter is an input and output parameter. 209e5dd7070Spatrick */ 210e5dd7070Spatrick CXCommentParamPassDirection_InOut 211e5dd7070Spatrick }; 212e5dd7070Spatrick 213e5dd7070Spatrick /** 214e5dd7070Spatrick * \param Comment AST node of any kind. 215e5dd7070Spatrick * 216e5dd7070Spatrick * \returns the type of the AST node. 217e5dd7070Spatrick */ 218e5dd7070Spatrick CINDEX_LINKAGE enum CXCommentKind clang_Comment_getKind(CXComment Comment); 219e5dd7070Spatrick 220e5dd7070Spatrick /** 221e5dd7070Spatrick * \param Comment AST node of any kind. 222e5dd7070Spatrick * 223e5dd7070Spatrick * \returns number of children of the AST node. 224e5dd7070Spatrick */ 225e5dd7070Spatrick CINDEX_LINKAGE unsigned clang_Comment_getNumChildren(CXComment Comment); 226e5dd7070Spatrick 227e5dd7070Spatrick /** 228e5dd7070Spatrick * \param Comment AST node of any kind. 229e5dd7070Spatrick * 230e5dd7070Spatrick * \param ChildIdx child index (zero-based). 231e5dd7070Spatrick * 232e5dd7070Spatrick * \returns the specified child of the AST node. 233e5dd7070Spatrick */ 234e5dd7070Spatrick CINDEX_LINKAGE 235e5dd7070Spatrick CXComment clang_Comment_getChild(CXComment Comment, unsigned ChildIdx); 236e5dd7070Spatrick 237e5dd7070Spatrick /** 238e5dd7070Spatrick * A \c CXComment_Paragraph node is considered whitespace if it contains 239e5dd7070Spatrick * only \c CXComment_Text nodes that are empty or whitespace. 240e5dd7070Spatrick * 241e5dd7070Spatrick * Other AST nodes (except \c CXComment_Paragraph and \c CXComment_Text) are 242e5dd7070Spatrick * never considered whitespace. 243e5dd7070Spatrick * 244e5dd7070Spatrick * \returns non-zero if \c Comment is whitespace. 245e5dd7070Spatrick */ 246e5dd7070Spatrick CINDEX_LINKAGE unsigned clang_Comment_isWhitespace(CXComment Comment); 247e5dd7070Spatrick 248e5dd7070Spatrick /** 249e5dd7070Spatrick * \returns non-zero if \c Comment is inline content and has a newline 250e5dd7070Spatrick * immediately following it in the comment text. Newlines between paragraphs 251e5dd7070Spatrick * do not count. 252e5dd7070Spatrick */ 253e5dd7070Spatrick CINDEX_LINKAGE 254e5dd7070Spatrick unsigned clang_InlineContentComment_hasTrailingNewline(CXComment Comment); 255e5dd7070Spatrick 256e5dd7070Spatrick /** 257e5dd7070Spatrick * \param Comment a \c CXComment_Text AST node. 258e5dd7070Spatrick * 259e5dd7070Spatrick * \returns text contained in the AST node. 260e5dd7070Spatrick */ 261e5dd7070Spatrick CINDEX_LINKAGE CXString clang_TextComment_getText(CXComment Comment); 262e5dd7070Spatrick 263e5dd7070Spatrick /** 264e5dd7070Spatrick * \param Comment a \c CXComment_InlineCommand AST node. 265e5dd7070Spatrick * 266e5dd7070Spatrick * \returns name of the inline command. 267e5dd7070Spatrick */ 268e5dd7070Spatrick CINDEX_LINKAGE 269e5dd7070Spatrick CXString clang_InlineCommandComment_getCommandName(CXComment Comment); 270e5dd7070Spatrick 271e5dd7070Spatrick /** 272e5dd7070Spatrick * \param Comment a \c CXComment_InlineCommand AST node. 273e5dd7070Spatrick * 274e5dd7070Spatrick * \returns the most appropriate rendering mode, chosen on command 275e5dd7070Spatrick * semantics in Doxygen. 276e5dd7070Spatrick */ 277e5dd7070Spatrick CINDEX_LINKAGE enum CXCommentInlineCommandRenderKind 278e5dd7070Spatrick clang_InlineCommandComment_getRenderKind(CXComment Comment); 279e5dd7070Spatrick 280e5dd7070Spatrick /** 281e5dd7070Spatrick * \param Comment a \c CXComment_InlineCommand AST node. 282e5dd7070Spatrick * 283e5dd7070Spatrick * \returns number of command arguments. 284e5dd7070Spatrick */ 285e5dd7070Spatrick CINDEX_LINKAGE 286e5dd7070Spatrick unsigned clang_InlineCommandComment_getNumArgs(CXComment Comment); 287e5dd7070Spatrick 288e5dd7070Spatrick /** 289e5dd7070Spatrick * \param Comment a \c CXComment_InlineCommand AST node. 290e5dd7070Spatrick * 291e5dd7070Spatrick * \param ArgIdx argument index (zero-based). 292e5dd7070Spatrick * 293e5dd7070Spatrick * \returns text of the specified argument. 294e5dd7070Spatrick */ 295e5dd7070Spatrick CINDEX_LINKAGE 296e5dd7070Spatrick CXString clang_InlineCommandComment_getArgText(CXComment Comment, 297e5dd7070Spatrick unsigned ArgIdx); 298e5dd7070Spatrick 299e5dd7070Spatrick /** 300e5dd7070Spatrick * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST 301e5dd7070Spatrick * node. 302e5dd7070Spatrick * 303e5dd7070Spatrick * \returns HTML tag name. 304e5dd7070Spatrick */ 305e5dd7070Spatrick CINDEX_LINKAGE CXString clang_HTMLTagComment_getTagName(CXComment Comment); 306e5dd7070Spatrick 307e5dd7070Spatrick /** 308e5dd7070Spatrick * \param Comment a \c CXComment_HTMLStartTag AST node. 309e5dd7070Spatrick * 310e5dd7070Spatrick * \returns non-zero if tag is self-closing (for example, <br />). 311e5dd7070Spatrick */ 312e5dd7070Spatrick CINDEX_LINKAGE 313e5dd7070Spatrick unsigned clang_HTMLStartTagComment_isSelfClosing(CXComment Comment); 314e5dd7070Spatrick 315e5dd7070Spatrick /** 316e5dd7070Spatrick * \param Comment a \c CXComment_HTMLStartTag AST node. 317e5dd7070Spatrick * 318e5dd7070Spatrick * \returns number of attributes (name-value pairs) attached to the start tag. 319e5dd7070Spatrick */ 320e5dd7070Spatrick CINDEX_LINKAGE unsigned clang_HTMLStartTag_getNumAttrs(CXComment Comment); 321e5dd7070Spatrick 322e5dd7070Spatrick /** 323e5dd7070Spatrick * \param Comment a \c CXComment_HTMLStartTag AST node. 324e5dd7070Spatrick * 325e5dd7070Spatrick * \param AttrIdx attribute index (zero-based). 326e5dd7070Spatrick * 327e5dd7070Spatrick * \returns name of the specified attribute. 328e5dd7070Spatrick */ 329e5dd7070Spatrick CINDEX_LINKAGE 330e5dd7070Spatrick CXString clang_HTMLStartTag_getAttrName(CXComment Comment, unsigned AttrIdx); 331e5dd7070Spatrick 332e5dd7070Spatrick /** 333e5dd7070Spatrick * \param Comment a \c CXComment_HTMLStartTag AST node. 334e5dd7070Spatrick * 335e5dd7070Spatrick * \param AttrIdx attribute index (zero-based). 336e5dd7070Spatrick * 337e5dd7070Spatrick * \returns value of the specified attribute. 338e5dd7070Spatrick */ 339e5dd7070Spatrick CINDEX_LINKAGE 340e5dd7070Spatrick CXString clang_HTMLStartTag_getAttrValue(CXComment Comment, unsigned AttrIdx); 341e5dd7070Spatrick 342e5dd7070Spatrick /** 343e5dd7070Spatrick * \param Comment a \c CXComment_BlockCommand AST node. 344e5dd7070Spatrick * 345e5dd7070Spatrick * \returns name of the block command. 346e5dd7070Spatrick */ 347e5dd7070Spatrick CINDEX_LINKAGE 348e5dd7070Spatrick CXString clang_BlockCommandComment_getCommandName(CXComment Comment); 349e5dd7070Spatrick 350e5dd7070Spatrick /** 351e5dd7070Spatrick * \param Comment a \c CXComment_BlockCommand AST node. 352e5dd7070Spatrick * 353e5dd7070Spatrick * \returns number of word-like arguments. 354e5dd7070Spatrick */ 355e5dd7070Spatrick CINDEX_LINKAGE 356e5dd7070Spatrick unsigned clang_BlockCommandComment_getNumArgs(CXComment Comment); 357e5dd7070Spatrick 358e5dd7070Spatrick /** 359e5dd7070Spatrick * \param Comment a \c CXComment_BlockCommand AST node. 360e5dd7070Spatrick * 361e5dd7070Spatrick * \param ArgIdx argument index (zero-based). 362e5dd7070Spatrick * 363e5dd7070Spatrick * \returns text of the specified word-like argument. 364e5dd7070Spatrick */ 365e5dd7070Spatrick CINDEX_LINKAGE 366e5dd7070Spatrick CXString clang_BlockCommandComment_getArgText(CXComment Comment, 367e5dd7070Spatrick unsigned ArgIdx); 368e5dd7070Spatrick 369e5dd7070Spatrick /** 370e5dd7070Spatrick * \param Comment a \c CXComment_BlockCommand or 371e5dd7070Spatrick * \c CXComment_VerbatimBlockCommand AST node. 372e5dd7070Spatrick * 373e5dd7070Spatrick * \returns paragraph argument of the block command. 374e5dd7070Spatrick */ 375e5dd7070Spatrick CINDEX_LINKAGE 376e5dd7070Spatrick CXComment clang_BlockCommandComment_getParagraph(CXComment Comment); 377e5dd7070Spatrick 378e5dd7070Spatrick /** 379e5dd7070Spatrick * \param Comment a \c CXComment_ParamCommand AST node. 380e5dd7070Spatrick * 381e5dd7070Spatrick * \returns parameter name. 382e5dd7070Spatrick */ 383e5dd7070Spatrick CINDEX_LINKAGE 384e5dd7070Spatrick CXString clang_ParamCommandComment_getParamName(CXComment Comment); 385e5dd7070Spatrick 386e5dd7070Spatrick /** 387e5dd7070Spatrick * \param Comment a \c CXComment_ParamCommand AST node. 388e5dd7070Spatrick * 389e5dd7070Spatrick * \returns non-zero if the parameter that this AST node represents was found 390e5dd7070Spatrick * in the function prototype and \c clang_ParamCommandComment_getParamIndex 391e5dd7070Spatrick * function will return a meaningful value. 392e5dd7070Spatrick */ 393e5dd7070Spatrick CINDEX_LINKAGE 394e5dd7070Spatrick unsigned clang_ParamCommandComment_isParamIndexValid(CXComment Comment); 395e5dd7070Spatrick 396e5dd7070Spatrick /** 397e5dd7070Spatrick * \param Comment a \c CXComment_ParamCommand AST node. 398e5dd7070Spatrick * 399e5dd7070Spatrick * \returns zero-based parameter index in function prototype. 400e5dd7070Spatrick */ 401e5dd7070Spatrick CINDEX_LINKAGE 402e5dd7070Spatrick unsigned clang_ParamCommandComment_getParamIndex(CXComment Comment); 403e5dd7070Spatrick 404e5dd7070Spatrick /** 405e5dd7070Spatrick * \param Comment a \c CXComment_ParamCommand AST node. 406e5dd7070Spatrick * 407e5dd7070Spatrick * \returns non-zero if parameter passing direction was specified explicitly in 408e5dd7070Spatrick * the comment. 409e5dd7070Spatrick */ 410e5dd7070Spatrick CINDEX_LINKAGE 411e5dd7070Spatrick unsigned clang_ParamCommandComment_isDirectionExplicit(CXComment Comment); 412e5dd7070Spatrick 413e5dd7070Spatrick /** 414e5dd7070Spatrick * \param Comment a \c CXComment_ParamCommand AST node. 415e5dd7070Spatrick * 416e5dd7070Spatrick * \returns parameter passing direction. 417e5dd7070Spatrick */ 418e5dd7070Spatrick CINDEX_LINKAGE 419e5dd7070Spatrick enum CXCommentParamPassDirection clang_ParamCommandComment_getDirection( 420e5dd7070Spatrick CXComment Comment); 421e5dd7070Spatrick 422e5dd7070Spatrick /** 423e5dd7070Spatrick * \param Comment a \c CXComment_TParamCommand AST node. 424e5dd7070Spatrick * 425e5dd7070Spatrick * \returns template parameter name. 426e5dd7070Spatrick */ 427e5dd7070Spatrick CINDEX_LINKAGE 428e5dd7070Spatrick CXString clang_TParamCommandComment_getParamName(CXComment Comment); 429e5dd7070Spatrick 430e5dd7070Spatrick /** 431e5dd7070Spatrick * \param Comment a \c CXComment_TParamCommand AST node. 432e5dd7070Spatrick * 433e5dd7070Spatrick * \returns non-zero if the parameter that this AST node represents was found 434e5dd7070Spatrick * in the template parameter list and 435e5dd7070Spatrick * \c clang_TParamCommandComment_getDepth and 436e5dd7070Spatrick * \c clang_TParamCommandComment_getIndex functions will return a meaningful 437e5dd7070Spatrick * value. 438e5dd7070Spatrick */ 439e5dd7070Spatrick CINDEX_LINKAGE 440e5dd7070Spatrick unsigned clang_TParamCommandComment_isParamPositionValid(CXComment Comment); 441e5dd7070Spatrick 442e5dd7070Spatrick /** 443e5dd7070Spatrick * \param Comment a \c CXComment_TParamCommand AST node. 444e5dd7070Spatrick * 445e5dd7070Spatrick * \returns zero-based nesting depth of this parameter in the template parameter list. 446e5dd7070Spatrick * 447e5dd7070Spatrick * For example, 448e5dd7070Spatrick * \verbatim 449e5dd7070Spatrick * template<typename C, template<typename T> class TT> 450e5dd7070Spatrick * void test(TT<int> aaa); 451e5dd7070Spatrick * \endverbatim 452e5dd7070Spatrick * for C and TT nesting depth is 0, 453e5dd7070Spatrick * for T nesting depth is 1. 454e5dd7070Spatrick */ 455e5dd7070Spatrick CINDEX_LINKAGE 456e5dd7070Spatrick unsigned clang_TParamCommandComment_getDepth(CXComment Comment); 457e5dd7070Spatrick 458e5dd7070Spatrick /** 459e5dd7070Spatrick * \param Comment a \c CXComment_TParamCommand AST node. 460e5dd7070Spatrick * 461e5dd7070Spatrick * \returns zero-based parameter index in the template parameter list at a 462e5dd7070Spatrick * given nesting depth. 463e5dd7070Spatrick * 464e5dd7070Spatrick * For example, 465e5dd7070Spatrick * \verbatim 466e5dd7070Spatrick * template<typename C, template<typename T> class TT> 467e5dd7070Spatrick * void test(TT<int> aaa); 468e5dd7070Spatrick * \endverbatim 469e5dd7070Spatrick * for C and TT nesting depth is 0, so we can ask for index at depth 0: 470e5dd7070Spatrick * at depth 0 C's index is 0, TT's index is 1. 471e5dd7070Spatrick * 472e5dd7070Spatrick * For T nesting depth is 1, so we can ask for index at depth 0 and 1: 473e5dd7070Spatrick * at depth 0 T's index is 1 (same as TT's), 474e5dd7070Spatrick * at depth 1 T's index is 0. 475e5dd7070Spatrick */ 476e5dd7070Spatrick CINDEX_LINKAGE 477e5dd7070Spatrick unsigned clang_TParamCommandComment_getIndex(CXComment Comment, unsigned Depth); 478e5dd7070Spatrick 479e5dd7070Spatrick /** 480e5dd7070Spatrick * \param Comment a \c CXComment_VerbatimBlockLine AST node. 481e5dd7070Spatrick * 482e5dd7070Spatrick * \returns text contained in the AST node. 483e5dd7070Spatrick */ 484e5dd7070Spatrick CINDEX_LINKAGE 485e5dd7070Spatrick CXString clang_VerbatimBlockLineComment_getText(CXComment Comment); 486e5dd7070Spatrick 487e5dd7070Spatrick /** 488e5dd7070Spatrick * \param Comment a \c CXComment_VerbatimLine AST node. 489e5dd7070Spatrick * 490e5dd7070Spatrick * \returns text contained in the AST node. 491e5dd7070Spatrick */ 492e5dd7070Spatrick CINDEX_LINKAGE CXString clang_VerbatimLineComment_getText(CXComment Comment); 493e5dd7070Spatrick 494e5dd7070Spatrick /** 495e5dd7070Spatrick * Convert an HTML tag AST node to string. 496e5dd7070Spatrick * 497e5dd7070Spatrick * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST 498e5dd7070Spatrick * node. 499e5dd7070Spatrick * 500e5dd7070Spatrick * \returns string containing an HTML tag. 501e5dd7070Spatrick */ 502e5dd7070Spatrick CINDEX_LINKAGE CXString clang_HTMLTagComment_getAsString(CXComment Comment); 503e5dd7070Spatrick 504e5dd7070Spatrick /** 505e5dd7070Spatrick * Convert a given full parsed comment to an HTML fragment. 506e5dd7070Spatrick * 507e5dd7070Spatrick * Specific details of HTML layout are subject to change. Don't try to parse 508e5dd7070Spatrick * this HTML back into an AST, use other APIs instead. 509e5dd7070Spatrick * 510e5dd7070Spatrick * Currently the following CSS classes are used: 511e5dd7070Spatrick * \li "para-brief" for \paragraph and equivalent commands; 512e5dd7070Spatrick * \li "para-returns" for \\returns paragraph and equivalent commands; 513e5dd7070Spatrick * \li "word-returns" for the "Returns" word in \\returns paragraph. 514e5dd7070Spatrick * 515e5dd7070Spatrick * Function argument documentation is rendered as a \<dl\> list with arguments 516e5dd7070Spatrick * sorted in function prototype order. CSS classes used: 517e5dd7070Spatrick * \li "param-name-index-NUMBER" for parameter name (\<dt\>); 518e5dd7070Spatrick * \li "param-descr-index-NUMBER" for parameter description (\<dd\>); 519e5dd7070Spatrick * \li "param-name-index-invalid" and "param-descr-index-invalid" are used if 520e5dd7070Spatrick * parameter index is invalid. 521e5dd7070Spatrick * 522e5dd7070Spatrick * Template parameter documentation is rendered as a \<dl\> list with 523e5dd7070Spatrick * parameters sorted in template parameter list order. CSS classes used: 524e5dd7070Spatrick * \li "tparam-name-index-NUMBER" for parameter name (\<dt\>); 525e5dd7070Spatrick * \li "tparam-descr-index-NUMBER" for parameter description (\<dd\>); 526e5dd7070Spatrick * \li "tparam-name-index-other" and "tparam-descr-index-other" are used for 527e5dd7070Spatrick * names inside template template parameters; 528e5dd7070Spatrick * \li "tparam-name-index-invalid" and "tparam-descr-index-invalid" are used if 529e5dd7070Spatrick * parameter position is invalid. 530e5dd7070Spatrick * 531e5dd7070Spatrick * \param Comment a \c CXComment_FullComment AST node. 532e5dd7070Spatrick * 533e5dd7070Spatrick * \returns string containing an HTML fragment. 534e5dd7070Spatrick */ 535e5dd7070Spatrick CINDEX_LINKAGE CXString clang_FullComment_getAsHTML(CXComment Comment); 536e5dd7070Spatrick 537e5dd7070Spatrick /** 538e5dd7070Spatrick * Convert a given full parsed comment to an XML document. 539e5dd7070Spatrick * 540e5dd7070Spatrick * A Relax NG schema for the XML can be found in comment-xml-schema.rng file 541e5dd7070Spatrick * inside clang source tree. 542e5dd7070Spatrick * 543e5dd7070Spatrick * \param Comment a \c CXComment_FullComment AST node. 544e5dd7070Spatrick * 545e5dd7070Spatrick * \returns string containing an XML document. 546e5dd7070Spatrick */ 547e5dd7070Spatrick CINDEX_LINKAGE CXString clang_FullComment_getAsXML(CXComment Comment); 548e5dd7070Spatrick 549e5dd7070Spatrick /** 550*12c85518Srobert * CXAPISet is an opaque type that represents a data structure containing all 551*12c85518Srobert * the API information for a given translation unit. This can be used for a 552*12c85518Srobert * single symbol symbol graph for a given symbol. 553*12c85518Srobert */ 554*12c85518Srobert typedef struct CXAPISetImpl *CXAPISet; 555*12c85518Srobert 556*12c85518Srobert /** 557*12c85518Srobert * Traverses the translation unit to create a \c CXAPISet. 558*12c85518Srobert * 559*12c85518Srobert * \param tu is the \c CXTranslationUnit to build the \c CXAPISet for. 560*12c85518Srobert * 561*12c85518Srobert * \param out_api is a pointer to the output of this function. It is needs to be 562*12c85518Srobert * disposed of by calling clang_disposeAPISet. 563*12c85518Srobert * 564*12c85518Srobert * \returns Error code indicating success or failure of the APISet creation. 565*12c85518Srobert */ 566*12c85518Srobert CINDEX_LINKAGE enum CXErrorCode clang_createAPISet(CXTranslationUnit tu, 567*12c85518Srobert CXAPISet *out_api); 568*12c85518Srobert 569*12c85518Srobert /** 570*12c85518Srobert * Dispose of an APISet. 571*12c85518Srobert * 572*12c85518Srobert * The provided \c CXAPISet can not be used after this function is called. 573*12c85518Srobert */ 574*12c85518Srobert CINDEX_LINKAGE void clang_disposeAPISet(CXAPISet api); 575*12c85518Srobert 576*12c85518Srobert /** 577*12c85518Srobert * Generate a single symbol symbol graph for the given USR. Returns a null 578*12c85518Srobert * string if the associated symbol can not be found in the provided \c CXAPISet. 579*12c85518Srobert * 580*12c85518Srobert * The output contains the symbol graph as well as some additional information 581*12c85518Srobert * about related symbols. 582*12c85518Srobert * 583*12c85518Srobert * \param usr is a string containing the USR of the symbol to generate the 584*12c85518Srobert * symbol graph for. 585*12c85518Srobert * 586*12c85518Srobert * \param api the \c CXAPISet to look for the symbol in. 587*12c85518Srobert * 588*12c85518Srobert * \returns a string containing the serialized symbol graph representation for 589*12c85518Srobert * the symbol being queried or a null string if it can not be found in the 590*12c85518Srobert * APISet. 591*12c85518Srobert */ 592*12c85518Srobert CINDEX_LINKAGE CXString clang_getSymbolGraphForUSR(const char *usr, 593*12c85518Srobert CXAPISet api); 594*12c85518Srobert 595*12c85518Srobert /** 596*12c85518Srobert * Generate a single symbol symbol graph for the declaration at the given 597*12c85518Srobert * cursor. Returns a null string if the AST node for the cursor isn't a 598*12c85518Srobert * declaration. 599*12c85518Srobert * 600*12c85518Srobert * The output contains the symbol graph as well as some additional information 601*12c85518Srobert * about related symbols. 602*12c85518Srobert * 603*12c85518Srobert * \param cursor the declaration for which to generate the single symbol symbol 604*12c85518Srobert * graph. 605*12c85518Srobert * 606*12c85518Srobert * \returns a string containing the serialized symbol graph representation for 607*12c85518Srobert * the symbol being queried or a null string if it can not be found in the 608*12c85518Srobert * APISet. 609*12c85518Srobert */ 610*12c85518Srobert CINDEX_LINKAGE CXString clang_getSymbolGraphForCursor(CXCursor cursor); 611*12c85518Srobert 612*12c85518Srobert /** 613e5dd7070Spatrick * @} 614e5dd7070Spatrick */ 615e5dd7070Spatrick 616e5dd7070Spatrick LLVM_CLANG_C_EXTERN_C_END 617e5dd7070Spatrick 618e5dd7070Spatrick #endif /* CLANG_C_DOCUMENTATION_H */ 619e5dd7070Spatrick 620