Coverage Report

Created: 2020-09-22 08:39

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/AST/AbstractBasicReader.h
Line
Count
Source (jump to first uncovered line)
1
//==--- AbstractBasiceReader.h - Abstract basic value deserialization -----===//
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 CLANG_AST_ABSTRACTBASICREADER_H
10
#define CLANG_AST_ABSTRACTBASICREADER_H
11
12
#include "clang/AST/DeclTemplate.h"
13
14
namespace clang {
15
namespace serialization {
16
17
template <class T>
18
321
inline T makeNullableFromOptional(const Optional<T> &value) {
19
244
  return (value ? *value : 
T()77
);
20
321
}
clang::QualType clang::serialization::makeNullableFromOptional<clang::QualType>(llvm::Optional<clang::QualType> const&)
Line
Count
Source
18
312
inline T makeNullableFromOptional(const Optional<T> &value) {
19
235
  return (value ? *value : 
T()77
);
20
312
}
clang::TemplateName clang::serialization::makeNullableFromOptional<clang::TemplateName>(llvm::Optional<clang::TemplateName> const&)
Line
Count
Source
18
9
inline T makeNullableFromOptional(const Optional<T> &value) {
19
9
  return (value ? *value : 
T()0
);
20
9
}
21
22
template <class T>
23
898k
inline T *makePointerFromOptional(Optional<T *> value) {
24
850k
  return (value ? *value : 
nullptr48.3k
);
25
898k
}
clang::ConceptDecl* clang::serialization::makePointerFromOptional<clang::ConceptDecl>(llvm::Optional<clang::ConceptDecl*>)
Line
Count
Source
23
312
inline T *makePointerFromOptional(Optional<T *> value) {
24
312
  return (value ? 
*value0
: nullptr);
25
312
}
clang::TagDecl* clang::serialization::makePointerFromOptional<clang::TagDecl>(llvm::Optional<clang::TagDecl*>)
Line
Count
Source
23
44.7k
inline T *makePointerFromOptional(Optional<T *> value) {
24
38.0k
  return (value ? 
*value6.72k
: nullptr);
25
44.7k
}
clang::TemplateTypeParmDecl* clang::serialization::makePointerFromOptional<clang::TemplateTypeParmDecl>(llvm::Optional<clang::TemplateTypeParmDecl*>)
Line
Count
Source
23
853k
inline T *makePointerFromOptional(Optional<T *> value) {
24
843k
  return (value ? *value : 
nullptr10.0k
);
25
853k
}
26
27
// PropertyReader is a class concept that requires the following method:
28
//   BasicReader find(llvm::StringRef propertyName);
29
// where BasicReader is some class conforming to the BasicReader concept.
30
// An abstract AST-node reader is created with a PropertyReader and
31
// performs a sequence of calls like so:
32
//   propertyReader.find(propertyName).read##TypeName()
33
// to read the properties of the node it is deserializing.
34
35
// BasicReader is a class concept that requires methods like:
36
//   ValueType read##TypeName();
37
// where TypeName is the name of a PropertyType node from PropertiesBase.td
38
// and ValueType is the corresponding C++ type name.  The read method may
39
// require one or more buffer arguments.
40
//
41
// In addition to the concrete type names, BasicReader is expected to
42
// implement these methods:
43
//
44
//   template <class EnumType>
45
//   void writeEnum(T value);
46
//
47
//     Reads an enum value from the current property.  EnumType will always
48
//     be an enum type.  Only necessary if the BasicReader doesn't provide
49
//     type-specific readers for all the enum types.
50
//
51
//   template <class ValueType>
52
//   Optional<ValueType> writeOptional();
53
//
54
//     Reads an optional value from the current property.
55
//
56
//   template <class ValueType>
57
//   ArrayRef<ValueType> readArray(llvm::SmallVectorImpl<ValueType> &buffer);
58
//
59
//     Reads an array of values from the current property.
60
//
61
//   PropertyReader readObject();
62
//
63
//     Reads an object from the current property; the returned property
64
//     reader will be subjected to a sequence of property reads and then
65
//     discarded before any other properties are reader from the "outer"
66
//     property reader (which need not be the same type).  The sub-reader
67
//     will be used as if with the following code:
68
//
69
//       {
70
//         auto &&widget = W.find("widget").readObject();
71
//         auto kind = widget.find("kind").readWidgetKind();
72
//         auto declaration = widget.find("declaration").readDeclRef();
73
//         return Widget(kind, declaration);
74
//       }
75
76
// ReadDispatcher does type-based forwarding to one of the read methods
77
// on the BasicReader passed in:
78
//
79
// template <class ValueType>
80
// struct ReadDispatcher {
81
//   template <class BasicReader, class... BufferTypes>
82
//   static ValueType read(BasicReader &R, BufferTypes &&...);
83
// };
84
85
// BasicReaderBase provides convenience implementations of the read methods
86
// for EnumPropertyType and SubclassPropertyType types that just defer to
87
// the "underlying" implementations (for UInt32 and the base class,
88
// respectively).
89
//
90
// template <class Impl>
91
// class BasicReaderBase {
92
// protected:
93
//   BasicReaderBase(ASTContext &ctx);
94
//   Impl &asImpl();
95
// public:
96
//   ASTContext &getASTContext();
97
//   ...
98
// };
99
100
// The actual classes are auto-generated; see ClangASTPropertiesEmitter.cpp.
101
#include "clang/AST/AbstractBasicReader.inc"
102
103
/// DataStreamBasicReader provides convenience implementations for many
104
/// BasicReader methods based on the assumption that the
105
/// ultimate reader implementation is based on a variable-length stream
106
/// of unstructured data (like Clang's module files).  It is designed
107
/// to pair with DataStreamBasicWriter.
108
///
109
/// This class can also act as a PropertyReader, implementing find("...")
110
/// by simply forwarding to itself.
111
///
112
/// Unimplemented methods:
113
///   readBool
114
///   readUInt32
115
///   readUInt64
116
///   readIdentifier
117
///   readSelector
118
///   readSourceLocation
119
///   readQualType
120
///   readStmtRef
121
///   readDeclRef
122
template <class Impl>
123
class DataStreamBasicReader : public BasicReaderBase<Impl> {
124
protected:
125
  using BasicReaderBase<Impl>::asImpl;
126
9.08M
  DataStreamBasicReader(ASTContext &ctx) : BasicReaderBase<Impl>(ctx) {}
127
128
public:
129
  using BasicReaderBase<Impl>::getASTContext;
130
131
  /// Implement property-find by ignoring it.  We rely on properties being
132
  /// serialized and deserialized in a reliable order instead.
133
32.9M
  Impl &find(const char *propertyName) {
134
32.9M
    return asImpl();
135
32.9M
  }
136
137
  template <class T>
138
10.0M
  T readEnum() {
139
10.0M
    return T(asImpl().readUInt32());
140
10.0M
  }
clang::TemplateArgument::ArgKind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::TemplateArgument::ArgKind>()
Line
Count
Source
138
2.94M
  T readEnum() {
139
2.94M
    return T(asImpl().readUInt32());
140
2.94M
  }
clang::TemplateName::NameKind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::TemplateName::NameKind>()
Line
Count
Source
138
720k
  T readEnum() {
139
720k
    return T(asImpl().readUInt32());
140
720k
  }
clang::OverloadedOperatorKind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::OverloadedOperatorKind>()
Line
Count
Source
138
182k
  T readEnum() {
139
182k
    return T(asImpl().readUInt32());
140
182k
  }
clang::ArrayType::ArraySizeModifier clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::ArrayType::ArraySizeModifier>()
Line
Count
Source
138
15.3k
  T readEnum() {
139
15.3k
    return T(asImpl().readUInt32());
140
15.3k
  }
clang::attr::Kind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::attr::Kind>()
Line
Count
Source
138
7.02k
  T readEnum() {
139
7.02k
    return T(asImpl().readUInt32());
140
7.02k
  }
Unexecuted instantiation: clang::BuiltinType::Kind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::BuiltinType::Kind>()
clang::AutoTypeKeyword clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::AutoTypeKeyword>()
Line
Count
Source
138
312
  T readEnum() {
139
312
    return T(asImpl().readUInt32());
140
312
  }
clang::ElaboratedTypeKeyword clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::ElaboratedTypeKeyword>()
Line
Count
Source
138
187k
  T readEnum() {
139
187k
    return T(asImpl().readUInt32());
140
187k
  }
clang::VectorType::VectorKind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::VectorType::VectorKind>()
Line
Count
Source
138
695
  T readEnum() {
139
695
    return T(asImpl().readUInt32());
140
695
  }
clang::CallingConv clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::CallingConv>()
Line
Count
Source
138
341k
  T readEnum() {
139
341k
    return T(asImpl().readUInt32());
140
341k
  }
clang::RefQualifierKind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::RefQualifierKind>()
Line
Count
Source
138
341k
  T readEnum() {
139
341k
    return T(asImpl().readUInt32());
140
341k
  }
clang::UnaryTransformType::UTTKind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::UnaryTransformType::UTTKind>()
Line
Count
Source
138
29
  T readEnum() {
139
29
    return T(asImpl().readUInt32());
140
29
  }
clang::DeclarationName::NameKind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::DeclarationName::NameKind>()
Line
Count
Source
138
4.70M
  T readEnum() {
139
4.70M
    return T(asImpl().readUInt32());
140
4.70M
  }
clang::NestedNameSpecifier::SpecifierKind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::NestedNameSpecifier::SpecifierKind>()
Line
Count
Source
138
615k
  T readEnum() {
139
615k
    return T(asImpl().readUInt32());
140
615k
  }
clang::OpenMPReductionClauseModifier clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::OpenMPReductionClauseModifier>()
Line
Count
Source
138
877
  T readEnum() {
139
877
    return T(asImpl().readUInt32());
140
877
  }
clang::OpenMPDependClauseKind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::OpenMPDependClauseKind>()
Line
Count
Source
138
8
  T readEnum() {
139
8
    return T(asImpl().readUInt32());
140
8
  }
clang::OpenMPLastprivateModifier clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::OpenMPLastprivateModifier>()
Line
Count
Source
138
394
  T readEnum() {
139
394
    return T(asImpl().readUInt32());
140
394
  }
clang::OpenMPDeviceClauseModifier clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::OpenMPDeviceClauseModifier>()
Line
Count
Source
138
333
  T readEnum() {
139
333
    return T(asImpl().readUInt32());
140
333
  }
clang::OpenMPOrderClauseKind clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::OpenMPOrderClauseKind>()
Line
Count
Source
138
43
  T readEnum() {
139
43
    return T(asImpl().readUInt32());
140
43
  }
llvm::omp::TraitSet clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<llvm::omp::TraitSet>()
Line
Count
Source
138
635
  T readEnum() {
139
635
    return T(asImpl().readUInt32());
140
635
  }
llvm::omp::TraitSelector clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<llvm::omp::TraitSelector>()
Line
Count
Source
138
635
  T readEnum() {
139
635
    return T(asImpl().readUInt32());
140
635
  }
llvm::omp::TraitProperty clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<llvm::omp::TraitProperty>()
Line
Count
Source
138
1.03k
  T readEnum() {
139
1.03k
    return T(asImpl().readUInt32());
140
1.03k
  }
Unexecuted instantiation: clang::OMPDeclareTargetDeclAttr::MapTypeTy clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::OMPDeclareTargetDeclAttr::MapTypeTy>()
Unexecuted instantiation: clang::OMPDeclareTargetDeclAttr::DevTypeTy clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<clang::OMPDeclareTargetDeclAttr::DevTypeTy>()
llvm::omp::Directive clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readEnum<llvm::omp::Directive>()
Line
Count
Source
138
228
  T readEnum() {
139
228
    return T(asImpl().readUInt32());
140
228
  }
141
142
  // Implement object reading by forwarding to this, collapsing the
143
  // structure into a single data stream.
144
8.37M
  Impl &readObject() { return asImpl(); }
145
146
  template <class T>
147
1.48M
  llvm::ArrayRef<T> readArray(llvm::SmallVectorImpl<T> &buffer) {
148
1.48M
    assert(buffer.empty());
149
150
1.48M
    uint32_t size = asImpl().readUInt32();
151
1.48M
    buffer.reserve(size);
152
153
3.33M
    for (uint32_t i = 0; i != size; 
++i1.85M
) {
154
1.85M
      buffer.push_back(ReadDispatcher<T>::read(asImpl()));
155
1.85M
    }
156
1.48M
    return buffer;
157
1.48M
  }
Unexecuted instantiation: llvm::ArrayRef<clang::NamedDecl*> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readArray<clang::NamedDecl*>(llvm::SmallVectorImpl<clang::NamedDecl*>&)
llvm::ArrayRef<clang::TemplateArgument> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readArray<clang::TemplateArgument>(llvm::SmallVectorImpl<clang::TemplateArgument>&)
Line
Count
Source
147
770k
  llvm::ArrayRef<T> readArray(llvm::SmallVectorImpl<T> &buffer) {
148
770k
    assert(buffer.empty());
149
150
770k
    uint32_t size = asImpl().readUInt32();
151
770k
    buffer.reserve(size);
152
153
2.08M
    for (uint32_t i = 0; i != size; 
++i1.31M
) {
154
1.31M
      buffer.push_back(ReadDispatcher<T>::read(asImpl()));
155
1.31M
    }
156
770k
    return buffer;
157
770k
  }
llvm::ArrayRef<clang::QualType> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readArray<clang::QualType>(llvm::SmallVectorImpl<clang::QualType>&)
Line
Count
Source
147
343k
  llvm::ArrayRef<T> readArray(llvm::SmallVectorImpl<T> &buffer) {
148
343k
    assert(buffer.empty());
149
150
343k
    uint32_t size = asImpl().readUInt32();
151
343k
    buffer.reserve(size);
152
153
887k
    for (uint32_t i = 0; i != size; 
++i543k
) {
154
543k
      buffer.push_back(ReadDispatcher<T>::read(asImpl()));
155
543k
    }
156
343k
    return buffer;
157
343k
  }
llvm::ArrayRef<clang::FunctionType::ExtParameterInfo> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readArray<clang::FunctionType::ExtParameterInfo>(llvm::SmallVectorImpl<clang::FunctionType::ExtParameterInfo>&)
Line
Count
Source
147
341k
  llvm::ArrayRef<T> readArray(llvm::SmallVectorImpl<T> &buffer) {
148
341k
    assert(buffer.empty());
149
150
341k
    uint32_t size = asImpl().readUInt32();
151
341k
    buffer.reserve(size);
152
153
341k
    for (uint32_t i = 0; i != size; 
++i4
) {
154
4
      buffer.push_back(ReadDispatcher<T>::read(asImpl()));
155
4
    }
156
341k
    return buffer;
157
341k
  }
llvm::ArrayRef<clang::ObjCProtocolDecl*> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readArray<clang::ObjCProtocolDecl*>(llvm::SmallVectorImpl<clang::ObjCProtocolDecl*>&)
Line
Count
Source
147
30.3k
  llvm::ArrayRef<T> readArray(llvm::SmallVectorImpl<T> &buffer) {
148
30.3k
    assert(buffer.empty());
149
150
30.3k
    uint32_t size = asImpl().readUInt32();
151
30.3k
    buffer.reserve(size);
152
153
30.7k
    for (uint32_t i = 0; i != size; 
++i366
) {
154
366
      buffer.push_back(ReadDispatcher<T>::read(asImpl()));
155
366
    }
156
30.3k
    return buffer;
157
30.3k
  }
158
159
  template <class T, class... Args>
160
1.91M
  llvm::Optional<T> readOptional(Args &&...args) {
161
1.91M
    return UnpackOptionalValue<T>::unpack(
162
1.91M
             ReadDispatcher<T>::read(asImpl(), std::forward<Args>(args)...));
163
1.91M
  }
llvm::Optional<clang::IdentifierInfo*> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readOptional<clang::IdentifierInfo*>()
Line
Count
Source
160
188
  llvm::Optional<T> readOptional(Args &&...args) {
161
188
    return UnpackOptionalValue<T>::unpack(
162
188
             ReadDispatcher<T>::read(asImpl(), std::forward<Args>(args)...));
163
188
  }
llvm::Optional<unsigned int> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readOptional<unsigned int>()
Line
Count
Source
160
20.7k
  llvm::Optional<T> readOptional(Args &&...args) {
161
20.7k
    return UnpackOptionalValue<T>::unpack(
162
20.7k
             ReadDispatcher<T>::read(asImpl(), std::forward<Args>(args)...));
163
20.7k
  }
llvm::Optional<clang::QualType> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readOptional<clang::QualType>()
Line
Count
Source
160
996k
  llvm::Optional<T> readOptional(Args &&...args) {
161
996k
    return UnpackOptionalValue<T>::unpack(
162
996k
             ReadDispatcher<T>::read(asImpl(), std::forward<Args>(args)...));
163
996k
  }
llvm::Optional<clang::ConceptDecl*> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readOptional<clang::ConceptDecl*>()
Line
Count
Source
160
312
  llvm::Optional<T> readOptional(Args &&...args) {
161
312
    return UnpackOptionalValue<T>::unpack(
162
312
             ReadDispatcher<T>::read(asImpl(), std::forward<Args>(args)...));
163
312
  }
llvm::Optional<clang::TemplateName> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readOptional<clang::TemplateName>()
Line
Count
Source
160
9
  llvm::Optional<T> readOptional(Args &&...args) {
161
9
    return UnpackOptionalValue<T>::unpack(
162
9
             ReadDispatcher<T>::read(asImpl(), std::forward<Args>(args)...));
163
9
  }
llvm::Optional<clang::TagDecl*> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readOptional<clang::TagDecl*>()
Line
Count
Source
160
44.7k
  llvm::Optional<T> readOptional(Args &&...args) {
161
44.7k
    return UnpackOptionalValue<T>::unpack(
162
44.7k
             ReadDispatcher<T>::read(asImpl(), std::forward<Args>(args)...));
163
44.7k
  }
llvm::Optional<clang::TemplateTypeParmDecl*> clang::serialization::DataStreamBasicReader<clang::ASTRecordReader>::readOptional<clang::TemplateTypeParmDecl*>()
Line
Count
Source
160
853k
  llvm::Optional<T> readOptional(Args &&...args) {
161
853k
    return UnpackOptionalValue<T>::unpack(
162
853k
             ReadDispatcher<T>::read(asImpl(), std::forward<Args>(args)...));
163
853k
  }
164
165
242k
  llvm::APSInt readAPSInt() {
166
242k
    bool isUnsigned = asImpl().readBool();
167
242k
    llvm::APInt value = asImpl().readAPInt();
168
242k
    return llvm::APSInt(std::move(value), isUnsigned);
169
242k
  }
170
171
424k
  llvm::APInt readAPInt() {
172
424k
    unsigned bitWidth = asImpl().readUInt32();
173
424k
    unsigned numWords = llvm::APInt::getNumWords(bitWidth);
174
424k
    llvm::SmallVector<uint64_t, 4> data;
175
848k
    for (uint32_t i = 0; i != numWords; 
++i424k
)
176
424k
      data.push_back(asImpl().readUInt64());
177
424k
    return llvm::APInt(bitWidth, numWords, &data[0]);
178
424k
  }
179
180
  Qualifiers readQualifiers() {
181
    static_assert(sizeof(Qualifiers().getAsOpaqueValue()) <= sizeof(uint32_t),
182
                  "update this if the value size changes");
183
    uint32_t value = asImpl().readUInt32();
184
    return Qualifiers::fromOpaqueValue(value);
185
  }
186
187
  FunctionProtoType::ExceptionSpecInfo
188
341k
  readExceptionSpecInfo(llvm::SmallVectorImpl<QualType> &buffer) {
189
341k
    FunctionProtoType::ExceptionSpecInfo esi;
190
341k
    esi.Type = ExceptionSpecificationType(asImpl().readUInt32());
191
341k
    if (esi.Type == EST_Dynamic) {
192
4
      esi.Exceptions = asImpl().template readArray<QualType>(buffer);
193
341k
    } else if (isComputedNoexcept(esi.Type)) {
194
22.7k
      esi.NoexceptExpr = asImpl().readExprRef();
195
318k
    } else if (esi.Type == EST_Uninstantiated) {
196
789
      esi.SourceDecl = asImpl().readFunctionDeclRef();
197
789
      esi.SourceTemplate = asImpl().readFunctionDeclRef();
198
317k
    } else if (esi.Type == EST_Unevaluated) {
199
7.84k
      esi.SourceDecl = asImpl().readFunctionDeclRef();
200
7.84k
    }
201
341k
    return esi;
202
341k
  }
203
204
4
  FunctionProtoType::ExtParameterInfo readExtParameterInfo() {
205
4
    static_assert(sizeof(FunctionProtoType::ExtParameterInfo().getOpaqueValue())
206
4
                    <= sizeof(uint32_t),
207
4
                  "opaque value doesn't fit into uint32_t");
208
4
    uint32_t value = asImpl().readUInt32();
209
4
    return FunctionProtoType::ExtParameterInfo::getFromOpaqueValue(value);
210
4
  }
211
212
188k
  NestedNameSpecifier *readNestedNameSpecifier() {
213
188k
    auto &ctx = getASTContext();
214
215
    // We build this up iteratively.
216
188k
    NestedNameSpecifier *cur = nullptr;
217
218
188k
    uint32_t depth = asImpl().readUInt32();
219
369k
    for (uint32_t i = 0; i != depth; 
++i181k
) {
220
181k
      auto kind = asImpl().readNestedNameSpecifierKind();
221
181k
      switch (kind) {
222
175
      case NestedNameSpecifier::Identifier:
223
175
        cur = NestedNameSpecifier::Create(ctx, cur,
224
175
                                          asImpl().readIdentifier());
225
175
        continue;
226
227
4.75k
      case NestedNameSpecifier::Namespace:
228
4.75k
        cur = NestedNameSpecifier::Create(ctx, cur,
229
4.75k
                                          asImpl().readNamespaceDeclRef());
230
4.75k
        continue;
231
232
4
      case NestedNameSpecifier::NamespaceAlias:
233
4
        cur = NestedNameSpecifier::Create(ctx, cur,
234
4
                                     asImpl().readNamespaceAliasDeclRef());
235
4
        continue;
236
237
176k
      case NestedNameSpecifier::TypeSpec:
238
176k
      case NestedNameSpecifier::TypeSpecWithTemplate:
239
176k
        cur = NestedNameSpecifier::Create(ctx, cur,
240
176k
                          kind == NestedNameSpecifier::TypeSpecWithTemplate,
241
176k
                          asImpl().readQualType().getTypePtr());
242
176k
        continue;
243
244
6
      case NestedNameSpecifier::Global:
245
6
        cur = NestedNameSpecifier::GlobalSpecifier(ctx);
246
6
        continue;
247
248
0
      case NestedNameSpecifier::Super:
249
0
        cur = NestedNameSpecifier::SuperSpecifier(ctx,
250
0
                                            asImpl().readCXXRecordDeclRef());
251
0
        continue;
252
0
      }
253
0
      llvm_unreachable("bad nested name specifier kind");
254
0
    }
255
256
188k
    return cur;
257
188k
  }
258
};
259
260
} // end namespace serialization
261
} // end namespace clang
262
263
#endif