diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
commit | 13cc256e404620c1de0cbcc4e43ce1e2dbbc4898 (patch) | |
tree | 2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /tools/libclang/CXComment.h | |
parent | 657bc3d9848e3be92029b2416031340988cd0111 (diff) |
Notes
Diffstat (limited to 'tools/libclang/CXComment.h')
-rw-r--r-- | tools/libclang/CXComment.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/tools/libclang/CXComment.h b/tools/libclang/CXComment.h index 753877e6c7e3..513431709f48 100644 --- a/tools/libclang/CXComment.h +++ b/tools/libclang/CXComment.h @@ -15,20 +15,29 @@ #define LLVM_CLANG_CXCOMMENT_H #include "clang-c/Index.h" +#include "CXTranslationUnit.h" #include "clang/AST/Comment.h" +#include "clang/AST/ASTContext.h" +#include "clang/Frontend/ASTUnit.h" namespace clang { +namespace comments { + class CommandTraits; +} + namespace cxcomment { -inline CXComment createCXComment(const comments::Comment *C) { +inline CXComment createCXComment(const comments::Comment *C, + CXTranslationUnit TU) { CXComment Result; - Result.Data = C; + Result.ASTNode = C; + Result.TranslationUnit = TU; return Result; } inline const comments::Comment *getASTNode(CXComment CXC) { - return static_cast<const comments::Comment *>(CXC.Data); + return static_cast<const comments::Comment *>(CXC.ASTNode); } template<typename T> @@ -40,6 +49,14 @@ inline const T *getASTNodeAs(CXComment CXC) { return dyn_cast<T>(C); } +inline ASTContext &getASTContext(CXComment CXC) { + return static_cast<ASTUnit *>(CXC.TranslationUnit->TUData)->getASTContext(); +} + +inline comments::CommandTraits &getCommandTraits(CXComment CXC) { + return getASTContext(CXC).getCommentCommandTraits(); +} + } // end namespace cxcomment } // end namespace clang |