summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CXComment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/tools/libclang/CXComment.cpp')
-rw-r--r--clang/tools/libclang/CXComment.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/tools/libclang/CXComment.cpp b/clang/tools/libclang/CXComment.cpp
index 2c4f269f9e6..8fb7c0a5c4c 100644
--- a/clang/tools/libclang/CXComment.cpp
+++ b/clang/tools/libclang/CXComment.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "clang-c/Index.h"
+#include "clang-c/Documentation.h"
#include "CXComment.h"
#include "CXCursor.h"
#include "CXString.h"
@@ -28,6 +29,19 @@ using namespace clang::cxcomment;
extern "C" {
+CXComment clang_Cursor_getParsedComment(CXCursor C) {
+ using namespace clang::cxcursor;
+
+ if (!clang_isDeclaration(C.kind))
+ return createCXComment(NULL, NULL);
+
+ const Decl *D = getCursorDecl(C);
+ const ASTContext &Context = getCursorContext(C);
+ const FullComment *FC = Context.getCommentForDecl(D, /*PP=*/NULL);
+
+ return createCXComment(FC, getCursorTU(C));
+}
+
enum CXCommentKind clang_Comment_getKind(CXComment CXC) {
const Comment *C = getASTNode(CXC);
if (!C)
OpenPOWER on IntegriCloud