clang  14.0.0git
ASTRecordReader.h
Go to the documentation of this file.
1 //===- ASTRecordReader.h - Helper classes for reading AST -------*- 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 classes that are useful in the implementation of
10 // the ASTReader.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_SERIALIZATION_ASTRECORDREADER_H
15 #define LLVM_CLANG_SERIALIZATION_ASTRECORDREADER_H
16 
17 #include "clang/AST/ASTContext.h"
19 #include "clang/Lex/Token.h"
21 #include "llvm/ADT/APFloat.h"
22 #include "llvm/ADT/APInt.h"
23 #include "llvm/ADT/APSInt.h"
24 
25 namespace clang {
26 class OMPTraitInfo;
27 class OMPChildren;
28 
29 /// An object for streaming information from a record.
31  : public serialization::DataStreamBasicReader<ASTRecordReader> {
33 
34  ASTReader *Reader;
35  ModuleFile *F;
36  unsigned Idx = 0;
37  ASTReader::RecordData Record;
38 
41 
42 public:
43  /// Construct an ASTRecordReader that uses the default encoding scheme.
45  : DataStreamBasicReader(Reader.getContext()), Reader(&Reader), F(&F) {}
46 
47  /// Reads a record with id AbbrevID from Cursor, resetting the
48  /// internal state.
49  Expected<unsigned> readRecord(llvm::BitstreamCursor &Cursor,
50  unsigned AbbrevID);
51 
52  /// Is this a module file for a module (rather than a PCH or similar).
53  bool isModule() const { return F->isModule(); }
54 
55  /// Retrieve the AST context that this AST reader supplements.
56  ASTContext &getContext() { return Reader->getContext(); }
57 
58  /// The current position in this record.
59  unsigned getIdx() const { return Idx; }
60 
61  /// The length of this record.
62  size_t size() const { return Record.size(); }
63 
64  /// An arbitrary index in this record.
65  const uint64_t &operator[](size_t N) { return Record[N]; }
66 
67  /// Returns the last value in this record.
68  uint64_t back() { return Record.back(); }
69 
70  /// Returns the current value in this record, and advances to the
71  /// next value.
72  uint64_t readInt() { return Record[Idx++]; }
73 
75  auto Array = llvm::makeArrayRef(Record).slice(Idx, Len);
76  Idx += Len;
77  return Array;
78  }
79 
80  /// Returns the current value in this record, without advancing.
81  uint64_t peekInt() { return Record[Idx]; }
82 
83  /// Skips the specified number of values.
84  void skipInts(unsigned N) { Idx += N; }
85 
86  /// Retrieve the global submodule ID its local ID number.
88  getGlobalSubmoduleID(unsigned LocalID) {
89  return Reader->getGlobalSubmoduleID(*F, LocalID);
90  }
91 
92  /// Retrieve the submodule that corresponds to a global submodule ID.
94  return Reader->getSubmodule(GlobalID);
95  }
96 
97  /// Read the record that describes the lexical contents of a DC.
99  return Reader->ReadLexicalDeclContextStorage(*F, F->DeclsCursor, Offset,
100  DC);
101  }
102 
103  /// Read the record that describes the visible contents of a DC.
106  return Reader->ReadVisibleDeclContextStorage(*F, F->DeclsCursor, Offset,
107  ID);
108  }
109 
111  uint64_t Kind = readInt();
112  bool HasExpr = Kind & 0x1;
113  Kind = Kind >> 1;
114  return ExplicitSpecifier(HasExpr ? readExpr() : nullptr,
115  static_cast<ExplicitSpecKind>(Kind));
116  }
117 
118  /// Read information about an exception specification (inherited).
119  //FunctionProtoType::ExceptionSpecInfo
120  //readExceptionSpecInfo(SmallVectorImpl<QualType> &ExceptionStorage);
121 
122  /// Get the global offset corresponding to a local offset.
123  uint64_t getGlobalBitOffset(uint64_t LocalOffset) {
124  return Reader->getGlobalBitOffset(*F, LocalOffset);
125  }
126 
127  /// Reads a statement.
128  Stmt *readStmt() { return Reader->ReadStmt(*F); }
129  Stmt *readStmtRef() { return readStmt(); /* FIXME: readSubStmt? */ }
130 
131  /// Reads an expression.
132  Expr *readExpr() { return Reader->ReadExpr(*F); }
133 
134  /// Reads a sub-statement operand during statement reading.
135  Stmt *readSubStmt() { return Reader->ReadSubStmt(); }
136 
137  /// Reads a sub-expression operand during statement reading.
138  Expr *readSubExpr() { return Reader->ReadSubExpr(); }
139 
140  /// Reads a declaration with the given local ID in the given module.
141  ///
142  /// \returns The requested declaration, casted to the given return type.
143  template<typename T>
144  T *GetLocalDeclAs(uint32_t LocalID) {
145  return cast_or_null<T>(Reader->GetLocalDecl(*F, LocalID));
146  }
147 
148  /// Reads a TemplateArgumentLocInfo appropriate for the
149  /// given TemplateArgument kind, advancing Idx.
152 
153  /// Reads a TemplateArgumentLoc, advancing Idx.
155 
158 
159  /// Reads a declarator info from the given record, advancing Idx.
161 
162  /// Reads the location information for a type.
163  void readTypeLoc(TypeLoc TL);
164 
165 
166  /// Map a local type ID within a given AST file to a global type ID.
167  serialization::TypeID getGlobalTypeID(unsigned LocalID) const {
168  return Reader->getGlobalTypeID(*F, LocalID);
169  }
170 
173  }
174 
175  /// Read a type from the current position in the record.
177  return Reader->readType(*F, Record, Idx);
178  }
180  return readType();
181  }
182 
183  /// Reads a declaration ID from the given position in this record.
184  ///
185  /// \returns The declaration ID read from the record, adjusted to a global ID.
187  return Reader->ReadDeclID(*F, Record, Idx);
188  }
189 
190  /// Reads a declaration from the given position in a record in the
191  /// given module, advancing Idx.
193  return Reader->ReadDecl(*F, Record, Idx);
194  }
196  return readDecl();
197  }
198 
199  /// Reads a declaration from the given position in the record,
200  /// advancing Idx.
201  ///
202  /// \returns The declaration read from this location, casted to the given
203  /// result type.
204  template<typename T>
205  T *readDeclAs() {
206  return Reader->ReadDeclAs<T>(*F, Record, Idx);
207  }
208 
210  return Reader->readIdentifier(*F, Record, Idx);
211  }
212 
213  /// Read a selector from the Record, advancing Idx.
215  return Reader->ReadSelector(*F, Record, Idx);
216  }
217 
218  /// Read a declaration name, advancing Idx.
219  // DeclarationName readDeclarationName(); (inherited)
222 
223  void readQualifierInfo(QualifierInfo &Info);
224 
225  /// Return a nested name specifier, advancing Idx.
226  // NestedNameSpecifier *readNestedNameSpecifier(); (inherited)
227 
229 
230  /// Read a template name, advancing Idx.
231  // TemplateName readTemplateName(); (inherited)
232 
233  /// Read a template argument, advancing Idx. (inherited)
234  // TemplateArgument readTemplateArgument();
235  using DataStreamBasicReader::readTemplateArgument;
238  if (Canonicalize) {
240  }
241  return Arg;
242  }
243 
244  /// Read a template parameter list, advancing Idx.
246 
247  /// Read a template argument array, advancing Idx.
249  bool Canonicalize = false);
250 
251  /// Read a UnresolvedSet structure, advancing Idx.
253 
254  /// Read a C++ base specifier, advancing Idx.
256 
257  /// Read a CXXCtorInitializer array, advancing Idx.
259 
261  return Reader->ReadCXXTemporary(*F, Record, Idx);
262  }
263 
264  /// Read an OMPTraitInfo object, advancing Idx.
266 
267  /// Read an OpenMP clause, advancing Idx.
269 
270  /// Read an OpenMP children, advancing Idx.
271  void readOMPChildren(OMPChildren *Data);
272 
273  /// Read a source location, advancing Idx.
275  return Reader->ReadSourceLocation(*F, Record, Idx);
276  }
277 
278  /// Read a source range, advancing Idx.
280  return Reader->ReadSourceRange(*F, Record, Idx);
281  }
282 
283  /// Read an arbitrary constant value, advancing Idx.
284  // APValue readAPValue(); (inherited)
285 
286  /// Read an integral value, advancing Idx.
287  // llvm::APInt readAPInt(); (inherited)
288 
289  /// Read a signed integral value, advancing Idx.
290  // llvm::APSInt readAPSInt(); (inherited)
291 
292  /// Read a floating-point value, advancing Idx.
293  llvm::APFloat readAPFloat(const llvm::fltSemantics &Sem);
294 
295  /// Read a boolean value, advancing Idx.
296  bool readBool() { return readInt() != 0; }
297 
298  /// Read a 32-bit unsigned value; required to satisfy BasicReader.
299  uint32_t readUInt32() {
300  return uint32_t(readInt());
301  }
302 
303  /// Read a 64-bit unsigned value; required to satisfy BasicReader.
304  uint64_t readUInt64() {
305  return readInt();
306  }
307 
308  /// Read a string, advancing Idx.
310  return Reader->ReadString(Record, Idx);
311  }
312 
313  /// Read a path, advancing Idx.
315  return Reader->ReadPath(*F, Record, Idx);
316  }
317 
318  /// Read a version tuple, advancing Idx.
319  VersionTuple readVersionTuple() {
320  return ASTReader::ReadVersionTuple(Record, Idx);
321  }
322 
323  /// Reads one attribute from the current stream position, advancing Idx.
324  Attr *readAttr();
325 
326  /// Reads attributes from the current stream position, advancing Idx.
327  void readAttributes(AttrVec &Attrs);
328 
329  /// Reads a token out of a record, advancing Idx.
331  return Reader->ReadToken(*F, Record, Idx);
332  }
333 
334  void recordSwitchCaseID(SwitchCase *SC, unsigned ID) {
335  Reader->RecordSwitchCaseID(SC, ID);
336  }
337 
338  /// Retrieve the switch-case statement with the given ID.
340  return Reader->getSwitchCaseWithID(ID);
341  }
342 };
343 
344 /// Helper class that saves the current stream position and
345 /// then restores it when destroyed.
347  explicit SavedStreamPosition(llvm::BitstreamCursor &Cursor)
348  : Cursor(Cursor), Offset(Cursor.GetCurrentBitNo()) {}
349 
351  if (llvm::Error Err = Cursor.JumpToBit(Offset))
352  llvm::report_fatal_error(
353  "Cursor should always be able to go back, failed: " +
354  toString(std::move(Err)));
355  }
356 
357 private:
358  llvm::BitstreamCursor &Cursor;
359  uint64_t Offset;
360 };
361 
362 inline void PCHValidator::Error(const char *Msg) {
363  Reader.Error(Msg);
364 }
365 
366 } // namespace clang
367 
368 #endif
clang::ExplicitSpecifier
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1795
clang::ASTRecordReader::readType
QualType readType()
Read a type from the current position in the record.
Definition: ASTRecordReader.h:176
clang::ASTRecordReader::readSelector
Selector readSelector()
Read a selector from the Record, advancing Idx.
Definition: ASTRecordReader.h:214
clang::ASTRecordReader::getSubmodule
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
Definition: ASTRecordReader.h:93
clang::ASTReader::getContext
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Definition: ASTReader.h:2263
clang::ASTRecordReader::getContext
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Definition: ASTRecordReader.h:56
clang::ASTRecordReader::readDeclarationNameLoc
DeclarationNameLoc readDeclarationNameLoc(DeclarationName Name)
Read a declaration name, advancing Idx.
Definition: ASTReader.cpp:8720
AbstractBasicReader.h
clang::DeclarationNameLoc
DeclarationNameLoc - Additional source/type location info for a declaration name.
Definition: DeclarationName.h:650
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:212
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1347
llvm::SmallVector< uint64_t, 64 >
clang::ASTReader::ReadSubStmt
Stmt * ReadSubStmt()
Reads a sub-statement operand during statement reading.
Definition: ASTReader.h:2218
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::ASTRecordReader
An object for streaming information from a record.
Definition: ASTRecordReader.h:30
clang::ASTRecordReader::readAttributes
void readAttributes(AttrVec &Attrs)
Reads attributes from the current stream position, advancing Idx.
Definition: ASTReaderDecl.cpp:2847
clang::ASTReader::RecordData
SmallVector< uint64_t, 64 > RecordData
Definition: ASTReader.h:362
clang::ASTReader::ReadSelector
Selector ReadSelector(ModuleFile &M, const RecordData &Record, unsigned &Idx)
Definition: ASTReader.h:2128
clang::OMPTraitInfo
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
Definition: OpenMPClause.h:8490
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:673
clang::ASTRecordReader::GetLocalDeclAs
T * GetLocalDeclAs(uint32_t LocalID)
Reads a declaration with the given local ID in the given module.
Definition: ASTRecordReader.h:144
clang::ASTRecordReader::readCXXBaseSpecifier
CXXBaseSpecifier readCXXBaseSpecifier()
Read a C++ base specifier, advancing Idx.
Definition: ASTReader.cpp:8806
clang::serialization::DataStreamBasicReader< ASTRecordReader >::DataStreamBasicReader
DataStreamBasicReader(ASTContext &ctx)
Definition: AbstractBasicReader.h:126
Cursor
Cursor
Definition: SerializedDiagnosticReader.cpp:109
clang::Qualifiers
The collection of all-type qualifiers we support.
Definition: Type.h:145
clang::ASTRecordReader::getGlobalBitOffset
uint64_t getGlobalBitOffset(uint64_t LocalOffset)
Read information about an exception specification (inherited).
Definition: ASTRecordReader.h:123
clang::ASTReader::readIdentifier
IdentifierInfo * readIdentifier(ModuleFile &M, const RecordData &Record, unsigned &Idx)
Definition: ASTReader.h:2060
clang::ASTRecordReader::readSourceLocation
SourceLocation readSourceLocation()
Read a source location, advancing Idx.
Definition: ASTRecordReader.h:274
clang::ASTReader::ReadVersionTuple
static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx)
Read a version tuple.
Definition: ASTReader.cpp:8983
clang::ASTRecordReader::readOMPTraitInfo
OMPTraitInfo * readOMPTraitInfo()
Read an OMPTraitInfo object, advancing Idx.
Definition: ASTReader.cpp:12951
clang::ASTRecordReader::readDeclID
serialization::DeclID readDeclID()
Reads a declaration ID from the given position in this record.
Definition: ASTRecordReader.h:186
clang::ASTRecordReader::readVersionTuple
VersionTuple readVersionTuple()
Read a version tuple, advancing Idx.
Definition: ASTRecordReader.h:319
clang::ASTRecordReader::readIdentifier
IdentifierInfo * readIdentifier()
Definition: ASTRecordReader.h:209
llvm::Expected
Definition: LLVM.h:41
clang::Token
Token - This structure provides full information about a lexed token.
Definition: Token.h:34
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:145
clang::ASTRecordReader::readQualifierInfo
void readQualifierInfo(QualifierInfo &Info)
Definition: ASTReader.cpp:8753
clang::ASTRecordReader::readTemplateArgument
TemplateArgument readTemplateArgument(bool Canonicalize)
Definition: ASTRecordReader.h:236
clang::ASTRecordReader::readTemplateArgumentLoc
TemplateArgumentLoc readTemplateArgumentLoc()
Reads a TemplateArgumentLoc, advancing Idx.
Definition: ASTReader.cpp:7123
Offset
unsigned Offset
Definition: Format.cpp:2335
clang::ASTRecordReader::readUInt32
uint32_t readUInt32()
Read a 32-bit unsigned value; required to satisfy BasicReader.
Definition: ASTRecordReader.h:299
clang::serialization::SubmoduleID
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
Definition: ASTBitCodes.h:171
clang::ASTReader::GetLocalDecl
Decl * GetLocalDecl(ModuleFile &F, uint32_t LocalID)
Reads a declaration with the given local ID in the given module.
Definition: ASTReader.h:1850
clang::ASTRecordReader::readTypeSourceInfo
TypeSourceInfo * readTypeSourceInfo()
Reads a declarator info from the given record, advancing Idx.
Definition: ASTReader.cpp:6778
clang::Module
Describes a module or submodule.
Definition: Module.h:96
clang::serialization::ModuleFile::DeclsCursor
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLTYPES_BLOCK block.
Definition: ModuleFile.h:427
clang::ASTRecordReader::readVisibleDeclContextStorage
bool readVisibleDeclContextStorage(uint64_t Offset, serialization::DeclID ID)
Read the record that describes the visible contents of a DC.
Definition: ASTRecordReader.h:104
clang::OMPChildren
Contains data for OpenMP directives: clauses, children expressions/statements (helpers for codegen) a...
Definition: OpenMPClause.h:8569
clang::ASTReader::getGlobalTypeID
serialization::TypeID getGlobalTypeID(ModuleFile &F, unsigned LocalID) const
Map a local type ID within a given AST file into a global type ID.
Definition: ASTReader.cpp:7073
clang::OMPClause
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:54
clang::ASTRecordReader::readIntArray
ArrayRef< uint64_t > readIntArray(unsigned Len)
Definition: ASTRecordReader.h:74
clang::threadSafety::sx::toString
std::string toString(const til::SExpr *E)
Definition: ThreadSafetyCommon.h:89
clang::SavedStreamPosition::SavedStreamPosition
SavedStreamPosition(llvm::BitstreamCursor &Cursor)
Definition: ASTRecordReader.h:347
clang::ASTReader::getGlobalSubmoduleID
serialization::SubmoduleID getGlobalSubmoduleID(ModuleFile &M, unsigned LocalID)
Retrieve the global submodule ID given a module and its local ID number.
Definition: ASTReader.cpp:8577
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:211
clang::ASTRecordReader::readSubExpr
Expr * readSubExpr()
Reads a sub-expression operand during statement reading.
Definition: ASTRecordReader.h:138
clang::TemplateArgument
Represents a template argument.
Definition: TemplateBase.h:62
clang::ASTRecordReader::readString
std::string readString()
Read a string, advancing Idx.
Definition: ASTRecordReader.h:309
clang::ASTRecordReader::readToken
Token readToken()
Reads a token out of a record, advancing Idx.
Definition: ASTRecordReader.h:330
clang::ASTRecordReader::readNestedNameSpecifierLoc
NestedNameSpecifierLoc readNestedNameSpecifierLoc()
Return a nested name specifier, advancing Idx.
Definition: ASTReader.cpp:8886
clang::ASTReader::getSubmodule
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
Definition: ASTReader.cpp:8592
clang::TemplateArgumentLoc
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:458
clang::ASTRecordReader::readOMPChildren
void readOMPChildren(OMPChildren *Data)
Read an OpenMP children, advancing Idx.
Definition: ASTReader.cpp:12970
ASTContext.h
clang::ASTRecordReader::readStmtRef
Stmt * readStmtRef()
Definition: ASTRecordReader.h:129
clang::serialization::TypeID
uint32_t TypeID
An ID number that refers to a type in an AST file.
Definition: ASTBitCodes.h:85
clang::TemplateParameterList
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:69
clang::ASTRecordReader::readStmt
Stmt * readStmt()
Reads a statement.
Definition: ASTRecordReader.h:128
clang::CXXTemporary
Represents a C++ temporary.
Definition: ExprCXX.h:1380
clang::ASTRecordReader::readSubStmt
Stmt * readSubStmt()
Reads a sub-statement operand during statement reading.
Definition: ASTRecordReader.h:135
clang::ASTRecordReader::readTemplateArgumentList
void readTemplateArgumentList(SmallVectorImpl< TemplateArgument > &TemplArgs, bool Canonicalize=false)
Read a template argument array, advancing Idx.
Definition: ASTReader.cpp:8785
clang::SwitchCase
Definition: Stmt.h:1521
clang::NestedNameSpecifierLoc
A C++ nested-name-specifier augmented with source location information.
Definition: NestedNameSpecifier.h:243
clang::LazyASTUnresolvedSet
An UnresolvedSet-like class that might not have been loaded from the external AST source yet.
Definition: ASTUnresolvedSet.h:93
clang::ASTRecordReader::readDecl
Decl * readDecl()
Reads a declaration from the given position in a record in the given module, advancing Idx.
Definition: ASTRecordReader.h:192
clang::ASTReader::ReadString
static std::string ReadString(const RecordData &Record, unsigned &Idx)
Definition: ASTReader.cpp:8961
clang::serialization::ModuleFile::isModule
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
Definition: ModuleFile.h:501
clang::ASTReader::ReadSubExpr
Expr * ReadSubExpr()
Reads a sub-expression operand during statement reading.
Definition: ASTReaderStmt.cpp:2651
clang::ASTReader::ReadToken
Token ReadToken(ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx)
Reads a token out of a record.
Definition: ASTReader.cpp:1672
clang::ASTReader::RecordDataImpl
SmallVectorImpl< uint64_t > RecordDataImpl
Definition: ASTReader.h:363
clang::ASTRecordReader::operator[]
const uint64_t & operator[](size_t N)
An arbitrary index in this record.
Definition: ASTRecordReader.h:65
clang::ASTReader::readType
QualType readType(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a type from the current position in the given record, which was read from the given AST file.
Definition: ASTReader.h:1814
clang::ASTRecordReader::readQualType
QualType readQualType()
Definition: ASTRecordReader.h:179
clang::ExplicitSpecKind
ExplicitSpecKind
Define the meaning of possible values of the kind in ExplicitSpecifier.
Definition: Specifiers.h:25
clang::ASTRecordReader::size
size_t size() const
The length of this record.
Definition: ASTRecordReader.h:62
clang::ASTRecordReader::readOMPClause
OMPClause * readOMPClause()
Read an OpenMP clause, advancing Idx.
Definition: ASTReader.cpp:11685
clang::ASTRecordReader::readTemplateArgumentLocInfo
TemplateArgumentLocInfo readTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind)
Reads a TemplateArgumentLocInfo appropriate for the given TemplateArgument kind, advancing Idx.
Definition: ASTReader.cpp:7092
clang::SavedStreamPosition::~SavedStreamPosition
~SavedStreamPosition()
Definition: ASTRecordReader.h:350
clang::ASTReader::ReadSourceRange
SourceRange ReadSourceRange(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a source range.
Definition: ASTReader.cpp:8948
clang::ASTReader::ReadSourceLocation
SourceLocation ReadSourceLocation(ModuleFile &ModuleFile, SourceLocation::UIntTy Raw) const
Read a source location from raw form.
Definition: ASTReader.h:2154
clang::ASTRecordReader::getGlobalSubmoduleID
serialization::SubmoduleID getGlobalSubmoduleID(unsigned LocalID)
Retrieve the global submodule ID its local ID number.
Definition: ASTRecordReader.h:88
clang::ASTRecordReader::readTypeLoc
void readTypeLoc(TypeLoc TL)
Reads the location information for a type.
Definition: ASTReader.cpp:6772
clang::ASTRecordReader::readSourceRange
SourceRange readSourceRange()
Read a source range, advancing Idx.
Definition: ASTRecordReader.h:279
clang::ASTRecordReader::recordSwitchCaseID
void recordSwitchCaseID(SwitchCase *SC, unsigned ID)
Definition: ASTRecordReader.h:334
clang::ASTRecordReader::getIdx
unsigned getIdx() const
The current position in this record.
Definition: ASTRecordReader.h:59
clang::ASTRecordReader::readExplicitSpec
ExplicitSpecifier readExplicitSpec()
Definition: ASTRecordReader.h:110
clang::ASTRecordReader::readRecord
Expected< unsigned > readRecord(llvm::BitstreamCursor &Cursor, unsigned AbbrevID)
Reads a record with id AbbrevID from Cursor, resetting the internal state.
Definition: ASTReader.cpp:11654
llvm::ArrayRef
Definition: LLVM.h:34
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
clang::ASTReader::RecordSwitchCaseID
void RecordSwitchCaseID(SwitchCase *SC, unsigned ID)
Record that the given ID maps to the given switch-case statement.
Definition: ASTReader.cpp:9018
clang::TypeLoc
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:58
clang::ASTRecordReader::getSwitchCaseWithID
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
Definition: ASTRecordReader.h:339
clang::Qualifiers::fromOpaqueValue
static Qualifiers fromOpaqueValue(unsigned opaque)
Definition: Type.h:251
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:67
clang::ASTRecordReader::readExpr
Expr * readExpr()
Reads an expression.
Definition: ASTRecordReader.h:132
clang::ASTRecordReader::peekInt
uint64_t peekInt()
Returns the current value in this record, without advancing.
Definition: ASTRecordReader.h:81
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::ASTReader
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:342
clang::SavedStreamPosition
Helper class that saves the current stream position and then restores it when destroyed.
Definition: ASTRecordReader.h:346
clang::ASTRecordReader::readTemplateParameterList
TemplateParameterList * readTemplateParameterList()
Read a template parameter list, advancing Idx.
Definition: ASTReader.cpp:8766
clang::ASTRecordReader::readDeclRef
Decl * readDeclRef()
Definition: ASTRecordReader.h:195
clang::Builtin::ID
ID
Definition: Builtins.h:48
clang
Definition: CalledOnceCheck.h:17
clang::ASTRecordReader::readAttr
Attr * readAttr()
Reads one attribute from the current stream position, advancing Idx.
Definition: ASTReaderDecl.cpp:2816
clang::Selector
Smart pointer class that efficiently represents Objective-C method names.
Definition: IdentifierTable.h:720
clang::ASTRecordReader::readCXXTemporary
CXXTemporary * readCXXTemporary()
Definition: ASTRecordReader.h:260
clang::ASTRecordReader::readLexicalDeclContextStorage
bool readLexicalDeclContextStorage(uint64_t Offset, DeclContext *DC)
Read the record that describes the lexical contents of a DC.
Definition: ASTRecordReader.h:98
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:68
clang::TemplateArgument::ArgKind
ArgKind
The kind of template argument we're storing.
Definition: TemplateBase.h:65
ASTReader.h
clang::ASTRecordReader::skipInts
void skipInts(unsigned N)
Skips the specified number of values.
Definition: ASTRecordReader.h:84
clang::CXXBaseSpecifier
Represents a base class of a C++ class.
Definition: DeclCXX.h:147
clang::ASTReader::ReadStmt
Stmt * ReadStmt(ModuleFile &F)
Reads a statement.
Definition: ASTReaderStmt.cpp:2633
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:46
clang::TypeSourceInfo
A container of type source information.
Definition: Type.h:6396
clang::ASTRecordReader::ASTRecordReader
ASTRecordReader(ASTReader &Reader, ModuleFile &F)
Construct an ASTRecordReader that uses the default encoding scheme.
Definition: ASTRecordReader.h:44
clang::ASTReader::ReadDeclAs
T * ReadDeclAs(ModuleFile &F, const RecordData &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
Definition: ASTReader.h:1890
clang::ASTRecordReader::readPath
std::string readPath()
Read a path, advancing Idx.
Definition: ASTRecordReader.h:314
clang::ASTReader::ReadCXXTemporary
CXXTemporary * ReadCXXTemporary(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Definition: ASTReader.cpp:8995
clang::ASTRecordReader::readDeclAs
T * readDeclAs()
Reads a declaration from the given position in the record, advancing Idx.
Definition: ASTRecordReader.h:205
clang::ASTRecordReader::readCXXCtorInitializers
CXXCtorInitializer ** readCXXCtorInitializers()
Read a CXXCtorInitializer array, advancing Idx.
Definition: ASTReader.cpp:8821
clang::ASTReader::ReadExpr
Expr * ReadExpr(ModuleFile &F)
Reads an expression.
Definition: ASTReaderStmt.cpp:2647
clang::ASTRecordReader::readUnresolvedSet
void readUnresolvedSet(LazyASTUnresolvedSet &Set)
Read a UnresolvedSet structure, advancing Idx.
Definition: ASTReader.cpp:8795
clang::ASTContext::getCanonicalTemplateArgument
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
Definition: ASTContext.cpp:6064
clang::ASTRecordReader::readQualifiers
Qualifiers readQualifiers()
Definition: ASTRecordReader.h:171
clang::ASTTemplateArgumentListInfo
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:613
clang::QualifierInfo
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
Definition: Decl.h:701
llvm::SmallVectorImpl
Definition: LLVM.h:39
clang::ASTRecordReader::readInt
uint64_t readInt()
Returns the current value in this record, and advances to the next value.
Definition: ASTRecordReader.h:72
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::ASTRecordReader::readDeclarationNameInfo
DeclarationNameInfo readDeclarationNameInfo()
Definition: ASTReader.cpp:8745
clang::serialization::DeclID
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
Definition: ASTBitCodes.h:68
clang::CXXCtorInitializer
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2172
Token.h
clang::ASTReader::getSwitchCaseWithID
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
Definition: ASTReader.cpp:9025
clang::ASTRecordReader::readASTTemplateArgumentListInfo
const ASTTemplateArgumentListInfo * readASTTemplateArgumentListInfo()
Definition: ASTReader.cpp:7134
clang::ASTReader::ReadDeclID
serialization::DeclID ReadDeclID(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Reads a declaration ID from the given position in a record in the given module.
Definition: ASTReader.cpp:7452
clang::DeclarationNameInfo
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Definition: DeclarationName.h:758
clang::ASTReader::ReadDecl
Decl * ReadDecl(ModuleFile &F, const RecordData &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
Definition: ASTReader.h:1880
clang::ASTRecordReader::readUInt64
uint64_t readUInt64()
Read a 64-bit unsigned value; required to satisfy BasicReader.
Definition: ASTRecordReader.h:304
clang::ASTRecordReader::isModule
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
Definition: ASTRecordReader.h:53
clang::serialization::ModuleFile
Information about a module that has been loaded by the ASTReader.
Definition: ModuleFile.h:110
clang::ASTRecordReader::back
uint64_t back()
Returns the last value in this record.
Definition: ASTRecordReader.h:68
clang::TemplateArgumentLocInfo
Location information for a TemplateArgument.
Definition: TemplateBase.h:406
clang::ASTRecordReader::readBool
bool readBool()
Read a boolean value, advancing Idx.
Definition: ASTRecordReader.h:296
clang::ASTReader::ReadPath
std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Definition: ASTReader.cpp:8968
clang::ASTRecordReader::getGlobalTypeID
serialization::TypeID getGlobalTypeID(unsigned LocalID) const
Map a local type ID within a given AST file to a global type ID.
Definition: ASTRecordReader.h:167
clang::ASTRecordReader::readAPFloat
llvm::APFloat readAPFloat(const llvm::fltSemantics &Sem)
Read an arbitrary constant value, advancing Idx.
Definition: ASTReader.cpp:8956
clang::serialization::DataStreamBasicReader
DataStreamBasicReader provides convenience implementations for many BasicReader methods based on the ...
Definition: AbstractBasicReader.h:123