summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2012-07-20 21:34:34 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2012-07-20 21:34:34 +0000
commit5e4fe00e644177dd5b6c8bd330be6dfe0f25610b (patch)
treefbf059f989c5932e672e49f04f8f5d2168352798 /clang/tools/libclang/CIndex.cpp
parent434efb29b570f9dfd3731aa6169dba9d961664b4 (diff)
downloadbcm5719-llvm-5e4fe00e644177dd5b6c8bd330be6dfe0f25610b.tar.gz
bcm5719-llvm-5e4fe00e644177dd5b6c8bd330be6dfe0f25610b.zip
Add libclang APIs to walk comments ASTs and an API to convert a comment to an
HTML fragment. For testing, c-index-test now has even more output: * HTML rendering of a comment * comment AST tree dump in S-expressions like Comment::dump(), but implemented * with libclang APIs. llvm-svn: 160577
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 3b3b697d172..b1e4bad14d6 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "CIndexer.h"
+#include "CXComment.h"
#include "CXCursor.h"
#include "CXTranslationUnit.h"
#include "CXString.h"
@@ -5729,6 +5730,17 @@ CXString clang_Cursor_getBriefCommentText(CXCursor C) {
return createCXString((const char *) NULL);
}
+CXComment clang_Cursor_getParsedComment(CXCursor C) {
+ if (!clang_isDeclaration(C.kind))
+ return cxcomment::createCXComment(NULL);
+
+ const Decl *D = getCursorDecl(C);
+ const ASTContext &Context = getCursorContext(C);
+ const comments::FullComment *FC = Context.getCommentForDecl(D);
+
+ return cxcomment::createCXComment(FC);
+}
+
} // end: extern "C"
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud