Coverage Report

Created: 2020-02-15 09:57

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/tools/libclang/CXComment.h
Line
Count
Source (jump to first uncovered line)
1
//===- CXComment.h - Routines for manipulating CXComments -----------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file defines routines for manipulating CXComments.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_TOOLS_LIBCLANG_CXCOMMENT_H
14
#define LLVM_CLANG_TOOLS_LIBCLANG_CXCOMMENT_H
15
16
#include "CXTranslationUnit.h"
17
#include "clang-c/Documentation.h"
18
#include "clang-c/Index.h"
19
#include "clang/AST/ASTContext.h"
20
#include "clang/AST/Comment.h"
21
#include "clang/Frontend/ASTUnit.h"
22
23
namespace clang {
24
namespace comments {
25
  class CommandTraits;
26
}
27
28
namespace cxcomment {
29
30
static inline CXComment createCXComment(const comments::Comment *C,
31
83.9k
                                        CXTranslationUnit TU) {
32
83.9k
  CXComment Result;
33
83.9k
  Result.ASTNode = C;
34
83.9k
  Result.TranslationUnit = TU;
35
83.9k
  return Result;
36
83.9k
}
37
38
110k
static inline const comments::Comment *getASTNode(CXComment CXC) {
39
110k
  return static_cast<const comments::Comment *>(CXC.ASTNode);
40
110k
}
41
42
template<typename T>
43
9.95k
static inline const T *getASTNodeAs(CXComment CXC) {
44
9.95k
  const comments::Comment *C = getASTNode(CXC);
45
9.95k
  if (!C)
46
0
    return nullptr;
47
9.95k
48
9.95k
  return dyn_cast<T>(C);
49
9.95k
}
CXComment.cpp:clang::comments::InlineContentComment const* clang::cxcomment::getASTNodeAs<clang::comments::InlineContentComment>(CXComment)
Line
Count
Source
43
2.53k
static inline const T *getASTNodeAs(CXComment CXC) {
44
2.53k
  const comments::Comment *C = getASTNode(CXC);
45
2.53k
  if (!C)
46
0
    return nullptr;
47
2.53k
48
2.53k
  return dyn_cast<T>(C);
49
2.53k
}
CXComment.cpp:clang::comments::TextComment const* clang::cxcomment::getASTNodeAs<clang::comments::TextComment>(CXComment)
Line
Count
Source
43
2.27k
static inline const T *getASTNodeAs(CXComment CXC) {
44
2.27k
  const comments::Comment *C = getASTNode(CXC);
45
2.27k
  if (!C)
46
0
    return nullptr;
47
2.27k
48
2.27k
  return dyn_cast<T>(C);
49
2.27k
}
CXComment.cpp:clang::comments::InlineCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::InlineCommandComment>(CXComment)
Line
Count
Source
43
576
static inline const T *getASTNodeAs(CXComment CXC) {
44
576
  const comments::Comment *C = getASTNode(CXC);
45
576
  if (!C)
46
0
    return nullptr;
47
576
48
576
  return dyn_cast<T>(C);
49
576
}
CXComment.cpp:clang::comments::HTMLTagComment const* clang::cxcomment::getASTNodeAs<clang::comments::HTMLTagComment>(CXComment)
Line
Count
Source
43
78
static inline const T *getASTNodeAs(CXComment CXC) {
44
78
  const comments::Comment *C = getASTNode(CXC);
45
78
  if (!C)
46
0
    return nullptr;
47
78
48
78
  return dyn_cast<T>(C);
49
78
}
CXComment.cpp:clang::comments::HTMLStartTagComment const* clang::cxcomment::getASTNodeAs<clang::comments::HTMLStartTagComment>(CXComment)
Line
Count
Source
43
136
static inline const T *getASTNodeAs(CXComment CXC) {
44
136
  const comments::Comment *C = getASTNode(CXC);
45
136
  if (!C)
46
0
    return nullptr;
47
136
48
136
  return dyn_cast<T>(C);
49
136
}
CXComment.cpp:clang::comments::BlockCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::BlockCommandComment>(CXComment)
Line
Count
Source
43
1.01k
static inline const T *getASTNodeAs(CXComment CXC) {
44
1.01k
  const comments::Comment *C = getASTNode(CXC);
45
1.01k
  if (!C)
46
0
    return nullptr;
47
1.01k
48
1.01k
  return dyn_cast<T>(C);
49
1.01k
}
CXComment.cpp:clang::comments::ParamCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::ParamCommandComment>(CXComment)
Line
Count
Source
43
925
static inline const T *getASTNodeAs(CXComment CXC) {
44
925
  const comments::Comment *C = getASTNode(CXC);
45
925
  if (!C)
46
0
    return nullptr;
47
925
48
925
  return dyn_cast<T>(C);
49
925
}
CXComment.cpp:clang::comments::TParamCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::TParamCommandComment>(CXComment)
Line
Count
Source
43
432
static inline const T *getASTNodeAs(CXComment CXC) {
44
432
  const comments::Comment *C = getASTNode(CXC);
45
432
  if (!C)
46
0
    return nullptr;
47
432
48
432
  return dyn_cast<T>(C);
49
432
}
CXComment.cpp:clang::comments::VerbatimBlockLineComment const* clang::cxcomment::getASTNodeAs<clang::comments::VerbatimBlockLineComment>(CXComment)
Line
Count
Source
43
17
static inline const T *getASTNodeAs(CXComment CXC) {
44
17
  const comments::Comment *C = getASTNode(CXC);
45
17
  if (!C)
46
0
    return nullptr;
47
17
48
17
  return dyn_cast<T>(C);
49
17
}
CXComment.cpp:clang::comments::VerbatimLineComment const* clang::cxcomment::getASTNodeAs<clang::comments::VerbatimLineComment>(CXComment)
Line
Count
Source
43
42
static inline const T *getASTNodeAs(CXComment CXC) {
44
42
  const comments::Comment *C = getASTNode(CXC);
45
42
  if (!C)
46
0
    return nullptr;
47
42
48
42
  return dyn_cast<T>(C);
49
42
}
CXComment.cpp:clang::comments::FullComment const* clang::cxcomment::getASTNodeAs<clang::comments::FullComment>(CXComment)
Line
Count
Source
43
1.92k
static inline const T *getASTNodeAs(CXComment CXC) {
44
1.92k
  const comments::Comment *C = getASTNode(CXC);
45
1.92k
  if (!C)
46
0
    return nullptr;
47
1.92k
48
1.92k
  return dyn_cast<T>(C);
49
1.92k
}
50
51
695
static inline ASTContext &getASTContext(CXComment CXC) {
52
695
  return cxtu::getASTUnit(CXC.TranslationUnit)->getASTContext();
53
695
}
54
55
695
static inline comments::CommandTraits &getCommandTraits(CXComment CXC) {
56
695
  return getASTContext(CXC).getCommentCommandTraits();
57
695
}
58
59
} // end namespace cxcomment
60
} // end namespace clang
61
62
#endif
63