Coverage Report

Created: 2020-09-19 12:23

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/AST/CommentVisitor.h
Line
Count
Source (jump to first uncovered line)
1
//===- CommentVisitor.h - Visitor for Comment subclasses --------*- C++ -*-===//
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
#ifndef LLVM_CLANG_AST_COMMENTVISITOR_H
10
#define LLVM_CLANG_AST_COMMENTVISITOR_H
11
12
#include "clang/AST/Comment.h"
13
#include "llvm/ADT/STLExtras.h"
14
#include "llvm/Support/ErrorHandling.h"
15
16
namespace clang {
17
namespace comments {
18
template <template <typename> class Ptr, typename ImplClass,
19
          typename RetTy = void, class... ParamTys>
20
class CommentVisitorBase {
21
public:
22
#define PTR(CLASS) typename Ptr<CLASS>::type
23
#define DISPATCH(NAME, CLASS)                                                  \
24
6.97k
  return static_cast<ImplClass *>(this)->visit##NAME(                          \
25
6.97k
      static_cast<PTR(CLASS)>(C), std::forward<ParamTys>(P)...)
26
27
9.73k
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
9.73k
    if (!C)
29
0
      return RetTy();
30
9.73k
31
9.73k
    switch (C->getCommentKind()) {
32
0
    default: llvm_unreachable("Unknown comment kind!");
33
0
#define ABSTRACT_COMMENT(COMMENT)
34
0
#define COMMENT(CLASS, PARENT) \
35
9.73k
    case Comment::CLASS##Kind: 
DISPATCH5.93k
(CLASS, CLASS);
36
0
#include "clang/AST/CommentNodes.inc"
37
9.73k
#undef ABSTRACT_COMMENT
38
9.73k
#undef COMMENT
39
9.73k
    }
40
9.73k
  }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visit(clang::comments::Comment const*, clang::comments::FullComment const*)
Line
Count
Source
27
64
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
64
    if (!C)
29
0
      return RetTy();
30
64
31
64
    switch (C->getCommentKind()) {
32
0
    default: llvm_unreachable("Unknown comment kind!");
33
0
#define ABSTRACT_COMMENT(COMMENT)
34
0
#define COMMENT(CLASS, PARENT) \
35
0
    case Comment::CLASS##Kind: DISPATCH(CLASS, CLASS);
36
0
#include "clang/AST/CommentNodes.inc"
37
64
#undef ABSTRACT_COMMENT
38
64
#undef COMMENT
39
64
    }
40
64
  }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visit(clang::comments::Comment const*, clang::comments::FullComment const*)
Line
Count
Source
27
593
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
593
    if (!C)
29
0
      return RetTy();
30
593
31
593
    switch (C->getCommentKind()) {
32
0
    default: llvm_unreachable("Unknown comment kind!");
33
0
#define ABSTRACT_COMMENT(COMMENT)
34
0
#define COMMENT(CLASS, PARENT) \
35
0
    case Comment::CLASS##Kind: DISPATCH(CLASS, CLASS);
36
0
#include "clang/AST/CommentNodes.inc"
37
593
#undef ABSTRACT_COMMENT
38
593
#undef COMMENT
39
593
    }
40
593
  }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONNodeDumper, void, clang::comments::FullComment const*>::visit(clang::comments::Comment const*, clang::comments::FullComment const*)
Line
Count
Source
27
64
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
64
    if (!C)
29
0
      return RetTy();
30
64
31
64
    switch (C->getCommentKind()) {
32
0
    default: llvm_unreachable("Unknown comment kind!");
33
0
#define ABSTRACT_COMMENT(COMMENT)
34
0
#define COMMENT(CLASS, PARENT) \
35
0
    case Comment::CLASS##Kind: DISPATCH(CLASS, CLASS);
36
0
#include "clang/AST/CommentNodes.inc"
37
64
#undef ABSTRACT_COMMENT
38
64
#undef COMMENT
39
64
    }
40
64
  }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::TextNodeDumper, void, clang::comments::FullComment const*>::visit(clang::comments::Comment const*, clang::comments::FullComment const*)
Line
Count
Source
27
593
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
593
    if (!C)
29
0
      return RetTy();
