Coverage Report

Created: 2022-01-25 06:29

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Sema/TypeLocBuilder.h
Line
Count
Source (jump to first uncovered line)
1
//===--- TypeLocBuilder.h - Type Source Info collector ----------*- 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 TypeLocBuilder, a class for building TypeLocs
10
//  bottom-up.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_CLANG_LIB_SEMA_TYPELOCBUILDER_H
15
#define LLVM_CLANG_LIB_SEMA_TYPELOCBUILDER_H
16
17
#include "clang/AST/ASTContext.h"
18
#include "clang/AST/TypeLoc.h"
19
20
namespace clang {
21
22
class TypeLocBuilder {
23
  enum { InlineCapacity = 8 * sizeof(SourceLocation) };
24
25
  /// The underlying location-data buffer.  Data grows from the end
26
  /// of the buffer backwards.
27
  char *Buffer;
28
29
  /// The capacity of the current buffer.
30
  size_t Capacity;
31
32
  /// The index of the first occupied byte in the buffer.
33
  size_t Index;
34
35
#ifndef NDEBUG
36
  /// The last type pushed on this builder.
37
  QualType LastTy;
38
#endif
39
40
  /// The inline buffer.
41
  enum { BufferMaxAlignment = alignof(void *) };
42
  alignas(BufferMaxAlignment) char InlineBuffer[InlineCapacity];
43
  unsigned NumBytesAtAlign4, NumBytesAtAlign8;
44
45
public:
46
  TypeLocBuilder()
47
      : Buffer(InlineBuffer), Capacity(InlineCapacity), Index(InlineCapacity),
48
17.1M
        NumBytesAtAlign4(0), NumBytesAtAlign8(0) {}
49
50
17.1M
  ~TypeLocBuilder() {
51
17.1M
    if (Buffer != InlineBuffer)
52
1.42M
      delete[] Buffer;
53
17.1M
  }
54
55
  /// Ensures that this buffer has at least as much capacity as described.
56
11.2M
  void reserve(size_t Requested) {
57
11.2M
    if (Requested > Capacity)
58
      // For now, match the request exactly.
59
845k
      grow(Requested);
60
11.2M
  }
61
62
  /// Pushes a copy of the given TypeLoc onto this builder.  The builder
63
  /// must be empty for this to work.
64
  void pushFullCopy(TypeLoc L);
65
66
  /// Pushes space for a typespec TypeLoc.  Invalidates any TypeLocs
67
  /// previously retrieved from this builder.
68
1.37M
  TypeSpecTypeLoc pushTypeSpec(QualType T) {
69
1.37M
    size_t LocalSize = TypeSpecTypeLoc::LocalDataSize;
70
1.37M
    unsigned LocalAlign = TypeSpecTypeLoc::LocalDataAlignment;
71
1.37M
    return pushImpl(T, LocalSize, LocalAlign).castAs<TypeSpecTypeLoc>();
72
1.37M
  }
73
74
  /// Resets this builder to the newly-initialized state.
75
0
  void clear() {
76
0
#ifndef NDEBUG
77
0
    LastTy = QualType();
78
0
#endif
79
0
    Index = Capacity;
80
0
    NumBytesAtAlign4 = NumBytesAtAlign8 = 0;
81
0
  }
82
83
  /// Tell the TypeLocBuilder that the type it is storing has been
84
  /// modified in some safe way that doesn't affect type-location information.
85
1.76M
  void TypeWasModifiedSafely(QualType T) {
86
1.76M
#ifndef NDEBUG
87
1.76M
    LastTy = T;
88
1.76M
#endif
89
1.76M
  }
90
91
  /// Pushes space for a new TypeLoc of the given type.  Invalidates
92
  /// any TypeLocs previously retrieved from this builder.
93
19.1M
  template <class TyLocType> TyLocType push(QualType T) {
94
19.1M
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
19.1M
    size_t LocalSize = Loc.getLocalDataSize();
96
19.1M
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
19.1M
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
19.1M
  }
clang::ObjCObjectPointerTypeLoc clang::TypeLocBuilder::push<clang::ObjCObjectPointerTypeLoc>(clang::QualType)
Line
Count
Source
93
89
  template <class TyLocType> TyLocType push(QualType T) {
94
89
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
89
    size_t LocalSize = Loc.getLocalDataSize();
96
89
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
89
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
89
  }
clang::ArrayTypeLoc clang::TypeLocBuilder::push<clang::ArrayTypeLoc>(clang::QualType)
Line
Count
Source
93
10.3k
  template <class TyLocType> TyLocType push(QualType T) {
94
10.3k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
10.3k
    size_t LocalSize = Loc.getLocalDataSize();
96
10.3k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
10.3k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
10.3k
  }
clang::MatrixTypeLoc clang::TypeLocBuilder::push<clang::MatrixTypeLoc>(clang::QualType)
Line
Count
Source
93
229
  template <class TyLocType> TyLocType push(QualType T) {
94
229
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
229
    size_t LocalSize = Loc.getLocalDataSize();
96
229
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
229
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
229
  }
clang::ReferenceTypeLoc clang::TypeLocBuilder::push<clang::ReferenceTypeLoc>(clang::QualType)
Line
Count
Source
93
115
  template <class TyLocType> TyLocType push(QualType T) {
94
115
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
115
    size_t LocalSize = Loc.getLocalDataSize();
96
115
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
115
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
115
  }
clang::QualifiedTypeLoc clang::TypeLocBuilder::push<clang::QualifiedTypeLoc>(clang::QualType)
Line
Count
Source
93
75
  template <class TyLocType> TyLocType push(QualType T) {
94
75
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
75
    size_t LocalSize = Loc.getLocalDataSize();
96
75
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
75
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
75
  }
clang::AdjustedTypeLoc clang::TypeLocBuilder::push<clang::AdjustedTypeLoc>(clang::QualType)
Line
Count
Source
93
2
  template <class TyLocType> TyLocType push(QualType T) {
94
2
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
2
    size_t LocalSize = Loc.getLocalDataSize();
96
2
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
2
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
2
  }
clang::DecayedTypeLoc clang::TypeLocBuilder::push<clang::DecayedTypeLoc>(clang::QualType)
Line
Count
Source
93
1.06k
  template <class TyLocType> TyLocType push(QualType T) {
94
1.06k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
1.06k
    size_t LocalSize = Loc.getLocalDataSize();
96
1.06k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
1.06k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
1.06k
  }
clang::ConstantArrayTypeLoc clang::TypeLocBuilder::push<clang::ConstantArrayTypeLoc>(clang::QualType)
Line
Count
Source
93
8
  template <class TyLocType> TyLocType push(QualType T) {
94
8
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
8
    size_t LocalSize = Loc.getLocalDataSize();
96
8
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
8
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
8
  }
clang::DependentSizedArrayTypeLoc clang::TypeLocBuilder::push<clang::DependentSizedArrayTypeLoc>(clang::QualType)
Line
Count
Source
93
22
  template <class TyLocType> TyLocType push(QualType T) {
94
22
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
22
    size_t LocalSize = Loc.getLocalDataSize();
96
22
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
22
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
22
  }
clang::IncompleteArrayTypeLoc clang::TypeLocBuilder::push<clang::IncompleteArrayTypeLoc>(clang::QualType)
Line
Count
Source
93
4.53k
  template <class TyLocType> TyLocType push(QualType T) {
94
4.53k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
4.53k
    size_t LocalSize = Loc.getLocalDataSize();
96
4.53k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
4.53k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
4.53k
  }
Unexecuted instantiation: clang::VariableArrayTypeLoc clang::TypeLocBuilder::push<clang::VariableArrayTypeLoc>(clang::QualType)
clang::AtomicTypeLoc clang::TypeLocBuilder::push<clang::AtomicTypeLoc>(clang::QualType)
Line
Count
Source
93
596
  template <class TyLocType> TyLocType push(QualType T) {
94
596
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
596
    size_t LocalSize = Loc.getLocalDataSize();
96
596
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
596
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
596
  }
clang::AttributedTypeLoc clang::TypeLocBuilder::push<clang::AttributedTypeLoc>(clang::QualType)
Line
Count
Source
93
364
  template <class TyLocType> TyLocType push(QualType T) {
94
364
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
364
    size_t LocalSize = Loc.getLocalDataSize();
96
364
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
364
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
364
  }
clang::BitIntTypeLoc clang::TypeLocBuilder::push<clang::BitIntTypeLoc>(clang::QualType)
Line
Count
Source
93
20
  template <class TyLocType> TyLocType push(QualType T) {
94
20
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
20
    size_t LocalSize = Loc.getLocalDataSize();
96
20
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
20
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
20
  }
clang::BlockPointerTypeLoc clang::TypeLocBuilder::push<clang::BlockPointerTypeLoc>(clang::QualType)
Line
Count
Source
93
14
  template <class TyLocType> TyLocType push(QualType T) {
94
14
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
14
    size_t LocalSize = Loc.getLocalDataSize();
96
14
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
14
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
14
  }
clang::BuiltinTypeLoc clang::TypeLocBuilder::push<clang::BuiltinTypeLoc>(clang::QualType)
Line
Count
Source
93
416k
  template <class TyLocType> TyLocType push(QualType T) {
94
416k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
416k
    size_t LocalSize = Loc.getLocalDataSize();
96
416k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
416k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
416k
  }
Unexecuted instantiation: clang::ComplexTypeLoc clang::TypeLocBuilder::push<clang::ComplexTypeLoc>(clang::QualType)
clang::DecltypeTypeLoc clang::TypeLocBuilder::push<clang::DecltypeTypeLoc>(clang::QualType)
Line
Count
Source
93
132k
  template <class TyLocType> TyLocType push(QualType T) {
94
132k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
132k
    size_t LocalSize = Loc.getLocalDataSize();
96
132k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
132k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
132k
  }
clang::AutoTypeLoc clang::TypeLocBuilder::push<clang::AutoTypeLoc>(clang::QualType)
Line
Count
Source
93
64.7k
  template <class TyLocType> TyLocType push(QualType T) {
94
64.7k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
64.7k
    size_t LocalSize = Loc.getLocalDataSize();
96
64.7k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
64.7k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
64.7k
  }
clang::DeducedTemplateSpecializationTypeLoc clang::TypeLocBuilder::push<clang::DeducedTemplateSpecializationTypeLoc>(clang::QualType)
Line
Count
Source
93
507
  template <class TyLocType> TyLocType push(QualType T) {
94
507
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
507
    size_t LocalSize = Loc.getLocalDataSize();
96
507
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
507
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
507
  }
Unexecuted instantiation: clang::DependentAddressSpaceTypeLoc clang::TypeLocBuilder::push<clang::DependentAddressSpaceTypeLoc>(clang::QualType)
clang::DependentBitIntTypeLoc clang::TypeLocBuilder::push<clang::DependentBitIntTypeLoc>(clang::QualType)
Line
Count
Source
93
1
  template <class TyLocType> TyLocType push(QualType T) {
94
1
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
1
    size_t LocalSize = Loc.getLocalDataSize();
96
1
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
1
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
1
  }
clang::DependentNameTypeLoc clang::TypeLocBuilder::push<clang::DependentNameTypeLoc>(clang::QualType)
Line
Count
Source
93
501k
  template <class TyLocType> TyLocType push(QualType T) {
94
501k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
501k
    size_t LocalSize = Loc.getLocalDataSize();
96
501k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
501k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
501k
  }
clang::DependentSizedExtVectorTypeLoc clang::TypeLocBuilder::push<clang::DependentSizedExtVectorTypeLoc>(clang::QualType)
Line
Count
Source
93
2
  template <class TyLocType> TyLocType push(QualType T) {
94
2
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
2
    size_t LocalSize = Loc.getLocalDataSize();
96
2
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
2
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
2
  }
clang::DependentTemplateSpecializationTypeLoc clang::TypeLocBuilder::push<clang::DependentTemplateSpecializationTypeLoc>(clang::QualType)
Line
Count
Source
93
32.0k
  template <class TyLocType> TyLocType push(QualType T) {
94
32.0k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
32.0k
    size_t LocalSize = Loc.getLocalDataSize();
96
32.0k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
32.0k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
32.0k
  }
Unexecuted instantiation: clang::DependentVectorTypeLoc clang::TypeLocBuilder::push<clang::DependentVectorTypeLoc>(clang::QualType)
clang::ElaboratedTypeLoc clang::TypeLocBuilder::push<clang::ElaboratedTypeLoc>(clang::QualType)
Line
Count
Source
93
924k
  template <class TyLocType> TyLocType push(QualType T) {
94
924k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
924k
    size_t LocalSize = Loc.getLocalDataSize();
96
924k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
924k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
924k
  }
Unexecuted instantiation: clang::FunctionNoProtoTypeLoc clang::TypeLocBuilder::push<clang::FunctionNoProtoTypeLoc>(clang::QualType)
clang::FunctionProtoTypeLoc clang::TypeLocBuilder::push<clang::FunctionProtoTypeLoc>(clang::QualType)
Line
Count
Source
93
1.01M
  template <class TyLocType> TyLocType push(QualType T) {
94
1.01M
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
1.01M
    size_t LocalSize = Loc.getLocalDataSize();
96
1.01M
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
1.01M
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
1.01M
  }
clang::InjectedClassNameTypeLoc clang::TypeLocBuilder::push<clang::InjectedClassNameTypeLoc>(clang::QualType)
Line
Count
Source
93
1.23k
  template <class TyLocType> TyLocType push(QualType T) {
94
1.23k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
1.23k
    size_t LocalSize = Loc.getLocalDataSize();
96
1.23k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
1.23k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
1.23k
  }
clang::MacroQualifiedTypeLoc clang::TypeLocBuilder::push<clang::MacroQualifiedTypeLoc>(clang::QualType)
Line
Count
Source
93
23
  template <class TyLocType> TyLocType push(QualType T) {
94
23
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
23
    size_t LocalSize = Loc.getLocalDataSize();
96
23
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
23
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
23
  }
clang::ConstantMatrixTypeLoc clang::TypeLocBuilder::push<clang::ConstantMatrixTypeLoc>(clang::QualType)
Line
Count
Source
93
130
  template <class TyLocType> TyLocType push(QualType T) {
94
130
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
130
    size_t LocalSize = Loc.getLocalDataSize();
96
130
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
130
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
130
  }
Unexecuted instantiation: clang::DependentSizedMatrixTypeLoc clang::TypeLocBuilder::push<clang::DependentSizedMatrixTypeLoc>(clang::QualType)
clang::MemberPointerTypeLoc clang::TypeLocBuilder::push<clang::MemberPointerTypeLoc>(clang::QualType)
Line
Count
Source
93
441
  template <class TyLocType> TyLocType push(QualType T) {
94
441
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
441
    size_t LocalSize = Loc.getLocalDataSize();
96
441
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
441
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
441
  }
clang::ObjCObjectTypeLoc clang::TypeLocBuilder::push<clang::ObjCObjectTypeLoc>(clang::QualType)
Line
Count
Source
93
15
  template <class TyLocType> TyLocType push(QualType T) {
94
15
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
15
    size_t LocalSize = Loc.getLocalDataSize();
96
15
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
15
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
15
  }
clang::ObjCInterfaceTypeLoc clang::TypeLocBuilder::push<clang::ObjCInterfaceTypeLoc>(clang::QualType)
Line
Count
Source
93
28
  template <class TyLocType> TyLocType push(QualType T) {
94
28
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
28
    size_t LocalSize = Loc.getLocalDataSize();
96
28
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
28
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
28
  }
Unexecuted instantiation: clang::ObjCTypeParamTypeLoc clang::TypeLocBuilder::push<clang::ObjCTypeParamTypeLoc>(clang::QualType)
clang::PackExpansionTypeLoc clang::TypeLocBuilder::push<clang::PackExpansionTypeLoc>(clang::QualType)
Line
Count
Source
93
313k
  template <class TyLocType> TyLocType push(QualType T) {
94
313k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
313k
    size_t LocalSize = Loc.getLocalDataSize();
96
313k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
313k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
313k
  }
clang::ParenTypeLoc clang::TypeLocBuilder::push<clang::ParenTypeLoc>(clang::QualType)
Line
Count
Source
93
6.42k
  template <class TyLocType> TyLocType push(QualType T) {
94
6.42k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
6.42k
    size_t LocalSize = Loc.getLocalDataSize();
96
6.42k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
6.42k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
6.42k
  }
Unexecuted instantiation: clang::PipeTypeLoc clang::TypeLocBuilder::push<clang::PipeTypeLoc>(clang::QualType)
clang::PointerTypeLoc clang::TypeLocBuilder::push<clang::PointerTypeLoc>(clang::QualType)
Line
Count
Source
93
388k
  template <class TyLocType> TyLocType push(QualType T) {
94
388k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
388k
    size_t LocalSize = Loc.getLocalDataSize();
96
388k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
388k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
388k
  }
clang::LValueReferenceTypeLoc clang::TypeLocBuilder::push<clang::LValueReferenceTypeLoc>(clang::QualType)
Line
Count
Source
93
686k
  template <class TyLocType> TyLocType push(QualType T) {
94
686k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
686k
    size_t LocalSize = Loc.getLocalDataSize();
96
686k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
686k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
686k
  }
clang::RValueReferenceTypeLoc clang::TypeLocBuilder::push<clang::RValueReferenceTypeLoc>(clang::QualType)
Line
Count
Source
93
233k
  template <class TyLocType> TyLocType push(QualType T) {
94
233k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
233k
    size_t LocalSize = Loc.getLocalDataSize();
96
233k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
233k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
233k
  }
clang::SubstTemplateTypeParmPackTypeLoc clang::TypeLocBuilder::push<clang::SubstTemplateTypeParmPackTypeLoc>(clang::QualType)
Line
Count
Source
93
43.0k
  template <class TyLocType> TyLocType push(QualType T) {
94
43.0k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
43.0k
    size_t LocalSize = Loc.getLocalDataSize();
96
43.0k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
43.0k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
43.0k
  }
clang::SubstTemplateTypeParmTypeLoc clang::TypeLocBuilder::push<clang::SubstTemplateTypeParmTypeLoc>(clang::QualType)
Line
Count
Source
93
4.76M
  template <class TyLocType> TyLocType push(QualType T) {
94
4.76M
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
4.76M
    size_t LocalSize = Loc.getLocalDataSize();
96
4.76M
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
4.76M
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
4.76M
  }
clang::EnumTypeLoc clang::TypeLocBuilder::push<clang::EnumTypeLoc>(clang::QualType)
Line
Count
Source
93
5.02k
  template <class TyLocType> TyLocType push(QualType T) {
94
5.02k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
5.02k
    size_t LocalSize = Loc.getLocalDataSize();
96
5.02k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
5.02k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
5.02k
  }
clang::RecordTypeLoc clang::TypeLocBuilder::push<clang::RecordTypeLoc>(clang::QualType)
Line
Count
Source
93
149k
  template <class TyLocType> TyLocType push(QualType T) {
94
149k
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
149k
    size_t LocalSize = Loc.getLocalDataSize();
96
149k
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
149k
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
149k
  }
clang::TemplateSpecializationTypeLoc clang::TypeLocBuilder::push<clang::TemplateSpecializationTypeLoc>(clang::QualType)
Line
Count
Source
93
6.42M
  template <class TyLocType> TyLocType push(QualType T) {
94
6.42M
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
6.42M
    size_t LocalSize = Loc.getLocalDataSize();
96
6.42M
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
6.42M
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
6.42M
  }
clang::TemplateTypeParmTypeLoc clang::TypeLocBuilder::push<clang::TemplateTypeParmTypeLoc>(clang::QualType)
Line
Count
Source
93
1.66M
  template <class TyLocType> TyLocType push(QualType T) {
94
1.66M
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
1.66M
    size_t LocalSize = Loc.getLocalDataSize();
96
1.66M
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
1.66M
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
1.66M
  }
clang::TypeOfExprTypeLoc clang::TypeLocBuilder::push<clang::TypeOfExprTypeLoc>(clang::QualType)
Line
Count
Source
93
321
  template <class TyLocType> TyLocType push(QualType T) {
94
321
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
321
    size_t LocalSize = Loc.getLocalDataSize();
96
321
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
321
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
321
  }
clang::TypeOfTypeLoc clang::TypeLocBuilder::push<clang::TypeOfTypeLoc>(clang::QualType)
Line
Count
Source
93
2
  template <class TyLocType> TyLocType push(QualType T) {
94
2
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
2
    size_t LocalSize = Loc.getLocalDataSize();
96
2
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
2
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
2
  }
clang::TypedefTypeLoc clang::TypeLocBuilder::push<clang::TypedefTypeLoc>(clang::QualType)
Line
Count
Source
93
1.35M
  template <class TyLocType> TyLocType push(QualType T) {
94
1.35M
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
1.35M
    size_t LocalSize = Loc.getLocalDataSize();
96
1.35M
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
1.35M
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
1.35M
  }
clang::UnaryTransformTypeLoc clang::TypeLocBuilder::push<clang::UnaryTransformTypeLoc>(clang::QualType)
Line
Count
Source
93
984
  template <class TyLocType> TyLocType push(QualType T) {
94
984
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
984
    size_t LocalSize = Loc.getLocalDataSize();
96
984
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
984
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
984
  }
clang::UnresolvedUsingTypeLoc clang::TypeLocBuilder::push<clang::UnresolvedUsingTypeLoc>(clang::QualType)
Line
Count
Source
93
1
  template <class TyLocType> TyLocType push(QualType T) {
94
1
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
1
    size_t LocalSize = Loc.getLocalDataSize();
96
1
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
1
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
1
  }
Unexecuted instantiation: clang::UsingTypeLoc clang::TypeLocBuilder::push<clang::UsingTypeLoc>(clang::QualType)
clang::VectorTypeLoc clang::TypeLocBuilder::push<clang::VectorTypeLoc>(clang::QualType)
Line
Count
Source
93
45
  template <class TyLocType> TyLocType push(QualType T) {
94
45
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
45
    size_t LocalSize = Loc.getLocalDataSize();
96
45
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
45
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
45
  }
clang::ExtVectorTypeLoc clang::TypeLocBuilder::push<clang::ExtVectorTypeLoc>(clang::QualType)
Line
Count
Source
93
16
  template <class TyLocType> TyLocType push(QualType T) {
94
16
    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
95
16
    size_t LocalSize = Loc.getLocalDataSize();
96
16
    unsigned LocalAlign = Loc.getLocalDataAlignment();
97
16
    return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
98
16
  }
99
100
  /// Creates a TypeSourceInfo for the given type.
101
15.2M
  TypeSourceInfo *getTypeSourceInfo(ASTContext& Context, QualType T) {
102
15.2M
#ifndef NDEBUG
103
15.2M
    assert(T == LastTy && "type doesn't match last type pushed!");
104
0
#endif
105
106
0
    size_t FullDataSize = Capacity - Index;
107
15.2M
    TypeSourceInfo *DI = Context.CreateTypeSourceInfo(T, FullDataSize);
108
15.2M
    memcpy(DI->getTypeLoc().getOpaqueData(), &Buffer[Index], FullDataSize);
109
15.2M
    return DI;
110
15.2M
  }
111
112
  /// Copies the type-location information to the given AST context and
113
  /// returns a \c TypeLoc referring into the AST context.
114
1.65M
  TypeLoc getTypeLocInContext(ASTContext &Context, QualType T) {
115
1.65M
#ifndef NDEBUG
116
1.65M
    assert(T == LastTy && "type doesn't match last type pushed!");
117
0
#endif
118
119
0
    size_t FullDataSize = Capacity - Index;
120
1.65M
    void *Mem = Context.Allocate(FullDataSize);
121
1.65M
    memcpy(Mem, &Buffer[Index], FullDataSize);
122
1.65M
    return TypeLoc(T, Mem);
123
1.65M
  }
124
125
private:
126
127
  TypeLoc pushImpl(QualType T, size_t LocalSize, unsigned LocalAlignment);
128
129
  /// Grow to the given capacity.
130
  void grow(size_t NewCapacity);
131
132
  /// Retrieve a temporary TypeLoc that refers into this \c TypeLocBuilder
133
  /// object.
134
  ///
135
  /// The resulting \c TypeLoc should only be used so long as the
136
  /// \c TypeLocBuilder is active and has not had more type information
137
  /// pushed into it.
138
20.5M
  TypeLoc getTemporaryTypeLoc(QualType T) {
139
20.5M
#ifndef NDEBUG
140
20.5M
    assert(LastTy == T && "type doesn't match last type pushed!");
141
0
#endif
142
0
    return TypeLoc(T, &Buffer[Index]);
143
20.5M
  }
144
};
145
146
}
147
148
#endif