Coverage Report

Created: 2022-01-18 06:27

/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
92.3k
                                        CXTranslationUnit TU) {
32
92.3k
  CXComment Result;
33
92.3k
  Result.ASTNode = C;
34
92.3k
  Result.TranslationUnit = TU;
35
92.3k
  return Result;
36
92.3k
}
37
38
119k
static inline const comments::Comment *getASTNode(CXComment CXC) {
39
119k
  return static_cast<const comments::Comment *>(CXC.ASTNode);
40
119k
}
41
42
template<typename T>
43
10.0k
static inline const T *getASTNodeAs(CXComment CXC) {
44
10.0k
  const comments::Comment *C = getASTNode(CXC);
45
10.0k
  if (!C)
46
0
    return nullptr;
47
48
10.0k
  return dyn_cast<T>(C);
49
10.0k
}
CXComment.cpp:clang::comments::InlineContentComment const* clang::cxcomment::getASTNodeAs<clang::comments::InlineContentComment>(CXComment)
Line
Count
Source
43
2.57k
static inline const T *getASTNodeAs(CXComment CXC) {
44
2.57k
  const comments::Comment *C = getASTNode(CXC);
45
2.57k
  if (!C)
46
0
    return nullptr;
47
48
2.57k
  return dyn_cast<T>(C);
49
2.57k
}
CXComment.cpp:clang::comments::TextComment const* clang::cxcomment::getASTNodeAs<clang::comments::TextComment>(CXComment)
Line
Count
Source
43
2.31k
static inline const T *getASTNodeAs(CXComment CXC) {
44
2.31k
  const comments::Comment *C = getASTNode(CXC);
45
2.31k
  if (!C)
46
0
    return nullptr;
47
48
2.31k
  return dyn_cast<T>(C);
49
2.31k
}
CXComment.cpp:clang::comments::InlineCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::InlineCommandComment>(CXComment)
Line
Count
Source
43
577
static inline const T *getASTNodeAs(CXComment CXC) {
44
577
  const comments::Comment *C = getASTNode(CXC);
45
577
  if (!C)
46
0
    return nullptr;
47
48
577
  return dyn_cast<T>(C);
49
577
}
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
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
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.02k
static inline const T *getASTNodeAs(CXComment CXC) {
44
1.02k
  const comments::Comment *C = getASTNode(CXC);
45
1.02k
  if (!C)
46
0
    return nullptr;
47
48
1.02k
  return dyn_cast<T>(C);
49
1.02k
}
CXComment.cpp:clang::comments::ParamCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::ParamCommandComment>(CXComment)
Line
Count
Source
43
956
static inline const T *getASTNodeAs(CXComment CXC) {
44
956
  const comments::Comment *C = getASTNode(CXC);
45
956
  if (!C)
46
0
    return nullptr;
47
48
956
  return dyn_cast<T>(C);
49
956
}
CXComment.cpp:clang::comments::TParamCommandComment const* clang::cxcomment::getASTNodeAs<clang::comments::TParamCommandComment>(CXComment)
Line
Count
Source
43
438
static inline const T *getASTNodeAs(CXComment CXC) {
44
438
  const comments::Comment *C = getASTNode(CXC);
45
438
  if (!C)
46
0
    return nullptr;
47
48
438
  return dyn_cast<T>(C);
49
438
}
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
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
45
static inline const T *getASTNodeAs(CXComment CXC) {
44
45
  const comments::Comment *C = getASTNode(CXC);
45
45
  if (!C)
46
0
    return nullptr;
47
48
45
  return dyn_cast<T>(C);
49
45
}
CXComment.cpp:clang::comments::FullComment const* clang::cxcomment::getASTNodeAs<clang::comments::FullComment>(CXComment)
Line
Count
Source
43
1.93k
static inline const T *getASTNodeAs(CXComment CXC) {
44
1.93k
  const comments::Comment *C = getASTNode(CXC);
45
1.93k
  if (!C)
46
0
    return nullptr;
47
48
1.93k
  return dyn_cast<T>(C);
49
1.93k
}
50
51
700
static inline ASTContext &getASTContext(CXComment CXC) {
52
700
  return cxtu::getASTUnit(CXC.TranslationUnit)->getASTContext();
53
700
}
54
55
700
static inline comments::CommandTraits &getCommandTraits(CXComment CXC) {
56
700
  return getASTContext(CXC).getCommentCommandTraits();
57
700
}
58
59
} // end namespace cxcomment
60
} // end namespace clang
61
62
#endif
63