1 //===- CXComment.h - Routines for manipulating CXComments -----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines routines for manipulating CXComments.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_TOOLS_LIBCLANG_CXCOMMENT_H
15 #define LLVM_CLANG_TOOLS_LIBCLANG_CXCOMMENT_H
17 #include "CXTranslationUnit.h"
18 #include "clang-c/Documentation.h"
19 #include "clang-c/Index.h"
20 #include "clang/AST/ASTContext.h"
21 #include "clang/AST/Comment.h"
22 #include "clang/Frontend/ASTUnit.h"
31 static inline CXComment createCXComment(const comments::Comment *C,
32 CXTranslationUnit TU) {
35 Result.TranslationUnit = TU;
39 static inline const comments::Comment *getASTNode(CXComment CXC) {
40 return static_cast<const comments::Comment *>(CXC.ASTNode);
44 static inline const T *getASTNodeAs(CXComment CXC) {
45 const comments::Comment *C = getASTNode(CXC);
49 return dyn_cast<T>(C);
52 static inline ASTContext &getASTContext(CXComment CXC) {
53 return cxtu::getASTUnit(CXC.TranslationUnit)->getASTContext();
56 static inline comments::CommandTraits &getCommandTraits(CXComment CXC) {
57 return getASTContext(CXC).getCommentCommandTraits();
60 } // end namespace cxcomment
61 } // end namespace clang