Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 1 | //===- CXComment.cpp - libclang APIs for manipulating CXComments ----------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines all libclang APIs related to walking comment AST. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "clang-c/Index.h" |
| 15 | #include "CXString.h" |
| 16 | #include "CXComment.h" |
| 17 | |
| 18 | #include "clang/AST/CommentVisitor.h" |
| 19 | |
| 20 | #include "llvm/Support/ErrorHandling.h" |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 21 | #include "llvm/Support/raw_ostream.h" |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 22 | |
Dmitri Gribenko | 221a6d7 | 2012-07-30 17:49:32 +0000 | [diff] [blame] | 23 | #include <climits> |
| 24 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 25 | using namespace clang; |
| 26 | using namespace clang::cxstring; |
| 27 | using namespace clang::comments; |
| 28 | using namespace clang::cxcomment; |
| 29 | |
| 30 | extern "C" { |
| 31 | |
| 32 | enum CXCommentKind clang_Comment_getKind(CXComment CXC) { |
| 33 | const Comment *C = getASTNode(CXC); |
| 34 | if (!C) |
| 35 | return CXComment_Null; |
| 36 | |
| 37 | switch (C->getCommentKind()) { |
| 38 | case Comment::NoCommentKind: |
| 39 | return CXComment_Null; |
| 40 | |
| 41 | case Comment::TextCommentKind: |
| 42 | return CXComment_Text; |
| 43 | |
| 44 | case Comment::InlineCommandCommentKind: |
| 45 | return CXComment_InlineCommand; |
| 46 | |
| 47 | case Comment::HTMLStartTagCommentKind: |
| 48 | return CXComment_HTMLStartTag; |
| 49 | |
| 50 | case Comment::HTMLEndTagCommentKind: |
| 51 | return CXComment_HTMLEndTag; |
| 52 | |
| 53 | case Comment::ParagraphCommentKind: |
| 54 | return CXComment_Paragraph; |
| 55 | |
| 56 | case Comment::BlockCommandCommentKind: |
| 57 | return CXComment_BlockCommand; |
| 58 | |
| 59 | case Comment::ParamCommandCommentKind: |
| 60 | return CXComment_ParamCommand; |
| 61 | |
Dmitri Gribenko | 96b0986 | 2012-07-31 22:37:06 +0000 | [diff] [blame^] | 62 | case Comment::TParamCommandCommentKind: |
| 63 | return CXComment_TParamCommand; |
| 64 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 65 | case Comment::VerbatimBlockCommentKind: |
| 66 | return CXComment_VerbatimBlockCommand; |
| 67 | |
| 68 | case Comment::VerbatimBlockLineCommentKind: |
| 69 | return CXComment_VerbatimBlockLine; |
| 70 | |
| 71 | case Comment::VerbatimLineCommentKind: |
| 72 | return CXComment_VerbatimLine; |
| 73 | |
| 74 | case Comment::FullCommentKind: |
| 75 | return CXComment_FullComment; |
| 76 | } |
| 77 | llvm_unreachable("unknown CommentKind"); |
| 78 | } |
| 79 | |
| 80 | unsigned clang_Comment_getNumChildren(CXComment CXC) { |
| 81 | const Comment *C = getASTNode(CXC); |
| 82 | if (!C) |
| 83 | return 0; |
| 84 | |
| 85 | return C->child_count(); |
| 86 | } |
| 87 | |
| 88 | CXComment clang_Comment_getChild(CXComment CXC, unsigned ChildIdx) { |
| 89 | const Comment *C = getASTNode(CXC); |
| 90 | if (!C || ChildIdx >= C->child_count()) |
| 91 | return createCXComment(NULL); |
| 92 | |
| 93 | return createCXComment(*(C->child_begin() + ChildIdx)); |
| 94 | } |
| 95 | |
| 96 | unsigned clang_Comment_isWhitespace(CXComment CXC) { |
| 97 | const Comment *C = getASTNode(CXC); |
| 98 | if (!C) |
| 99 | return false; |
| 100 | |
| 101 | if (const TextComment *TC = dyn_cast<TextComment>(C)) |
| 102 | return TC->isWhitespace(); |
| 103 | |
| 104 | if (const ParagraphComment *PC = dyn_cast<ParagraphComment>(C)) |
| 105 | return PC->isWhitespace(); |
| 106 | |
| 107 | return false; |
| 108 | } |
| 109 | |
| 110 | unsigned clang_InlineContentComment_hasTrailingNewline(CXComment CXC) { |
| 111 | const InlineContentComment *ICC = getASTNodeAs<InlineContentComment>(CXC); |
| 112 | if (!ICC) |
| 113 | return false; |
| 114 | |
| 115 | return ICC->hasTrailingNewline(); |
| 116 | } |
| 117 | |
| 118 | CXString clang_TextComment_getText(CXComment CXC) { |
| 119 | const TextComment *TC = getASTNodeAs<TextComment>(CXC); |
| 120 | if (!TC) |
| 121 | return createCXString((const char *) 0); |
| 122 | |
| 123 | return createCXString(TC->getText(), /*DupString=*/ false); |
| 124 | } |
| 125 | |
| 126 | CXString clang_InlineCommandComment_getCommandName(CXComment CXC) { |
| 127 | const InlineCommandComment *ICC = getASTNodeAs<InlineCommandComment>(CXC); |
| 128 | if (!ICC) |
| 129 | return createCXString((const char *) 0); |
| 130 | |
| 131 | return createCXString(ICC->getCommandName(), /*DupString=*/ false); |
| 132 | } |
| 133 | |
Dmitri Gribenko | 2d66a50 | 2012-07-23 16:43:01 +0000 | [diff] [blame] | 134 | enum CXCommentInlineCommandRenderKind |
| 135 | clang_InlineCommandComment_getRenderKind(CXComment CXC) { |
| 136 | const InlineCommandComment *ICC = getASTNodeAs<InlineCommandComment>(CXC); |
| 137 | if (!ICC) |
| 138 | return CXCommentInlineCommandRenderKind_Normal; |
| 139 | |
| 140 | switch (ICC->getRenderKind()) { |
| 141 | case InlineCommandComment::RenderNormal: |
| 142 | return CXCommentInlineCommandRenderKind_Normal; |
| 143 | |
| 144 | case InlineCommandComment::RenderBold: |
| 145 | return CXCommentInlineCommandRenderKind_Bold; |
| 146 | |
| 147 | case InlineCommandComment::RenderMonospaced: |
| 148 | return CXCommentInlineCommandRenderKind_Monospaced; |
| 149 | |
| 150 | case InlineCommandComment::RenderEmphasized: |
| 151 | return CXCommentInlineCommandRenderKind_Emphasized; |
| 152 | } |
| 153 | llvm_unreachable("unknown InlineCommandComment::RenderKind"); |
| 154 | } |
| 155 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 156 | unsigned clang_InlineCommandComment_getNumArgs(CXComment CXC) { |
| 157 | const InlineCommandComment *ICC = getASTNodeAs<InlineCommandComment>(CXC); |
| 158 | if (!ICC) |
| 159 | return 0; |
| 160 | |
| 161 | return ICC->getNumArgs(); |
| 162 | } |
| 163 | |
| 164 | CXString clang_InlineCommandComment_getArgText(CXComment CXC, |
| 165 | unsigned ArgIdx) { |
| 166 | const InlineCommandComment *ICC = getASTNodeAs<InlineCommandComment>(CXC); |
| 167 | if (!ICC || ArgIdx >= ICC->getNumArgs()) |
| 168 | return createCXString((const char *) 0); |
| 169 | |
| 170 | return createCXString(ICC->getArgText(ArgIdx), /*DupString=*/ false); |
| 171 | } |
| 172 | |
| 173 | CXString clang_HTMLTagComment_getTagName(CXComment CXC) { |
| 174 | const HTMLTagComment *HTC = getASTNodeAs<HTMLTagComment>(CXC); |
| 175 | if (!HTC) |
| 176 | return createCXString((const char *) 0); |
| 177 | |
| 178 | return createCXString(HTC->getTagName(), /*DupString=*/ false); |
| 179 | } |
| 180 | |
| 181 | unsigned clang_HTMLStartTagComment_isSelfClosing(CXComment CXC) { |
| 182 | const HTMLStartTagComment *HST = getASTNodeAs<HTMLStartTagComment>(CXC); |
| 183 | if (!HST) |
| 184 | return false; |
| 185 | |
| 186 | return HST->isSelfClosing(); |
| 187 | } |
| 188 | |
| 189 | unsigned clang_HTMLStartTag_getNumAttrs(CXComment CXC) { |
| 190 | const HTMLStartTagComment *HST = getASTNodeAs<HTMLStartTagComment>(CXC); |
| 191 | if (!HST) |
| 192 | return 0; |
| 193 | |
| 194 | return HST->getNumAttrs(); |
| 195 | } |
| 196 | |
| 197 | CXString clang_HTMLStartTag_getAttrName(CXComment CXC, unsigned AttrIdx) { |
| 198 | const HTMLStartTagComment *HST = getASTNodeAs<HTMLStartTagComment>(CXC); |
| 199 | if (!HST || AttrIdx >= HST->getNumAttrs()) |
| 200 | return createCXString((const char *) 0); |
| 201 | |
| 202 | return createCXString(HST->getAttr(AttrIdx).Name, /*DupString=*/ false); |
| 203 | } |
| 204 | |
| 205 | CXString clang_HTMLStartTag_getAttrValue(CXComment CXC, unsigned AttrIdx) { |
| 206 | const HTMLStartTagComment *HST = getASTNodeAs<HTMLStartTagComment>(CXC); |
| 207 | if (!HST || AttrIdx >= HST->getNumAttrs()) |
| 208 | return createCXString((const char *) 0); |
| 209 | |
| 210 | return createCXString(HST->getAttr(AttrIdx).Value, /*DupString=*/ false); |
| 211 | } |
| 212 | |
| 213 | CXString clang_BlockCommandComment_getCommandName(CXComment CXC) { |
| 214 | const BlockCommandComment *BCC = getASTNodeAs<BlockCommandComment>(CXC); |
| 215 | if (!BCC) |
| 216 | return createCXString((const char *) 0); |
| 217 | |
| 218 | return createCXString(BCC->getCommandName(), /*DupString=*/ false); |
| 219 | } |
| 220 | |
| 221 | unsigned clang_BlockCommandComment_getNumArgs(CXComment CXC) { |
| 222 | const BlockCommandComment *BCC = getASTNodeAs<BlockCommandComment>(CXC); |
| 223 | if (!BCC) |
| 224 | return 0; |
| 225 | |
| 226 | return BCC->getNumArgs(); |
| 227 | } |
| 228 | |
| 229 | CXString clang_BlockCommandComment_getArgText(CXComment CXC, |
| 230 | unsigned ArgIdx) { |
| 231 | const BlockCommandComment *BCC = getASTNodeAs<BlockCommandComment>(CXC); |
| 232 | if (!BCC || ArgIdx >= BCC->getNumArgs()) |
| 233 | return createCXString((const char *) 0); |
| 234 | |
| 235 | return createCXString(BCC->getArgText(ArgIdx), /*DupString=*/ false); |
| 236 | } |
| 237 | |
| 238 | CXComment clang_BlockCommandComment_getParagraph(CXComment CXC) { |
| 239 | const BlockCommandComment *BCC = getASTNodeAs<BlockCommandComment>(CXC); |
| 240 | if (!BCC) |
| 241 | return createCXComment(NULL); |
| 242 | |
| 243 | return createCXComment(BCC->getParagraph()); |
| 244 | } |
| 245 | |
| 246 | CXString clang_ParamCommandComment_getParamName(CXComment CXC) { |
| 247 | const ParamCommandComment *PCC = getASTNodeAs<ParamCommandComment>(CXC); |
Dmitri Gribenko | 1f8c529 | 2012-07-23 19:41:49 +0000 | [diff] [blame] | 248 | if (!PCC || !PCC->hasParamName()) |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 249 | return createCXString((const char *) 0); |
| 250 | |
| 251 | return createCXString(PCC->getParamName(), /*DupString=*/ false); |
| 252 | } |
| 253 | |
| 254 | unsigned clang_ParamCommandComment_isParamIndexValid(CXComment CXC) { |
| 255 | const ParamCommandComment *PCC = getASTNodeAs<ParamCommandComment>(CXC); |
| 256 | if (!PCC) |
| 257 | return false; |
| 258 | |
| 259 | return PCC->isParamIndexValid(); |
| 260 | } |
| 261 | |
| 262 | unsigned clang_ParamCommandComment_getParamIndex(CXComment CXC) { |
| 263 | const ParamCommandComment *PCC = getASTNodeAs<ParamCommandComment>(CXC); |
Dmitri Gribenko | b740316 | 2012-07-30 17:38:19 +0000 | [diff] [blame] | 264 | if (!PCC || !PCC->isParamIndexValid()) |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 265 | return ParamCommandComment::InvalidParamIndex; |
| 266 | |
| 267 | return PCC->getParamIndex(); |
| 268 | } |
| 269 | |
| 270 | unsigned clang_ParamCommandComment_isDirectionExplicit(CXComment CXC) { |
| 271 | const ParamCommandComment *PCC = getASTNodeAs<ParamCommandComment>(CXC); |
| 272 | if (!PCC) |
| 273 | return false; |
| 274 | |
| 275 | return PCC->isDirectionExplicit(); |
| 276 | } |
| 277 | |
| 278 | enum CXCommentParamPassDirection clang_ParamCommandComment_getDirection( |
| 279 | CXComment CXC) { |
| 280 | const ParamCommandComment *PCC = getASTNodeAs<ParamCommandComment>(CXC); |
| 281 | if (!PCC) |
| 282 | return CXCommentParamPassDirection_In; |
| 283 | |
| 284 | switch (PCC->getDirection()) { |
| 285 | case ParamCommandComment::In: |
| 286 | return CXCommentParamPassDirection_In; |
| 287 | |
| 288 | case ParamCommandComment::Out: |
| 289 | return CXCommentParamPassDirection_Out; |
| 290 | |
| 291 | case ParamCommandComment::InOut: |
| 292 | return CXCommentParamPassDirection_InOut; |
| 293 | } |
| 294 | llvm_unreachable("unknown ParamCommandComment::PassDirection"); |
| 295 | } |
| 296 | |
Dmitri Gribenko | 96b0986 | 2012-07-31 22:37:06 +0000 | [diff] [blame^] | 297 | CXString clang_TParamCommandComment_getParamName(CXComment CXC) { |
| 298 | const TParamCommandComment *TPCC = getASTNodeAs<TParamCommandComment>(CXC); |
| 299 | if (!TPCC || !TPCC->hasParamName()) |
| 300 | return createCXString((const char *) 0); |
| 301 | |
| 302 | return createCXString(TPCC->getParamName(), /*DupString=*/ false); |
| 303 | } |
| 304 | |
| 305 | unsigned clang_TParamCommandComment_isParamPositionValid(CXComment CXC) { |
| 306 | const TParamCommandComment *TPCC = getASTNodeAs<TParamCommandComment>(CXC); |
| 307 | if (!TPCC) |
| 308 | return false; |
| 309 | |
| 310 | return TPCC->isPositionValid(); |
| 311 | } |
| 312 | |
| 313 | unsigned clang_TParamCommandComment_getDepth(CXComment CXC) { |
| 314 | const TParamCommandComment *TPCC = getASTNodeAs<TParamCommandComment>(CXC); |
| 315 | if (!TPCC || !TPCC->isPositionValid()) |
| 316 | return 0; |
| 317 | |
| 318 | return TPCC->getDepth(); |
| 319 | } |
| 320 | |
| 321 | unsigned clang_TParamCommandComment_getIndex(CXComment CXC, unsigned Depth) { |
| 322 | const TParamCommandComment *TPCC = getASTNodeAs<TParamCommandComment>(CXC); |
| 323 | if (!TPCC || !TPCC->isPositionValid() || Depth >= TPCC->getDepth()) |
| 324 | return 0; |
| 325 | |
| 326 | return TPCC->getIndex(Depth); |
| 327 | } |
| 328 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 329 | CXString clang_VerbatimBlockLineComment_getText(CXComment CXC) { |
| 330 | const VerbatimBlockLineComment *VBL = |
| 331 | getASTNodeAs<VerbatimBlockLineComment>(CXC); |
| 332 | if (!VBL) |
| 333 | return createCXString((const char *) 0); |
| 334 | |
| 335 | return createCXString(VBL->getText(), /*DupString=*/ false); |
| 336 | } |
| 337 | |
| 338 | CXString clang_VerbatimLineComment_getText(CXComment CXC) { |
| 339 | const VerbatimLineComment *VLC = getASTNodeAs<VerbatimLineComment>(CXC); |
| 340 | if (!VLC) |
| 341 | return createCXString((const char *) 0); |
| 342 | |
| 343 | return createCXString(VLC->getText(), /*DupString=*/ false); |
| 344 | } |
| 345 | |
| 346 | } // end extern "C" |
| 347 | |
| 348 | //===----------------------------------------------------------------------===// |
| 349 | // Helpers for converting comment AST to HTML. |
| 350 | //===----------------------------------------------------------------------===// |
| 351 | |
| 352 | namespace { |
| 353 | |
Dmitri Gribenko | e5db09c | 2012-07-30 19:47:34 +0000 | [diff] [blame] | 354 | /// This comparison will sort parameters with valid index by index and |
| 355 | /// invalid (unresolved) parameters last. |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 356 | class ParamCommandCommentCompareIndex { |
| 357 | public: |
| 358 | bool operator()(const ParamCommandComment *LHS, |
| 359 | const ParamCommandComment *RHS) const { |
Dmitri Gribenko | b740316 | 2012-07-30 17:38:19 +0000 | [diff] [blame] | 360 | unsigned LHSIndex = UINT_MAX; |
| 361 | unsigned RHSIndex = UINT_MAX; |
| 362 | if (LHS->isParamIndexValid()) |
| 363 | LHSIndex = LHS->getParamIndex(); |
| 364 | if (RHS->isParamIndexValid()) |
| 365 | RHSIndex = RHS->getParamIndex(); |
| 366 | |
| 367 | return LHSIndex < RHSIndex; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 368 | } |
| 369 | }; |
| 370 | |
Dmitri Gribenko | 96b0986 | 2012-07-31 22:37:06 +0000 | [diff] [blame^] | 371 | /// This comparison will sort template parameters in the following order: |
| 372 | /// \li real template parameters (depth = 1) in index order; |
| 373 | /// \li all other names (depth > 1); |
| 374 | /// \li unresolved names. |
| 375 | class TParamCommandCommentComparePosition { |
| 376 | public: |
| 377 | bool operator()(const TParamCommandComment *LHS, |
| 378 | const TParamCommandComment *RHS) const { |
| 379 | // Sort unresolved names last. |
| 380 | if (!LHS->isPositionValid()) |
| 381 | return false; |
| 382 | if (!RHS->isPositionValid()) |
| 383 | return true; |
| 384 | |
| 385 | if (LHS->getDepth() > 1) |
| 386 | return false; |
| 387 | if (RHS->getDepth() > 1) |
| 388 | return true; |
| 389 | |
| 390 | // Sort template parameters in index order. |
| 391 | if (LHS->getDepth() == 1 && RHS->getDepth() == 1) |
| 392 | return LHS->getIndex(0) < RHS->getIndex(0); |
| 393 | |
| 394 | // Leave all other names in source order. |
| 395 | return true; |
| 396 | } |
| 397 | }; |
| 398 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 399 | class CommentASTToHTMLConverter : |
| 400 | public ConstCommentVisitor<CommentASTToHTMLConverter> { |
| 401 | public: |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 402 | /// \param Str accumulator for HTML. |
| 403 | CommentASTToHTMLConverter(SmallVectorImpl<char> &Str) : Result(Str) { } |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 404 | |
| 405 | // Inline content. |
| 406 | void visitTextComment(const TextComment *C); |
| 407 | void visitInlineCommandComment(const InlineCommandComment *C); |
| 408 | void visitHTMLStartTagComment(const HTMLStartTagComment *C); |
| 409 | void visitHTMLEndTagComment(const HTMLEndTagComment *C); |
| 410 | |
| 411 | // Block content. |
| 412 | void visitParagraphComment(const ParagraphComment *C); |
| 413 | void visitBlockCommandComment(const BlockCommandComment *C); |
| 414 | void visitParamCommandComment(const ParamCommandComment *C); |
Dmitri Gribenko | 96b0986 | 2012-07-31 22:37:06 +0000 | [diff] [blame^] | 415 | void visitTParamCommandComment(const TParamCommandComment *C); |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 416 | void visitVerbatimBlockComment(const VerbatimBlockComment *C); |
| 417 | void visitVerbatimBlockLineComment(const VerbatimBlockLineComment *C); |
| 418 | void visitVerbatimLineComment(const VerbatimLineComment *C); |
| 419 | |
| 420 | void visitFullComment(const FullComment *C); |
| 421 | |
| 422 | // Helpers. |
| 423 | |
| 424 | /// Convert a paragraph that is not a block by itself (an argument to some |
| 425 | /// command). |
| 426 | void visitNonStandaloneParagraphComment(const ParagraphComment *C); |
| 427 | |
| 428 | void appendToResultWithHTMLEscaping(StringRef S); |
| 429 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 430 | private: |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 431 | /// Output stream for HTML. |
| 432 | llvm::raw_svector_ostream Result; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 433 | }; |
| 434 | } // end unnamed namespace |
| 435 | |
| 436 | void CommentASTToHTMLConverter::visitTextComment(const TextComment *C) { |
| 437 | appendToResultWithHTMLEscaping(C->getText()); |
| 438 | } |
| 439 | |
| 440 | void CommentASTToHTMLConverter::visitInlineCommandComment( |
| 441 | const InlineCommandComment *C) { |
Dmitri Gribenko | 2d66a50 | 2012-07-23 16:43:01 +0000 | [diff] [blame] | 442 | // Nothing to render if no arguments supplied. |
| 443 | if (C->getNumArgs() == 0) |
| 444 | return; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 445 | |
Dmitri Gribenko | 2d66a50 | 2012-07-23 16:43:01 +0000 | [diff] [blame] | 446 | // Nothing to render if argument is empty. |
| 447 | StringRef Arg0 = C->getArgText(0); |
| 448 | if (Arg0.empty()) |
| 449 | return; |
| 450 | |
| 451 | switch (C->getRenderKind()) { |
| 452 | case InlineCommandComment::RenderNormal: |
| 453 | for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i) |
| 454 | Result << C->getArgText(i) << " "; |
| 455 | return; |
| 456 | |
| 457 | case InlineCommandComment::RenderBold: |
| 458 | assert(C->getNumArgs() == 1); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 459 | Result << "<b>" << Arg0 << "</b>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 460 | return; |
Dmitri Gribenko | 2d66a50 | 2012-07-23 16:43:01 +0000 | [diff] [blame] | 461 | case InlineCommandComment::RenderMonospaced: |
| 462 | assert(C->getNumArgs() == 1); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 463 | Result << "<tt>" << Arg0 << "</tt>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 464 | return; |
Dmitri Gribenko | 2d66a50 | 2012-07-23 16:43:01 +0000 | [diff] [blame] | 465 | case InlineCommandComment::RenderEmphasized: |
| 466 | assert(C->getNumArgs() == 1); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 467 | Result << "<em>" << Arg0 << "</em>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 468 | return; |
| 469 | } |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | void CommentASTToHTMLConverter::visitHTMLStartTagComment( |
| 473 | const HTMLStartTagComment *C) { |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 474 | Result << "<" << C->getTagName(); |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 475 | |
| 476 | if (C->getNumAttrs() != 0) { |
| 477 | for (unsigned i = 0, e = C->getNumAttrs(); i != e; i++) { |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 478 | Result << " "; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 479 | const HTMLStartTagComment::Attribute &Attr = C->getAttr(i); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 480 | Result << Attr.Name; |
| 481 | if (!Attr.Value.empty()) |
| 482 | Result << "=\"" << Attr.Value << "\""; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 483 | } |
| 484 | } |
| 485 | |
| 486 | if (!C->isSelfClosing()) |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 487 | Result << ">"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 488 | else |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 489 | Result << "/>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | void CommentASTToHTMLConverter::visitHTMLEndTagComment( |
| 493 | const HTMLEndTagComment *C) { |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 494 | Result << "</" << C->getTagName() << ">"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 495 | } |
| 496 | |
| 497 | void CommentASTToHTMLConverter::visitParagraphComment( |
| 498 | const ParagraphComment *C) { |
| 499 | if (C->isWhitespace()) |
| 500 | return; |
| 501 | |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 502 | Result << "<p>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 503 | for (Comment::child_iterator I = C->child_begin(), E = C->child_end(); |
| 504 | I != E; ++I) { |
| 505 | visit(*I); |
| 506 | } |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 507 | Result << "</p>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 508 | } |
| 509 | |
| 510 | void CommentASTToHTMLConverter::visitBlockCommandComment( |
| 511 | const BlockCommandComment *C) { |
| 512 | StringRef CommandName = C->getCommandName(); |
| 513 | if (CommandName == "brief" || CommandName == "short") { |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 514 | Result << "<p class=\"para-brief\">"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 515 | visitNonStandaloneParagraphComment(C->getParagraph()); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 516 | Result << "</p>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 517 | return; |
| 518 | } |
Dmitri Gribenko | 2c6b00e | 2012-07-25 17:14:58 +0000 | [diff] [blame] | 519 | if (CommandName == "returns" || CommandName == "return" || |
| 520 | CommandName == "result") { |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 521 | Result << "<p class=\"para-returns\">" |
| 522 | "<span class=\"word-returns\">Returns</span> "; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 523 | visitNonStandaloneParagraphComment(C->getParagraph()); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 524 | Result << "</p>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 525 | return; |
| 526 | } |
| 527 | // We don't know anything about this command. Just render the paragraph. |
| 528 | visit(C->getParagraph()); |
| 529 | } |
| 530 | |
| 531 | void CommentASTToHTMLConverter::visitParamCommandComment( |
| 532 | const ParamCommandComment *C) { |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 533 | if (C->isParamIndexValid()) { |
| 534 | Result << "<dt class=\"param-name-index-" |
| 535 | << C->getParamIndex() |
| 536 | << "\">"; |
| 537 | } else |
| 538 | Result << "<dt class=\"param-name-index-invalid\">"; |
| 539 | |
| 540 | Result << C->getParamName() << "</dt>"; |
| 541 | |
| 542 | if (C->isParamIndexValid()) { |
| 543 | Result << "<dd class=\"param-descr-index-" |
| 544 | << C->getParamIndex() |
| 545 | << "\">"; |
| 546 | } else |
| 547 | Result << "<dd class=\"param-descr-index-invalid\">"; |
| 548 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 549 | visitNonStandaloneParagraphComment(C->getParagraph()); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 550 | Result << "</dd>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 551 | } |
| 552 | |
Dmitri Gribenko | 96b0986 | 2012-07-31 22:37:06 +0000 | [diff] [blame^] | 553 | void CommentASTToHTMLConverter::visitTParamCommandComment( |
| 554 | const TParamCommandComment *C) { |
| 555 | if (C->isPositionValid()) { |
| 556 | if (C->getDepth() == 1) |
| 557 | Result << "<dt class=\"taram-name-index-" |
| 558 | << C->getIndex(0) |
| 559 | << "\">"; |
| 560 | else |
| 561 | Result << "<dt class=\"taram-name-index-other\">"; |
| 562 | } else |
| 563 | Result << "<dt class=\"tparam-name-index-invalid\">"; |
| 564 | |
| 565 | Result << C->getParamName() << "</dt>"; |
| 566 | |
| 567 | if (C->isPositionValid()) { |
| 568 | if (C->getDepth() == 1) |
| 569 | Result << "<dd class=\"tparam-descr-index-" |
| 570 | << C->getIndex(0) |
| 571 | << "\">"; |
| 572 | else |
| 573 | Result << "<dd class=\"tparam-descr-index-other\">"; |
| 574 | } else |
| 575 | Result << "<dd class=\"tparam-descr-index-invalid\">"; |
| 576 | |
| 577 | visitNonStandaloneParagraphComment(C->getParagraph()); |
| 578 | Result << "</dd>"; |
| 579 | } |
| 580 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 581 | void CommentASTToHTMLConverter::visitVerbatimBlockComment( |
| 582 | const VerbatimBlockComment *C) { |
| 583 | unsigned NumLines = C->getNumLines(); |
| 584 | if (NumLines == 0) |
| 585 | return; |
| 586 | |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 587 | Result << "<pre>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 588 | for (unsigned i = 0; i != NumLines; ++i) { |
| 589 | appendToResultWithHTMLEscaping(C->getText(i)); |
| 590 | if (i + 1 != NumLines) |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 591 | Result << '\n'; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 592 | } |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 593 | Result << "</pre>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 594 | } |
| 595 | |
| 596 | void CommentASTToHTMLConverter::visitVerbatimBlockLineComment( |
| 597 | const VerbatimBlockLineComment *C) { |
| 598 | llvm_unreachable("should not see this AST node"); |
| 599 | } |
| 600 | |
| 601 | void CommentASTToHTMLConverter::visitVerbatimLineComment( |
| 602 | const VerbatimLineComment *C) { |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 603 | Result << "<pre>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 604 | appendToResultWithHTMLEscaping(C->getText()); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 605 | Result << "</pre>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 606 | } |
| 607 | |
| 608 | void CommentASTToHTMLConverter::visitFullComment(const FullComment *C) { |
| 609 | const BlockContentComment *Brief = NULL; |
| 610 | const ParagraphComment *FirstParagraph = NULL; |
| 611 | const BlockCommandComment *Returns = NULL; |
| 612 | SmallVector<const ParamCommandComment *, 8> Params; |
Dmitri Gribenko | 96b0986 | 2012-07-31 22:37:06 +0000 | [diff] [blame^] | 613 | SmallVector<const TParamCommandComment *, 4> TParams; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 614 | SmallVector<const BlockContentComment *, 8> MiscBlocks; |
| 615 | |
| 616 | // Extract various blocks into separate variables and vectors above. |
| 617 | for (Comment::child_iterator I = C->child_begin(), E = C->child_end(); |
| 618 | I != E; ++I) { |
| 619 | const Comment *Child = *I; |
| 620 | if (!Child) |
| 621 | continue; |
| 622 | switch (Child->getCommentKind()) { |
| 623 | case Comment::NoCommentKind: |
| 624 | continue; |
| 625 | |
| 626 | case Comment::ParagraphCommentKind: { |
| 627 | const ParagraphComment *PC = cast<ParagraphComment>(Child); |
| 628 | if (PC->isWhitespace()) |
| 629 | break; |
| 630 | if (!FirstParagraph) |
| 631 | FirstParagraph = PC; |
| 632 | |
| 633 | MiscBlocks.push_back(PC); |
| 634 | break; |
| 635 | } |
| 636 | |
| 637 | case Comment::BlockCommandCommentKind: { |
| 638 | const BlockCommandComment *BCC = cast<BlockCommandComment>(Child); |
| 639 | StringRef CommandName = BCC->getCommandName(); |
| 640 | if (!Brief && (CommandName == "brief" || CommandName == "short")) { |
| 641 | Brief = BCC; |
| 642 | break; |
| 643 | } |
| 644 | if (!Returns && (CommandName == "returns" || CommandName == "return")) { |
| 645 | Returns = BCC; |
| 646 | break; |
| 647 | } |
| 648 | MiscBlocks.push_back(BCC); |
| 649 | break; |
| 650 | } |
| 651 | |
| 652 | case Comment::ParamCommandCommentKind: { |
| 653 | const ParamCommandComment *PCC = cast<ParamCommandComment>(Child); |
| 654 | if (!PCC->hasParamName()) |
| 655 | break; |
| 656 | |
| 657 | if (!PCC->isDirectionExplicit() && !PCC->hasNonWhitespaceParagraph()) |
| 658 | break; |
| 659 | |
| 660 | Params.push_back(PCC); |
| 661 | break; |
| 662 | } |
| 663 | |
Dmitri Gribenko | 96b0986 | 2012-07-31 22:37:06 +0000 | [diff] [blame^] | 664 | case Comment::TParamCommandCommentKind: { |
| 665 | const TParamCommandComment *TPCC = cast<TParamCommandComment>(Child); |
| 666 | if (!TPCC->hasParamName()) |
| 667 | break; |
| 668 | |
| 669 | TParams.push_back(TPCC); |
| 670 | break; |
| 671 | } |
| 672 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 673 | case Comment::VerbatimBlockCommentKind: |
| 674 | case Comment::VerbatimLineCommentKind: |
| 675 | MiscBlocks.push_back(cast<BlockCommandComment>(Child)); |
| 676 | break; |
| 677 | |
| 678 | case Comment::TextCommentKind: |
| 679 | case Comment::InlineCommandCommentKind: |
| 680 | case Comment::HTMLStartTagCommentKind: |
| 681 | case Comment::HTMLEndTagCommentKind: |
| 682 | case Comment::VerbatimBlockLineCommentKind: |
| 683 | case Comment::FullCommentKind: |
| 684 | llvm_unreachable("AST node of this kind can't be a child of " |
| 685 | "a FullComment"); |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | // Sort params in order they are declared in the function prototype. |
| 690 | // Unresolved parameters are put at the end of the list in the same order |
| 691 | // they were seen in the comment. |
| 692 | std::stable_sort(Params.begin(), Params.end(), |
| 693 | ParamCommandCommentCompareIndex()); |
| 694 | |
Dmitri Gribenko | 96b0986 | 2012-07-31 22:37:06 +0000 | [diff] [blame^] | 695 | std::stable_sort(TParams.begin(), TParams.end(), |
| 696 | TParamCommandCommentComparePosition()); |
| 697 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 698 | bool FirstParagraphIsBrief = false; |
| 699 | if (Brief) |
| 700 | visit(Brief); |
| 701 | else if (FirstParagraph) { |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 702 | Result << "<p class=\"para-brief\">"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 703 | visitNonStandaloneParagraphComment(FirstParagraph); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 704 | Result << "</p>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 705 | FirstParagraphIsBrief = true; |
| 706 | } |
| 707 | |
| 708 | for (unsigned i = 0, e = MiscBlocks.size(); i != e; ++i) { |
| 709 | const Comment *C = MiscBlocks[i]; |
| 710 | if (FirstParagraphIsBrief && C == FirstParagraph) |
| 711 | continue; |
| 712 | visit(C); |
| 713 | } |
| 714 | |
Dmitri Gribenko | 96b0986 | 2012-07-31 22:37:06 +0000 | [diff] [blame^] | 715 | if (TParams.size() != 0) { |
| 716 | Result << "<dl>"; |
| 717 | for (unsigned i = 0, e = TParams.size(); i != e; ++i) |
| 718 | visit(TParams[i]); |
| 719 | Result << "</dl>"; |
| 720 | } |
| 721 | |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 722 | if (Params.size() != 0) { |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 723 | Result << "<dl>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 724 | for (unsigned i = 0, e = Params.size(); i != e; ++i) |
| 725 | visit(Params[i]); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 726 | Result << "</dl>"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 727 | } |
| 728 | |
| 729 | if (Returns) |
| 730 | visit(Returns); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 731 | |
| 732 | Result.flush(); |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 733 | } |
| 734 | |
| 735 | void CommentASTToHTMLConverter::visitNonStandaloneParagraphComment( |
| 736 | const ParagraphComment *C) { |
| 737 | if (!C) |
| 738 | return; |
| 739 | |
| 740 | for (Comment::child_iterator I = C->child_begin(), E = C->child_end(); |
| 741 | I != E; ++I) { |
| 742 | visit(*I); |
| 743 | } |
| 744 | } |
| 745 | |
| 746 | void CommentASTToHTMLConverter::appendToResultWithHTMLEscaping(StringRef S) { |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 747 | for (StringRef::iterator I = S.begin(), E = S.end(); I != E; ++I) { |
| 748 | const char C = *I; |
| 749 | switch (C) { |
| 750 | case '&': |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 751 | Result << "&"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 752 | break; |
| 753 | case '<': |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 754 | Result << "<"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 755 | break; |
| 756 | case '>': |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 757 | Result << ">"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 758 | break; |
| 759 | case '"': |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 760 | Result << """; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 761 | break; |
| 762 | case '\'': |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 763 | Result << "'"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 764 | break; |
| 765 | case '/': |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 766 | Result << "/"; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 767 | break; |
| 768 | default: |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 769 | Result << C; |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 770 | break; |
| 771 | } |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | extern "C" { |
| 776 | |
| 777 | CXString clang_HTMLTagComment_getAsString(CXComment CXC) { |
| 778 | const HTMLTagComment *HTC = getASTNodeAs<HTMLTagComment>(CXC); |
| 779 | if (!HTC) |
| 780 | return createCXString((const char *) 0); |
| 781 | |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 782 | SmallString<128> HTML; |
| 783 | CommentASTToHTMLConverter Converter(HTML); |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 784 | Converter.visit(HTC); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 785 | return createCXString(HTML.str(), /* DupString = */ true); |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 786 | } |
| 787 | |
| 788 | CXString clang_FullComment_getAsHTML(CXComment CXC) { |
| 789 | const FullComment *FC = getASTNodeAs<FullComment>(CXC); |
| 790 | if (!FC) |
| 791 | return createCXString((const char *) 0); |
| 792 | |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 793 | SmallString<1024> HTML; |
| 794 | CommentASTToHTMLConverter Converter(HTML); |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 795 | Converter.visit(FC); |
Dmitri Gribenko | 3e63d33 | 2012-07-21 01:47:43 +0000 | [diff] [blame] | 796 | return createCXString(HTML.str(), /* DupString = */ true); |
Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame] | 797 | } |
| 798 | |
| 799 | } // end extern "C" |
| 800 | |