summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CXComment.h
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/CXComment.h
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/CXComment.h')
-rw-r--r--clang/tools/libclang/CXComment.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/clang/tools/libclang/CXComment.h b/clang/tools/libclang/CXComment.h
new file mode 100644
index 00000000000..753877e6c7e
--- /dev/null
+++ b/clang/tools/libclang/CXComment.h
@@ -0,0 +1,47 @@
+//===- CXComment.h - Routines for manipulating CXComments -----------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines routines for manipulating CXComments.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_CXCOMMENT_H
+#define LLVM_CLANG_CXCOMMENT_H
+
+#include "clang-c/Index.h"
+
+#include "clang/AST/Comment.h"
+
+namespace clang {
+namespace cxcomment {
+
+inline CXComment createCXComment(const comments::Comment *C) {
+ CXComment Result;
+ Result.Data = C;
+ return Result;
+}
+
+inline const comments::Comment *getASTNode(CXComment CXC) {
+ return static_cast<const comments::Comment *>(CXC.Data);
+}
+
+template<typename T>
+inline const T *getASTNodeAs(CXComment CXC) {
+ const comments::Comment *C = getASTNode(CXC);
+ if (!C)
+ return NULL;
+
+ return dyn_cast<T>(C);
+}
+
+} // end namespace cxcomment
+} // end namespace clang
+
+#endif
+
OpenPOWER on IntegriCloud