Coverage Report

Created: 2021-01-19 06:58

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/AST/TemplateArgumentVisitor.h
Line
Count
Source (jump to first uncovered line)
1
//===- TemplateArgumentVisitor.h - Visitor for TArg 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
//  This file defines the TemplateArgumentVisitor interface.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_AST_TEMPLATEARGUMENTVISITOR_H
14
#define LLVM_CLANG_AST_TEMPLATEARGUMENTVISITOR_H
15
16
#include "clang/AST/TemplateBase.h"
17
18
namespace clang {
19
20
namespace templateargumentvisitor {
21
22
/// A simple visitor class that helps create template argument visitors.
23
template <template <typename> class Ref, typename ImplClass,
24
          typename RetTy = void, typename... ParamTys>
25
class Base {
26
public:
27
#define REF(CLASS) typename Ref<CLASS>::type
28
#define DISPATCH(NAME)                                                         \
29
1.07k
  case TemplateArgument::NAME:                                                 \
30
1.07k
    return static_cast<ImplClass *>(this)->Visit##NAME##TemplateArgument(      \
31
1.07k
        TA, std::forward<ParamTys>(P)...)
32
33
1.07k
  RetTy Visit(REF(TemplateArgument) TA, ParamTys... P) {
34
1.07k
    switch (TA.getKind()) {
35
0
      DISPATCH(Null);
36
761
      DISPATCH(Type);
37
10
      DISPATCH(Declaration);
38
4
      DISPATCH(NullPtr);
39
144
      DISPATCH(Integral);
40
0
      DISPATCH(UncommonValue);
41
28
      DISPATCH(Template);
42
0
      DISPATCH(TemplateExpansion);
43
82
      DISPATCH(Expression);
44
48
      DISPATCH(Pack);
45
1.07k
    }
46
1.07k
    
llvm_unreachable0
("TemplateArgument is not covered in switch!");
47
1.07k
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::Visit(clang::TemplateArgument const&)
Line
Count
Source
33
530
  RetTy Visit(REF(TemplateArgument) TA, ParamTys... P) {
34
530
    switch (TA.getKind()) {
35
0
      DISPATCH(Null);
36
372
      DISPATCH(Type);
37
5
      DISPATCH(Declaration);
38
2
      DISPATCH(NullPtr);
39
72
      DISPATCH(Integral);
40
0
      DISPATCH(UncommonValue);
41
14
      DISPATCH(Template);
42
0
      DISPATCH(TemplateExpansion);
43
41
      DISPATCH(Expression);
44
24
      DISPATCH(Pack);
45
530
    }
46
0
    llvm_unreachable("TemplateArgument is not covered in switch!");
47
530
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::Visit(clang::TemplateArgument const&)
Line
Count
Source
33
7
  RetTy Visit(REF(TemplateArgument) TA, ParamTys... P) {
34
7
    switch (TA.getKind()) {
35
0
      DISPATCH(Null);
36
7
      DISPATCH(Type);
37
0
      DISPATCH(Declaration);
38
0
      DISPATCH(NullPtr);
39
0
      DISPATCH(Integral);
40
0
      DISPATCH(UncommonValue);
41
0
      DISPATCH(Template);
42
0
      DISPATCH(TemplateExpansion);
43
0
      DISPATCH(Expression);
44
0
      DISPATCH(Pack);
45
7
    }
46
0
    llvm_unreachable("TemplateArgument is not covered in switch!");
47
7
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONNodeDumper, void>::Visit(clang::TemplateArgument const&)
Line
Count
Source
33
10
  RetTy Visit(REF(TemplateArgument) TA, ParamTys... P) {
34
10
    switch (TA.getKind()) {
35
0
      DISPATCH(Null);
36
10
      DISPATCH(Type);
37
0
      DISPATCH(Declaration);
38
0
      DISPATCH(NullPtr);
39
0
      DISPATCH(Integral);
40
0
      DISPATCH(UncommonValue);
41
0
      DISPATCH(Template);
42
0
      DISPATCH(TemplateExpansion);
43
0
      DISPATCH(Expression);
44
0
      DISPATCH(Pack);
45
10
    }
46
0
    llvm_unreachable("TemplateArgument is not covered in switch!");
47
10
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::TextNodeDumper, void>::Visit(clang::TemplateArgument const&)
Line
Count
Source
33
530
  RetTy Visit(REF(TemplateArgument) TA, ParamTys... P) {
34
530
    switch (TA.getKind()) {
35
0
      DISPATCH(Null);
36
372
      DISPATCH(Type);
37
5
      DISPATCH(Declaration);
38
2
      DISPATCH(NullPtr);
39
72
      DISPATCH(Integral);
40
0
      DISPATCH(UncommonValue);
41
14
      DISPATCH(Template);
42
0
      DISPATCH(TemplateExpansion);
43
41
      DISPATCH(Expression);
44
24
      DISPATCH(Pack);
45
530
    }
46
0
    llvm_unreachable("TemplateArgument is not covered in switch!");
47
530
  }
48
49
  // If the implementation chooses not to implement a certain visit
50
  // method, fall back to the parent.
51
52
#define VISIT_METHOD(CATEGORY)                                                 \
53
  RetTy Visit##CATEGORY##TemplateArgument(REF(TemplateArgument) TA,            \
54
93
                                          ParamTys... P) {                     \
55
93
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
56
93
  }
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitNullTemplateArgument(clang::TemplateArgument const&)
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitDeclarationTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
54
5
                                          ParamTys... P) {                     \
55
5
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
56
5
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitNullPtrTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
54
2
                                          ParamTys... P) {                     \
55
2
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
56
2
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitIntegralTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
54
72
                                          ParamTys... P) {                     \
55
72
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
56
72
  }
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitUncommonValueTemplateArgument(clang::TemplateArgument const&)
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitTemplateTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
54
14
                                          ParamTys... P) {                     \
55
14
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
56
14
  }
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitTemplateExpansionTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitNullTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitDeclarationTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitNullPtrTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitIntegralTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitUncommonValueTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitTemplateTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitTemplateExpansionTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONNodeDumper, void>::VisitUncommonValueTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::TextNodeDumper, void>::VisitUncommonValueTemplateArgument(clang::TemplateArgument const&)
57
58
  VISIT_METHOD(Null);
59
  VISIT_METHOD(Type);
60
  VISIT_METHOD(Declaration);
61
  VISIT_METHOD(NullPtr);
62
  VISIT_METHOD(Integral);
63
  VISIT_METHOD(UncommonValue);
64
  VISIT_METHOD(Template);
65
  VISIT_METHOD(TemplateExpansion);
66
  VISIT_METHOD(Expression);
67
  VISIT_METHOD(Pack);
68
69
93
  RetTy VisitTemplateArgument(REF(TemplateArgument), ParamTys...) {
70
93
    return RetTy();
71
93
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
69
93
  RetTy VisitTemplateArgument(REF(TemplateArgument), ParamTys...) {
70
93
    return RetTy();
71
93
  }
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONNodeDumper, void>::VisitTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::TextNodeDumper, void>::VisitTemplateArgument(clang::TemplateArgument const&)
72
73
#undef REF
74
#undef DISPATCH
75
#undef VISIT_METHOD
76
};
77
78
} // namespace templateargumentvisitor
79
80
/// A simple visitor class that helps create template argument visitors.
81
///
82
/// This class does not preserve constness of TemplateArgument references (see
83
/// also ConstTemplateArgumentVisitor).
84
template <typename ImplClass, typename RetTy = void, typename... ParamTys>
85
class TemplateArgumentVisitor
86
    : public templateargumentvisitor::Base<std::add_lvalue_reference, ImplClass,
87
                                           RetTy, ParamTys...> {};
88
89
/// A simple visitor class that helps create template argument visitors.
90
///
91
/// This class preserves constness of TemplateArgument references (see also
92
/// TemplateArgumentVisitor).
93
template <typename ImplClass, typename RetTy = void, typename... ParamTys>
94
class ConstTemplateArgumentVisitor
95
    : public templateargumentvisitor::Base<llvm::make_const_ref, ImplClass,
96
                                           RetTy, ParamTys...> {};
97
98
} // namespace clang
99
100
#endif // LLVM_CLANG_AST_TEMPLATEARGUMENTVISITOR_H