CXComment.h revision ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72d
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
21namespace clang {
22namespace cxcomment {
23
24inline CXComment createCXComment(const comments::Comment *C) {
25  CXComment Result;
26  Result.Data = C;
27  return Result;
28}
29
30inline const comments::Comment *getASTNode(CXComment CXC) {
31  return static_cast<const comments::Comment *>(CXC.Data);
32}
33
34template<typename T>
35inline 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
48