Dmitri Gribenko | ae99b75 | 2012-07-20 21:34:34 +0000 | [diff] [blame^] | 1 | //===- CXComment.h - Routines for manipulating CXComments -----------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines routines for manipulating CXComments. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_CLANG_CXCOMMENT_H |
| 15 | #define LLVM_CLANG_CXCOMMENT_H |
| 16 | |
| 17 | #include "clang-c/Index.h" |
| 18 | |
| 19 | #include "clang/AST/Comment.h" |
| 20 | |
| 21 | namespace clang { |
| 22 | namespace cxcomment { |
| 23 | |
| 24 | inline CXComment createCXComment(const comments::Comment *C) { |
| 25 | CXComment Result; |
| 26 | Result.Data = C; |
| 27 | return Result; |
| 28 | } |
| 29 | |
| 30 | inline const comments::Comment *getASTNode(CXComment CXC) { |
| 31 | return static_cast<const comments::Comment *>(CXC.Data); |
| 32 | } |
| 33 | |
| 34 | template<typename T> |
| 35 | inline const T *getASTNodeAs(CXComment CXC) { |
| 36 | const comments::Comment *C = getASTNode(CXC); |
| 37 | if (!C) |
| 38 | return NULL; |
| 39 | |
| 40 | return dyn_cast<T>(C); |
| 41 | } |
| 42 | |
| 43 | } // end namespace cxcomment |
| 44 | } // end namespace clang |
| 45 | |
| 46 | #endif |
| 47 | |