30
593
31
593
    switch (C->getCommentKind()) {
32
0
    default: llvm_unreachable("Unknown comment kind!");
33
0
#define ABSTRACT_COMMENT(COMMENT)
34
0
#define COMMENT(CLASS, PARENT) \
35
0
    case Comment::CLASS##Kind: DISPATCH(CLASS, CLASS);
36
0
#include "clang/AST/CommentNodes.inc"
37
593
#undef ABSTRACT_COMMENT
38
593
#undef COMMENT
39
593
    }
40
593
  }
CommentToXML.cpp:clang::comments::CommentVisitorBase<llvm::make_const_ptr, (anonymous namespace)::CommentASTToHTMLConverter, void>::visit(clang::comments::Comment const*)
Line
Count
Source
27
3.86k
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
3.86k
    if (!C)
29
0
      return RetTy();
30
3.86k
31
3.86k
    switch (C->getCommentKind()) {
32
0
    default: llvm_unreachable("Unknown comment kind!");
33
0
#define ABSTRACT_COMMENT(COMMENT)
34
0
#define COMMENT(CLASS, PARENT) \
35
0
    case Comment::CLASS##Kind: DISPATCH(CLASS, CLASS);
36
0
#include "clang/AST/CommentNodes.inc"
37
3.86k
#undef ABSTRACT_COMMENT
38
3.86k
#undef COMMENT
39
3.86k
    }
40
3.86k
  }
CommentToXML.cpp:clang::comments::CommentVisitorBase<llvm::make_const_ptr, (anonymous namespace)::CommentASTToXMLConverter, void>::visit(clang::comments::Comment const*)
Line
Count
Source
27
4.56k
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
4.56k
    if (!C)
29
0
      return RetTy();
30
4.56k
31
4.56k
    switch (C->getCommentKind()) {
32
0
    default: llvm_unreachable("Unknown comment kind!");
33
0
#define ABSTRACT_COMMENT(COMMENT)
34
0
#define COMMENT(CLASS, PARENT) \
35
0
    case Comment::CLASS##Kind: DISPATCH(CLASS, CLASS);
36
0
#include "clang/AST/CommentNodes.inc"
37
4.56k
#undef ABSTRACT_COMMENT
38
4.56k
#undef COMMENT
39
4.56k
    }
40
4.56k
  }
41
42
  // If the derived class does not implement a certain Visit* method, fall back
43
  // on Visit* method for the superclass.
