summaryrefslogtreecommitdiff
path: root/tools/libclang
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-04-28 02:39:27 +0000
committerAlp Toker <alp@nuanti.com>2014-04-28 02:39:27 +0000
commit113a55fb4314b0e025ffc9e95769eb5f478062ef (patch)
tree8fa7b4adead5f5e0b63bb05d20c2a8b562877a34 /tools/libclang
parentefdd867fb3a6a5524438f958bafa55b69bbd5f52 (diff)
downloadclang-113a55fb4314b0e025ffc9e95769eb5f478062ef.tar.gz
clang-113a55fb4314b0e025ffc9e95769eb5f478062ef.tar.bz2
clang-113a55fb4314b0e025ffc9e95769eb5f478062ef.tar.xz
libclang: split out the documentation comment API
It's possible that the "comment AST" may be replaced or split out in the midterm, any anyway this makes the headers easier to read. Developers don't currently need to include "clang-c/Documentation.h" explicitly and there's no macro to test for availability yet. The raw comment and brief comment accessors have been kept in Index.h though brief support may also move here as a separate proposal. This is not a deprecation, just a gentle separation of concerns as we look to simplify the built-in representation of comment nodes and support external comment processors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207392 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang')
-rw-r--r--tools/libclang/CIndex.cpp12
-rw-r--r--tools/libclang/CXComment.cpp14
-rw-r--r--tools/libclang/CXComment.h1
3 files changed, 15 insertions, 12 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index f3c9f2fa44..26b3bf16af 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -15,7 +15,6 @@
#include "CIndexer.h"
#include "CIndexDiagnostic.h"
#include "CLog.h"
-#include "CXComment.h"
#include "CXCursor.h"
#include "CXSourceLocation.h"
#include "CXString.h"
@@ -6312,17 +6311,6 @@ CXString clang_Cursor_getBriefCommentText(CXCursor C) {
return cxstring::createNull();
}
-CXComment clang_Cursor_getParsedComment(CXCursor C) {
- if (!clang_isDeclaration(C.kind))
- return cxcomment::createCXComment(NULL, NULL);
-
- const Decl *D = getCursorDecl(C);
- const ASTContext &Context = getCursorContext(C);
- const comments::FullComment *FC = Context.getCommentForDecl(D, /*PP=*/ NULL);
-
- return cxcomment::createCXComment(FC, getCursorTU(C));
-}
-
CXModule clang_Cursor_getModule(CXCursor C) {
if (C.kind == CXCursor_ModuleImportDecl) {
if (const ImportDecl *ImportD =
diff --git a/tools/libclang/CXComment.cpp b/tools/libclang/CXComment.cpp
index 2c4f269f9e..8fb7c0a5c4 100644
--- a/tools/libclang/CXComment.cpp
+++ b/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)
diff --git a/tools/libclang/CXComment.h b/tools/libclang/CXComment.h
index 1e2561d585..606ee26bb6 100644
--- a/tools/libclang/CXComment.h
+++ b/tools/libclang/CXComment.h
@@ -16,6 +16,7 @@
#include "CXTranslationUnit.h"
#include "clang-c/Index.h"
+#include "clang-c/Documentation.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Comment.h"
#include "clang/Frontend/ASTUnit.h"