aboutsummaryrefslogtreecommitdiff
path: root/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
commitae99b75fbbac1deaccdcc1b326b8fb6b07a1e72d (patch)
tree0824998fc8d29311746310ca98ededcf0416d4d5 /tools/libclang/CIndex.cpp
parent0cfe9a1ceb8c4e60a9deb91003c04aba3ec9eade (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160577 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndex.cpp')
-rw-r--r--tools/libclang/CIndex.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 3b3b697d17..b1e4bad14d 100644
--- a/tools/libclang/CIndex.cpp
+++ b/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"
//===----------------------------------------------------------------------===//