44
720
#define ABSTRACT_COMMENT(COMMENT) COMMENT
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitBlockContentComment(clang::comments::BlockContentComment const*, clang::comments::FullComment const*)
Line
Count
Source
44
26
#define ABSTRACT_COMMENT(COMMENT) COMMENT
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitHTMLTagComment(clang::comments::HTMLTagComment const*, clang::comments::FullComment const*)
Line
Count
Source
44
3
#define ABSTRACT_COMMENT(COMMENT) COMMENT
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitInlineContentComment(clang::comments::InlineContentComment const*, clang::comments::FullComment const*)
Line
Count
Source
44
25
#define ABSTRACT_COMMENT(COMMENT) COMMENT
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitBlockContentComment(clang::comments::BlockContentComment const*, clang::comments::FullComment const*)
Line
Count
Source
44
237
#define ABSTRACT_COMMENT(COMMENT) COMMENT
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitHTMLTagComment(clang::comments::HTMLTagComment const*, clang::comments::FullComment const*)
Line
Count
Source
44
25
#define ABSTRACT_COMMENT(COMMENT) COMMENT
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitInlineContentComment(clang::comments::InlineContentComment const*, clang::comments::FullComment const*)
Line
Count
Source
44
218
#define ABSTRACT_COMMENT(COMMENT) COMMENT
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONNodeDumper, void, clang::comments::FullComment const*>::visitBlockContentComment(clang::comments::BlockContentComment const*, clang::comments::FullComment const*)
Line
Count
Source
44
18
#define ABSTRACT_COMMENT(COMMENT) COMMENT
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::TextNodeDumper, void, clang::comments::FullComment const*>::visitBlockContentComment(clang::comments::BlockContentComment const*, clang::comments::FullComment const*)
Line
Count
Source
44
168
#define ABSTRACT_COMMENT(COMMENT) COMMENT
45
#define COMMENT(CLASS, PARENT)                                                 \
46
1.04k
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitBlockCommandComment(clang::comments::BlockCommandComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
8
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitParamCommandComment(clang::comments::ParamCommandComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
4
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitTParamCommandComment(clang::comments::TParamCommandComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
2
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitVerbatimBlockComment(clang::comments::VerbatimBlockComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
1
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
Unexecuted instantiation: clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitVerbatimLineComment(clang::comments::VerbatimLineComment const*, clang::comments::FullComment const*)
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitParagraphComment(clang::comments::ParagraphComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
18
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitFullComment(clang::comments::FullComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
12
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitHTMLEndTagComment(clang::comments::HTMLEndTagComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
1
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitHTMLStartTagComment(clang::comments::HTMLStartTagComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
2
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitInlineCommandComment(clang::comments::InlineCommandComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
1
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitTextComment(clang::comments::TextComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
21
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitVerbatimBlockLineComment(clang::comments::VerbatimBlockLineComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
1
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitBlockCommandComment(clang::comments::BlockCommandComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
69
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitParamCommandComment(clang::comments::ParamCommandComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
31
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitTParamCommandComment(clang::comments::TParamCommandComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
9
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitVerbatimBlockComment(clang::comments::VerbatimBlockComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
14
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitVerbatimLineComment(clang::comments::VerbatimLineComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
4
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitParagraphComment(clang::comments::ParagraphComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
168
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitFullComment(clang::comments::FullComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
120
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitHTMLEndTagComment(clang::comments::HTMLEndTagComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
7
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitHTMLStartTagComment(clang::comments::HTMLStartTagComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
18
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitInlineCommandComment(clang::comments::InlineCommandComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
9
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitTextComment(clang::comments::TextComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
184
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitVerbatimBlockLineComment(clang::comments::VerbatimBlockLineComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
18
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONNodeDumper, void, clang::comments::FullComment const*>::visitParagraphComment(clang::comments::ParagraphComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
18
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONNodeDumper, void, clang::comments::FullComment const*>::visitFullComment(clang::comments::FullComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
12
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::TextNodeDumper, void, clang::comments::FullComment const*>::visitParagraphComment(clang::comments::ParagraphComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
168
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::TextNodeDumper, void, clang::comments::FullComment const*>::visitFullComment(clang::comments::FullComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
120
  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
47
#include "clang/AST/CommentNodes.inc"
48
#undef ABSTRACT_COMMENT
49
#undef COMMENT
50
51
975
  RetTy visitComment(PTR(Comment) C, ParamTys... P) { return RetTy(); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONDumper, void, clang::comments::FullComment const*>::visitComment(clang::comments::Comment const*, clang::comments::FullComment const*)
Line
Count
Source
51
64
  RetTy visitComment(PTR(Comment) C, ParamTys... P) { return RetTy(); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::ASTDumper, void, clang::comments::FullComment const*>::visitComment(clang::comments::Comment const*, clang::comments::FullComment const*)
Line
Count
Source
51
593
  RetTy visitComment(PTR(Comment) C, ParamTys... P) { return RetTy(); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::JSONNodeDumper, void, clang::comments::FullComment const*>::visitComment(clang::comments::Comment const*, clang::comments::FullComment const*)
Line
Count
Source
51
30
  RetTy visitComment(PTR(Comment) C, ParamTys... P) { return RetTy(); }
clang::comments::CommentVisitorBase<llvm::make_const_ptr, clang::TextNodeDumper, void, clang::comments::FullComment const*>::visitComment(clang::comments::Comment const*, clang::comments::FullComment const*)
Line
Count
Source
51
288
  RetTy visitComment(PTR(Comment) C, ParamTys... P) { return RetTy(); }
52
53
#undef PTR
54
#undef DISPATCH
55
};
56
57
template <typename ImplClass, typename RetTy = void, class... ParamTys>
58
class CommentVisitor : public CommentVisitorBase<std::add_pointer, ImplClass,
59
                                                 RetTy, ParamTys...> {};
60
61
template <typename ImplClass, typename RetTy = void, class... ParamTys>
62
class ConstCommentVisitor
63
    : public CommentVisitorBase<llvm::make_const_ptr, ImplClass, RetTy,
64
                                ParamTys...> {};
65
66
} // namespace comments
67
} // namespace clang
68
69
#endif // LLVM_CLANG_AST_COMMENTVISITOR_H