summaryrefslogtreecommitdiffstats
path: root/clang/tools
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
commit59c6bc5882c542fb1b455cdbc29b6e00a54d963b (patch)
treeec5c71dfe00481af160944b1601f48eb52a2ce85 /clang/tools
parent7dd31334336c1659682703d2568f2bbac09591db (diff)
downloadbcm5719-llvm-59c6bc5882c542fb1b455cdbc29b6e00a54d963b.tar.gz
bcm5719-llvm-59c6bc5882c542fb1b455cdbc29b6e00a54d963b.zip
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. llvm-svn: 207392
Diffstat (limited to 'clang/tools')
-rw-r--r--clang/tools/c-index-test/c-index-test.c1
-rw-r--r--clang/tools/libclang/CIndex.cpp12
-rw-r--r--clang/tools/libclang/CXComment.cpp14
-rw-r--r--clang/tools/libclang/CXComment.h1
4 files changed, 16 insertions, 12 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index f50c8855f60..ae2b81b2c54 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -3,6 +3,7 @@
#include "clang-c/Index.h"
#include "clang-c/CXCompilationDatabase.h"
#include "clang-c/BuildSystem.h"
+#include "clang-c/Documentation.h"
#include "llvm/Config/config.h"
#include <ctype.h>
#include <stdlib.h>
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index f3c9f2fa444..26b3bf16af2 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/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/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)
diff --git a/clang/tools/libclang/CXComment.h b/clang/tools/libclang/CXComment.h
index 1e2561d585e..606ee26bb68 100644
--- a/clang/tools/libclang/CXComment.h
+++ b/clang/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"
OpenPOWER on IntegriCloud