Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/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
429
  case TemplateArgument::NAME:                                                 \
30
429
    return static_cast<ImplClass *>(this)->Visit##NAME##TemplateArgument(      \
31
429
        TA, std::forward<ParamTys>(P)...)
32
33
429
  RetTy Visit(REF(TemplateArgument) TA, ParamTys... P) {
34
429
    switch (TA.getKind()) {
35
429
      
DISPATCH0
(Null);
36
429
      
DISPATCH297
(Type);
37
429
      
DISPATCH2
(Declaration);
38
429
      
DISPATCH2
(NullPtr);
39
429
      
DISPATCH78
(Integral);
40
429
      
DISPATCH12
(Template);
41
429
      
DISPATCH0
(TemplateExpansion);
42
429
      
DISPATCH22
(Expression);
43
429
      
DISPATCH16
(Pack);
44
429
    }
45
429
    
llvm_unreachable0
("TemplateArgument is not covered in switch!");
46
429
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::Visit(clang::TemplateArgument const&)
Line
Count
Source
33
206
  RetTy Visit(REF(TemplateArgument) TA, ParamTys... P) {
34
206
    switch (TA.getKind()) {
35
206
      
DISPATCH0
(Null);
36
206
      
DISPATCH140
(Type);
37
206
      
DISPATCH1
(Declaration);
38
206
      
DISPATCH1
(NullPtr);
39
206
      
DISPATCH39
(Integral);
40
206
      
DISPATCH6
(Template);
41
206
      
DISPATCH0
(TemplateExpansion);
42
206
      
DISPATCH11
(Expression);
43
206
      
DISPATCH8
(Pack);
44
206
    }
45
206
    
llvm_unreachable0
("TemplateArgument is not covered in switch!");
46
  }
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
7
      
DISPATCH0
(Null);
36
7
      DISPATCH(Type);
37
7
      
DISPATCH0
(Declaration);
38
7
      
DISPATCH0
(NullPtr);
39
7
      
DISPATCH0
(Integral);
40
7
      
DISPATCH0
(Template);
41
7
      
DISPATCH0
(TemplateExpansion);
42
7
      
DISPATCH0
(Expression);
43
7
      
DISPATCH0
(Pack);
44
7
    }
45
7
    
llvm_unreachable0
("TemplateArgument is not covered in switch!");
46
  }
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
10
      
DISPATCH0
(Null);
36
10
      DISPATCH(Type);
37
10
      
DISPATCH0
(Declaration);
38
10
      
DISPATCH0
(NullPtr);
39
10
      
DISPATCH0
(Integral);
40
10
      
DISPATCH0
(Template);
41
10
      
DISPATCH0
(TemplateExpansion);
42
10
      
DISPATCH0
(Expression);
43
10
      
DISPATCH0
(Pack);
44
10
    }
45
10
    
llvm_unreachable0
("TemplateArgument is not covered in switch!");
46
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::TextNodeDumper, void>::Visit(clang::TemplateArgument const&)
Line
Count
Source
33
206
  RetTy Visit(REF(TemplateArgument) TA, ParamTys... P) {
34
206
    switch (TA.getKind()) {
35
206
      
DISPATCH0
(Null);
36
206
      
DISPATCH140
(Type);
37
206
      
DISPATCH1
(Declaration);
38
206
      
DISPATCH1
(NullPtr);
39
206
      
DISPATCH39
(Integral);
40
206
      
DISPATCH6
(Template);
41
206
      
DISPATCH0
(TemplateExpansion);
42
206
      
DISPATCH11
(Expression);
43
206
      
DISPATCH8
(Pack);
44
206
    }
45
206
    
llvm_unreachable0
("TemplateArgument is not covered in switch!");
46
  }
47
48
  // If the implementation chooses not to implement a certain visit
49
  // method, fall back to the parent.
50
51
#define VISIT_METHOD(CATEGORY)                                                 \
52
  RetTy Visit##CATEGORY##TemplateArgument(REF(TemplateArgument) TA,            \
53
194
                                          ParamTys... P) {                     \
54
194
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
55
194
  }
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>::VisitTypeTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
53
140
                                          ParamTys... P) {                     \
54
140
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
55
140
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitDeclarationTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
53
1
                                          ParamTys... P) {                     \
54
1
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
55
1
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitNullPtrTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
53
1
                                          ParamTys... P) {                     \
54
1
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
55
1
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitIntegralTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
53
39
                                          ParamTys... P) {                     \
54
39
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
55
39
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitTemplateTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
53
6
                                          ParamTys... P) {                     \
54
6
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
55
6
  }
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&)
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitTypeTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
53
7
                                          ParamTys... P) {                     \
54
7
    return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...);            \
55
7
  }
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>::VisitTemplateTemplateArgument(clang::TemplateArgument const&)
Unexecuted instantiation: clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitTemplateExpansionTemplateArgument(clang::TemplateArgument const&)
56
57
  VISIT_METHOD(Null);
58
  VISIT_METHOD(Type);
59
  VISIT_METHOD(Declaration);
60
  VISIT_METHOD(NullPtr);
61
  VISIT_METHOD(Integral);
62
  VISIT_METHOD(Template);
63
  VISIT_METHOD(TemplateExpansion);
64
  VISIT_METHOD(Expression);
65
  VISIT_METHOD(Pack);
66
67
194
  RetTy VisitTemplateArgument(REF(TemplateArgument), ParamTys...) {
68
194
    return RetTy();
69
194
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::ASTDumper, void>::VisitTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
67
187
  RetTy VisitTemplateArgument(REF(TemplateArgument), ParamTys...) {
68
187
    return RetTy();
69
187
  }
clang::templateargumentvisitor::Base<llvm::make_const_ref, clang::JSONDumper, void>::VisitTemplateArgument(clang::TemplateArgument const&)
Line
Count
Source
67
7
  RetTy VisitTemplateArgument(REF(TemplateArgument), ParamTys...) {
68
7
    return RetTy();
69
7
  }
70
71
#undef REF
72
#undef DISPATCH
73
#undef VISIT_METHOD
74
};
75
76
} // namespace templateargumentvisitor
77
78
/// A simple visitor class that helps create template argument visitors.
79
///
80
/// This class does not preserve constness of TemplateArgument references (see
81
/// also ConstTemplateArgumentVisitor).
82
template <typename ImplClass, typename RetTy = void, typename... ParamTys>
83
class TemplateArgumentVisitor
84
    : public templateargumentvisitor::Base<std::add_lvalue_reference, ImplClass,
85
                                           RetTy, ParamTys...> {};
86
87
/// A simple visitor class that helps create template argument visitors.
88
///
89
/// This class preserves constness of TemplateArgument references (see also
90
/// TemplateArgumentVisitor).
91
template <typename ImplClass, typename RetTy = void, typename... ParamTys>
92
class ConstTemplateArgumentVisitor
93
    : public templateargumentvisitor::Base<llvm::make_const_ref, ImplClass,
94
                                           RetTy, ParamTys...> {};
95
96
} // namespace clang
97
98
#endif // LLVM_CLANG_AST_TEMPLATEARGUMENTVISITOR_H