Coverage Report

Created: 2020-02-25 14:32

/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.74k
  return static_cast<ImplClass *>(this)->visit##NAME(                          \
25
6.74k
      static_cast<PTR(CLASS)>(C), std::forward<ParamTys>(P)...)
26
27
9.57k
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
9.57k
    if (!C)
29
0
      return RetTy();
30
9.57k
31
9.57k
    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.57k
    case Comment::CLASS##Kind: 
DISPATCH5.82k
(CLASS, CLASS);
36
0
#include "clang/AST/CommentNodes.inc"
37
9.57k
#undef ABSTRACT_COMMENT
38
9.57k
#undef COMMENT
39
9.57k
    }
40
9.57k
  }
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
517
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
517
    if (!C)
29
0
      return RetTy();
30
517
31
517
    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
517
#undef ABSTRACT_COMMENT
38
517
#undef COMMENT
39
517
    }
40
517
  }
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
517
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
517
    if (!C)
29
0
      return RetTy();
30
517
31
517
    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
517
#undef ABSTRACT_COMMENT
38
517
#undef COMMENT
39
517
    }
40
517
  }
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.55k
  RetTy visit(PTR(Comment) C, ParamTys... P) {
28
4.55k
    if (!C)
29
0
      return RetTy();
30
4.55k
31
4.55k
    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.55k
#undef ABSTRACT_COMMENT
38
4.55k
#undef COMMENT
39
4.55k
    }
40
4.55k
  }
41
42
  // If the derived class does not implement a certain Visit* method, fall back
43
  // on Visit* method for the superclass.
44
636
#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
208
#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
22
#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
187
#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
147
#define ABSTRACT_COMMENT(COMMENT) COMMENT
45
#define COMMENT(CLASS, PARENT)                                                 \
46
921
  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
61
  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
27
  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
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*>::visitVerbatimBlockComment(clang::comments::VerbatimBlockComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
13
  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
147
  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
105
  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
6
  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
16
  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
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*>::visitTextComment(clang::comments::TextComment const*, clang::comments::FullComment const*)
Line
Count
Source
46
158
  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
17
  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
147
  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
105
  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
863
  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
517
  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
252
  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