clang  14.0.0git
ASTReader.h
Go to the documentation of this file.
1 //===- ASTReader.h - AST File Reader ----------------------------*- 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 ASTReader class, which reads AST files.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_SERIALIZATION_ASTREADER_H
14 #define LLVM_CLANG_SERIALIZATION_ASTREADER_H
15 
16 #include "clang/AST/Type.h"
17 #include "clang/Basic/Diagnostic.h"
22 #include "clang/Basic/Version.h"
24 #include "clang/Lex/HeaderSearch.h"
29 #include "clang/Sema/Sema.h"
35 #include "llvm/ADT/ArrayRef.h"
36 #include "llvm/ADT/DenseMap.h"
37 #include "llvm/ADT/DenseSet.h"
38 #include "llvm/ADT/IntrusiveRefCntPtr.h"
39 #include "llvm/ADT/MapVector.h"
40 #include "llvm/ADT/Optional.h"
41 #include "llvm/ADT/STLExtras.h"
42 #include "llvm/ADT/SetVector.h"
43 #include "llvm/ADT/SmallPtrSet.h"
44 #include "llvm/ADT/SmallVector.h"
45 #include "llvm/ADT/StringMap.h"
46 #include "llvm/ADT/StringRef.h"
47 #include "llvm/ADT/iterator.h"
48 #include "llvm/ADT/iterator_range.h"
49 #include "llvm/Bitstream/BitstreamReader.h"
50 #include "llvm/Support/MemoryBuffer.h"
51 #include "llvm/Support/Timer.h"
52 #include "llvm/Support/VersionTuple.h"
53 #include <cassert>
54 #include <cstddef>
55 #include <cstdint>
56 #include <ctime>
57 #include <deque>
58 #include <memory>
59 #include <set>
60 #include <string>
61 #include <utility>
62 #include <vector>
63 
64 namespace clang {
65 
66 class ASTConsumer;
67 class ASTContext;
68 class ASTDeserializationListener;
69 class ASTReader;
70 class ASTRecordReader;
71 class CXXTemporary;
72 class Decl;
73 class DeclarationName;
74 class DeclaratorDecl;
75 class DeclContext;
76 class EnumDecl;
77 class Expr;
78 class FieldDecl;
79 class FileEntry;
80 class FileManager;
81 class FileSystemOptions;
82 class FunctionDecl;
83 class GlobalModuleIndex;
84 struct HeaderFileInfo;
85 class HeaderSearchOptions;
86 class LangOptions;
87 class LazyASTUnresolvedSet;
88 class MacroInfo;
89 class InMemoryModuleCache;
90 class NamedDecl;
91 class NamespaceDecl;
92 class ObjCCategoryDecl;
93 class ObjCInterfaceDecl;
94 class PCHContainerReader;
95 class Preprocessor;
96 class PreprocessorOptions;
97 struct QualifierInfo;
98 class Sema;
99 class SourceManager;
100 class Stmt;
101 class SwitchCase;
102 class TargetOptions;
103 class Token;
104 class TypedefNameDecl;
105 class ValueDecl;
106 class VarDecl;
107 
108 /// Abstract interface for callback invocations by the ASTReader.
109 ///
110 /// While reading an AST file, the ASTReader will call the methods of the
111 /// listener to pass on specific information. Some of the listener methods can
112 /// return true to indicate to the ASTReader that the information (and
113 /// consequently the AST file) is invalid.
115 public:
116  virtual ~ASTReaderListener();
117 
118  /// Receives the full Clang version information.
119  ///
120  /// \returns true to indicate that the version is invalid. Subclasses should
121  /// generally defer to this implementation.
122  virtual bool ReadFullVersionInformation(StringRef FullVersion) {
123  return FullVersion != getClangFullRepositoryVersion();
124  }
125 
126  virtual void ReadModuleName(StringRef ModuleName) {}
127  virtual void ReadModuleMapFile(StringRef ModuleMapPath) {}
128 
129  /// Receives the language options.
130  ///
131  /// \returns true to indicate the options are invalid or false otherwise.
132  virtual bool ReadLanguageOptions(const LangOptions &LangOpts,
133  bool Complain,
134  bool AllowCompatibleDifferences) {
135  return false;
136  }
137 
138  /// Receives the target options.
139  ///
140  /// \returns true to indicate the target options are invalid, or false
141  /// otherwise.
142  virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain,
143  bool AllowCompatibleDifferences) {
144  return false;
145  }
146 
147  /// Receives the diagnostic options.
148  ///
149  /// \returns true to indicate the diagnostic options are invalid, or false
150  /// otherwise.
151  virtual bool
153  bool Complain) {
154  return false;
155  }
156 
157  /// Receives the file system options.
158  ///
159  /// \returns true to indicate the file system options are invalid, or false
160  /// otherwise.
161  virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts,
162  bool Complain) {
163  return false;
164  }
165 
166  /// Receives the header search options.
167  ///
168  /// \returns true to indicate the header search options are invalid, or false
169  /// otherwise.
170  virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
171  StringRef SpecificModuleCachePath,
172  bool Complain) {
173  return false;
174  }
175 
176  /// Receives the preprocessor options.
177  ///
178  /// \param SuggestedPredefines Can be filled in with the set of predefines
179  /// that are suggested by the preprocessor options. Typically only used when
180  /// loading a precompiled header.
181  ///
182  /// \returns true to indicate the preprocessor options are invalid, or false
183  /// otherwise.
184  virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
185  bool Complain,
186  std::string &SuggestedPredefines) {
187  return false;
188  }
189 
190  /// Receives __COUNTER__ value.
191  virtual void ReadCounter(const serialization::ModuleFile &M,
192  unsigned Value) {}
193 
194  /// This is called for each AST file loaded.
195  virtual void visitModuleFile(StringRef Filename,
197 
198  /// Returns true if this \c ASTReaderListener wants to receive the
199  /// input files of the AST file via \c visitInputFile, false otherwise.
200  virtual bool needsInputFileVisitation() { return false; }
201 
202  /// Returns true if this \c ASTReaderListener wants to receive the
203  /// system input files of the AST file via \c visitInputFile, false otherwise.
204  virtual bool needsSystemInputFileVisitation() { return false; }
205 
206  /// if \c needsInputFileVisitation returns true, this is called for
207  /// each non-system input file of the AST File. If
208  /// \c needsSystemInputFileVisitation is true, then it is called for all
209  /// system input files as well.
210  ///
211  /// \returns true to continue receiving the next input file, false to stop.
212  virtual bool visitInputFile(StringRef Filename, bool isSystem,
213  bool isOverridden, bool isExplicitModule) {
214  return true;
215  }
216 
217  /// Returns true if this \c ASTReaderListener wants to receive the
218  /// imports of the AST file via \c visitImport, false otherwise.
219  virtual bool needsImportVisitation() const { return false; }
220 
221  /// If needsImportVisitation returns \c true, this is called for each
222  /// AST file imported by this AST file.
223  virtual void visitImport(StringRef ModuleName, StringRef Filename) {}
224 
225  /// Indicates that a particular module file extension has been read.
227  const ModuleFileExtensionMetadata &Metadata) {}
228 };
229 
230 /// Simple wrapper class for chaining listeners.
232  std::unique_ptr<ASTReaderListener> First;
233  std::unique_ptr<ASTReaderListener> Second;
234 
235 public:
236  /// Takes ownership of \p First and \p Second.
237  ChainedASTReaderListener(std::unique_ptr<ASTReaderListener> First,
238  std::unique_ptr<ASTReaderListener> Second)
239  : First(std::move(First)), Second(std::move(Second)) {}
240 
241  std::unique_ptr<ASTReaderListener> takeFirst() { return std::move(First); }
242  std::unique_ptr<ASTReaderListener> takeSecond() { return std::move(Second); }
243 
244  bool ReadFullVersionInformation(StringRef FullVersion) override;
245  void ReadModuleName(StringRef ModuleName) override;
246  void ReadModuleMapFile(StringRef ModuleMapPath) override;
247  bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain,
248  bool AllowCompatibleDifferences) override;
249  bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain,
250  bool AllowCompatibleDifferences) override;
252  bool Complain) override;
253  bool ReadFileSystemOptions(const FileSystemOptions &FSOpts,
254  bool Complain) override;
255 
256  bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
257  StringRef SpecificModuleCachePath,
258  bool Complain) override;
259  bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
260  bool Complain,
261  std::string &SuggestedPredefines) override;
262 
263  void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override;
264  bool needsInputFileVisitation() override;
265  bool needsSystemInputFileVisitation() override;
266  void visitModuleFile(StringRef Filename,
268  bool visitInputFile(StringRef Filename, bool isSystem,
269  bool isOverridden, bool isExplicitModule) override;
271  const ModuleFileExtensionMetadata &Metadata) override;
272 };
273 
274 /// ASTReaderListener implementation to validate the information of
275 /// the PCH file against an initialized Preprocessor.
277  Preprocessor &PP;
278  ASTReader &Reader;
279 
280 public:
282  : PP(PP), Reader(Reader) {}
283 
284  bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain,
285  bool AllowCompatibleDifferences) override;
286  bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain,
287  bool AllowCompatibleDifferences) override;
289  bool Complain) override;
290  bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain,
291  std::string &SuggestedPredefines) override;
292  bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
293  StringRef SpecificModuleCachePath,
294  bool Complain) override;
295  void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override;
296 
297 private:
298  void Error(const char *Msg);
299 };
300 
301 /// ASTReaderListenter implementation to set SuggestedPredefines of
302 /// ASTReader which is required to use a pch file. This is the replacement
303 /// of PCHValidator or SimplePCHValidator when using a pch file without
304 /// validating it.
306  Preprocessor &PP;
307 
308 public:
310 
311  bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain,
312  std::string &SuggestedPredefines) override;
313 };
314 
315 namespace serialization {
316 
317 class ReadMethodPoolVisitor;
318 
319 namespace reader {
320 
322 
323 /// The on-disk hash table(s) used for DeclContext name lookup.
325 
326 } // namespace reader
327 
328 } // namespace serialization
329 
330 /// Reads an AST files chain containing the contents of a translation
331 /// unit.
332 ///
333 /// The ASTReader class reads bitstreams (produced by the ASTWriter
334 /// class) containing the serialized representation of a given
335 /// abstract syntax tree and its supporting data structures. An
336 /// instance of the ASTReader can be attached to an ASTContext object,
337 /// which will provide access to the contents of the AST files.
338 ///
339 /// The AST reader provides lazy de-serialization of declarations, as
340 /// required when traversing the AST. Only those AST nodes that are
341 /// actually required will be de-serialized.
346  public ExternalSemaSource,
347  public IdentifierInfoLookup,
349 {
350 public:
351  /// Types of AST files.
352  friend class ASTDeclReader;
353  friend class ASTIdentifierIterator;
354  friend class ASTRecordReader;
355  friend class ASTUnit; // ASTUnit needs to remap source locations.
356  friend class ASTWriter;
357  friend class PCHValidator;
360  friend class TypeLocReader;
361 
364 
365  /// The result of reading the control block of an AST file, which
366  /// can fail for various reasons.
368  /// The control block was read successfully. Aside from failures,
369  /// the AST file is safe to read into the current context.
371 
372  /// The AST file itself appears corrupted.
374 
375  /// The AST file was missing.
377 
378  /// The AST file is out-of-date relative to its input files,
379  /// and needs to be regenerated.
381 
382  /// The AST file was written by a different version of Clang.
384 
385  /// The AST file was writtten with a different language/target
386  /// configuration.
388 
389  /// The AST file has errors.
391  };
392 
399 
400 private:
401  /// The receiver of some callbacks invoked by ASTReader.
402  std::unique_ptr<ASTReaderListener> Listener;
403 
404  /// The receiver of deserialization events.
405  ASTDeserializationListener *DeserializationListener = nullptr;
406 
407  bool OwnsDeserializationListener = false;
408 
409  SourceManager &SourceMgr;
410  FileManager &FileMgr;
411  const PCHContainerReader &PCHContainerRdr;
412  DiagnosticsEngine &Diags;
413 
414  /// The semantic analysis object that will be processing the
415  /// AST files and the translation unit that uses it.
416  Sema *SemaObj = nullptr;
417 
418  /// The preprocessor that will be loading the source file.
419  Preprocessor &PP;
420 
421  /// The AST context into which we'll read the AST files.
422  ASTContext *ContextObj = nullptr;
423 
424  /// The AST consumer.
425  ASTConsumer *Consumer = nullptr;
426 
427  /// The module manager which manages modules and their dependencies
428  ModuleManager ModuleMgr;
429 
430  /// A dummy identifier resolver used to merge TU-scope declarations in
431  /// C, for the cases where we don't have a Sema object to provide a real
432  /// identifier resolver.
433  IdentifierResolver DummyIdResolver;
434 
435  /// A mapping from extension block names to module file extensions.
436  llvm::StringMap<std::shared_ptr<ModuleFileExtension>> ModuleFileExtensions;
437 
438  /// A timer used to track the time spent deserializing.
439  std::unique_ptr<llvm::Timer> ReadTimer;
440 
441  /// The location where the module file will be considered as
442  /// imported from. For non-module AST types it should be invalid.
443  SourceLocation CurrentImportLoc;
444 
445  /// The module kind that is currently deserializing.
446  Optional<ModuleKind> CurrentDeserializingModuleKind;
447 
448  /// The global module index, if loaded.
449  std::unique_ptr<GlobalModuleIndex> GlobalIndex;
450 
451  /// A map of global bit offsets to the module that stores entities
452  /// at those bit offsets.
454 
455  /// A map of negated SLocEntryIDs to the modules containing them.
457 
460 
461  /// A map of reversed (SourceManager::MaxLoadedOffset - SLocOffset)
462  /// SourceLocation offsets to the modules containing them.
463  GlobalSLocOffsetMapType GlobalSLocOffsetMap;
464 
465  /// Types that have already been loaded from the chain.
466  ///
467  /// When the pointer at index I is non-NULL, the type with
468  /// ID = (I + 1) << FastQual::Width has already been loaded
469  std::vector<QualType> TypesLoaded;
470 
471  using GlobalTypeMapType =
473 
474  /// Mapping from global type IDs to the module in which the
475  /// type resides along with the offset that should be added to the
476  /// global type ID to produce a local ID.
477  GlobalTypeMapType GlobalTypeMap;
478 
479  /// Declarations that have already been loaded from the chain.
480  ///
481  /// When the pointer at index I is non-NULL, the declaration with ID
482  /// = I + 1 has already been loaded.
483  std::vector<Decl *> DeclsLoaded;
484 
485  using GlobalDeclMapType =
487 
488  /// Mapping from global declaration IDs to the module in which the
489  /// declaration resides.
490  GlobalDeclMapType GlobalDeclMap;
491 
492  using FileOffset = std::pair<ModuleFile *, uint64_t>;
494  using DeclUpdateOffsetsMap =
495  llvm::DenseMap<serialization::DeclID, FileOffsetsTy>;
496 
497  /// Declarations that have modifications residing in a later file
498  /// in the chain.
499  DeclUpdateOffsetsMap DeclUpdateOffsets;
500 
501  struct PendingUpdateRecord {
502  Decl *D;
504 
505  // Whether the declaration was just deserialized.
506  bool JustLoaded;
507 
508  PendingUpdateRecord(serialization::GlobalDeclID ID, Decl *D,
509  bool JustLoaded)
510  : D(D), ID(ID), JustLoaded(JustLoaded) {}
511  };
512 
513  /// Declaration updates for already-loaded declarations that we need
514  /// to apply once we finish processing an import.
515  llvm::SmallVector<PendingUpdateRecord, 16> PendingUpdateRecords;
516 
517  enum class PendingFakeDefinitionKind { NotFake, Fake, FakeLoaded };
518 
519  /// The DefinitionData pointers that we faked up for class definitions
520  /// that we needed but hadn't loaded yet.
521  llvm::DenseMap<void *, PendingFakeDefinitionKind> PendingFakeDefinitionData;
522 
523  /// Exception specification updates that have been loaded but not yet
524  /// propagated across the relevant redeclaration chain. The map key is the
525  /// canonical declaration (used only for deduplication) and the value is a
526  /// declaration that has an exception specification.
527  llvm::SmallMapVector<Decl *, FunctionDecl *, 4> PendingExceptionSpecUpdates;
528 
529  /// Deduced return type updates that have been loaded but not yet propagated
530  /// across the relevant redeclaration chain. The map key is the canonical
531  /// declaration and the value is the deduced return type.
532  llvm::SmallMapVector<FunctionDecl *, QualType, 4> PendingDeducedTypeUpdates;
533 
534  /// Declarations that have been imported and have typedef names for
535  /// linkage purposes.
536  llvm::DenseMap<std::pair<DeclContext *, IdentifierInfo *>, NamedDecl *>
537  ImportedTypedefNamesForLinkage;
538 
539  /// Mergeable declaration contexts that have anonymous declarations
540  /// within them, and those anonymous declarations.
541  llvm::DenseMap<Decl*, llvm::SmallVector<NamedDecl*, 2>>
542  AnonymousDeclarationsForMerging;
543 
544  /// Key used to identify LifetimeExtendedTemporaryDecl for merging,
545  /// containing the lifetime-extending declaration and the mangling number.
546  using LETemporaryKey = std::pair<Decl *, unsigned>;
547 
548  /// Map of already deserialiazed temporaries.
549  llvm::DenseMap<LETemporaryKey, LifetimeExtendedTemporaryDecl *>
550  LETemporaryForMerging;
551 
552  struct FileDeclsInfo {
553  ModuleFile *Mod = nullptr;
554  ArrayRef<serialization::LocalDeclID> Decls;
555 
556  FileDeclsInfo() = default;
557  FileDeclsInfo(ModuleFile *Mod, ArrayRef<serialization::LocalDeclID> Decls)
558  : Mod(Mod), Decls(Decls) {}
559  };
560 
561  /// Map from a FileID to the file-level declarations that it contains.
562  llvm::DenseMap<FileID, FileDeclsInfo> FileDeclIDs;
563 
564  /// An array of lexical contents of a declaration context, as a sequence of
565  /// Decl::Kind, DeclID pairs.
566  using LexicalContents = ArrayRef<llvm::support::unaligned_uint32_t>;
567 
568  /// Map from a DeclContext to its lexical contents.
569  llvm::DenseMap<const DeclContext*, std::pair<ModuleFile*, LexicalContents>>
570  LexicalDecls;
571 
572  /// Map from the TU to its lexical contents from each module file.
573  std::vector<std::pair<ModuleFile*, LexicalContents>> TULexicalDecls;
574 
575  /// Map from a DeclContext to its lookup tables.
576  llvm::DenseMap<const DeclContext *,
577  serialization::reader::DeclContextLookupTable> Lookups;
578 
579  // Updates for visible decls can occur for other contexts than just the
580  // TU, and when we read those update records, the actual context may not
581  // be available yet, so have this pending map using the ID as a key. It
582  // will be realized when the context is actually loaded.
583  struct PendingVisibleUpdate {
584  ModuleFile *Mod;
585  const unsigned char *Data;
586  };
587  using DeclContextVisibleUpdates = SmallVector<PendingVisibleUpdate, 1>;
588 
589  /// Updates to the visible declarations of declaration contexts that
590  /// haven't been loaded yet.
591  llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
592  PendingVisibleUpdates;
593 
594  /// The set of C++ or Objective-C classes that have forward
595  /// declarations that have not yet been linked to their definitions.
596  llvm::SmallPtrSet<Decl *, 4> PendingDefinitions;
597 
598  using PendingBodiesMap =
599  llvm::MapVector<Decl *, uint64_t,
600  llvm::SmallDenseMap<Decl *, unsigned, 4>,
601  SmallVector<std::pair<Decl *, uint64_t>, 4>>;
602 
603  /// Functions or methods that have bodies that will be attached.
604  PendingBodiesMap PendingBodies;
605 
606  /// Definitions for which we have added merged definitions but not yet
607  /// performed deduplication.
608  llvm::SetVector<NamedDecl *> PendingMergedDefinitionsToDeduplicate;
609 
610  /// Read the record that describes the lexical contents of a DC.
611  bool ReadLexicalDeclContextStorage(ModuleFile &M,
612  llvm::BitstreamCursor &Cursor,
613  uint64_t Offset, DeclContext *DC);
614 
615  /// Read the record that describes the visible contents of a DC.
616  bool ReadVisibleDeclContextStorage(ModuleFile &M,
617  llvm::BitstreamCursor &Cursor,
618  uint64_t Offset, serialization::DeclID ID);
619 
620  /// A vector containing identifiers that have already been
621  /// loaded.
622  ///
623  /// If the pointer at index I is non-NULL, then it refers to the
624  /// IdentifierInfo for the identifier with ID=I+1 that has already
625  /// been loaded.
626  std::vector<IdentifierInfo *> IdentifiersLoaded;
627 
628  using GlobalIdentifierMapType =
629  ContinuousRangeMap<serialization::IdentID, ModuleFile *, 4>;
630 
631  /// Mapping from global identifier IDs to the module in which the
632  /// identifier resides along with the offset that should be added to the
633  /// global identifier ID to produce a local ID.
634  GlobalIdentifierMapType GlobalIdentifierMap;
635 
636  /// A vector containing macros that have already been
637  /// loaded.
638  ///
639  /// If the pointer at index I is non-NULL, then it refers to the
640  /// MacroInfo for the identifier with ID=I+1 that has already
641  /// been loaded.
642  std::vector<MacroInfo *> MacrosLoaded;
643 
644  using LoadedMacroInfo =
645  std::pair<IdentifierInfo *, serialization::SubmoduleID>;
646 
647  /// A set of #undef directives that we have loaded; used to
648  /// deduplicate the same #undef information coming from multiple module
649  /// files.
650  llvm::DenseSet<LoadedMacroInfo> LoadedUndefs;
651 
652  using GlobalMacroMapType =
653  ContinuousRangeMap<serialization::MacroID, ModuleFile *, 4>;
654 
655  /// Mapping from global macro IDs to the module in which the
656  /// macro resides along with the offset that should be added to the
657  /// global macro ID to produce a local ID.
658  GlobalMacroMapType GlobalMacroMap;
659 
660  /// A vector containing submodules that have already been loaded.
661  ///
662  /// This vector is indexed by the Submodule ID (-1). NULL submodule entries
663  /// indicate that the particular submodule ID has not yet been loaded.
664  SmallVector<Module *, 2> SubmodulesLoaded;
665 
666  using GlobalSubmoduleMapType =
667  ContinuousRangeMap<serialization::SubmoduleID, ModuleFile *, 4>;
668 
669  /// Mapping from global submodule IDs to the module file in which the
670  /// submodule resides along with the offset that should be added to the
671  /// global submodule ID to produce a local ID.
672  GlobalSubmoduleMapType GlobalSubmoduleMap;
673 
674  /// A set of hidden declarations.
675  using HiddenNames = SmallVector<Decl *, 2>;
676  using HiddenNamesMapType = llvm::DenseMap<Module *, HiddenNames>;
677 
678  /// A mapping from each of the hidden submodules to the deserialized
679  /// declarations in that submodule that could be made visible.
680  HiddenNamesMapType HiddenNamesMap;
681 
682  /// A module import, export, or conflict that hasn't yet been resolved.
683  struct UnresolvedModuleRef {
684  /// The file in which this module resides.
685  ModuleFile *File;
686 
687  /// The module that is importing or exporting.
688  Module *Mod;
689 
690  /// The kind of module reference.
691  enum { Import, Export, Conflict } Kind;
692 
693  /// The local ID of the module that is being exported.
694  unsigned ID;
695 
696  /// Whether this is a wildcard export.
697  unsigned IsWildcard : 1;
698 
699  /// String data.
700  StringRef String;
701  };
702 
703  /// The set of module imports and exports that still need to be
704  /// resolved.
705  SmallVector<UnresolvedModuleRef, 2> UnresolvedModuleRefs;
706 
707  /// A vector containing selectors that have already been loaded.
708  ///
709  /// This vector is indexed by the Selector ID (-1). NULL selector
710  /// entries indicate that the particular selector ID has not yet
711  /// been loaded.
712  SmallVector<Selector, 16> SelectorsLoaded;
713 
714  using GlobalSelectorMapType =
715  ContinuousRangeMap<serialization::SelectorID, ModuleFile *, 4>;
716 
717  /// Mapping from global selector IDs to the module in which the
718  /// global selector ID to produce a local ID.
719  GlobalSelectorMapType GlobalSelectorMap;
720 
721  /// The generation number of the last time we loaded data from the
722  /// global method pool for this selector.
723  llvm::DenseMap<Selector, unsigned> SelectorGeneration;
724 
725  /// Whether a selector is out of date. We mark a selector as out of date
726  /// if we load another module after the method pool entry was pulled in.
727  llvm::DenseMap<Selector, bool> SelectorOutOfDate;
728 
729  struct PendingMacroInfo {
730  ModuleFile *M;
731  /// Offset relative to ModuleFile::MacroOffsetsBase.
732  uint32_t MacroDirectivesOffset;
733 
734  PendingMacroInfo(ModuleFile *M, uint32_t MacroDirectivesOffset)
735  : M(M), MacroDirectivesOffset(MacroDirectivesOffset) {}
736  };
737 
738  using PendingMacroIDsMap =
739  llvm::MapVector<IdentifierInfo *, SmallVector<PendingMacroInfo, 2>>;
740 
741  /// Mapping from identifiers that have a macro history to the global
742  /// IDs have not yet been deserialized to the global IDs of those macros.
743  PendingMacroIDsMap PendingMacroIDs;
744 
745  using GlobalPreprocessedEntityMapType =
746  ContinuousRangeMap<unsigned, ModuleFile *, 4>;
747 
748  /// Mapping from global preprocessing entity IDs to the module in
749  /// which the preprocessed entity resides along with the offset that should be
750  /// added to the global preprocessing entity ID to produce a local ID.
751  GlobalPreprocessedEntityMapType GlobalPreprocessedEntityMap;
752 
753  using GlobalSkippedRangeMapType =
754  ContinuousRangeMap<unsigned, ModuleFile *, 4>;
755 
756  /// Mapping from global skipped range base IDs to the module in which
757  /// the skipped ranges reside.
758  GlobalSkippedRangeMapType GlobalSkippedRangeMap;
759 
760  /// \name CodeGen-relevant special data
761  /// Fields containing data that is relevant to CodeGen.
762  //@{
763 
764  /// The IDs of all declarations that fulfill the criteria of
765  /// "interesting" decls.
766  ///
767  /// This contains the data loaded from all EAGERLY_DESERIALIZED_DECLS blocks
768  /// in the chain. The referenced declarations are deserialized and passed to
769  /// the consumer eagerly.
770  SmallVector<serialization::DeclID, 16> EagerlyDeserializedDecls;
771 
772  /// The IDs of all tentative definitions stored in the chain.
773  ///
774  /// Sema keeps track of all tentative definitions in a TU because it has to
775  /// complete them and pass them on to CodeGen. Thus, tentative definitions in
776  /// the PCH chain must be eagerly deserialized.
777  SmallVector<serialization::DeclID, 16> TentativeDefinitions;
778 
779  /// The IDs of all CXXRecordDecls stored in the chain whose VTables are
780  /// used.
781  ///
782  /// CodeGen has to emit VTables for these records, so they have to be eagerly
783  /// deserialized.
784  SmallVector<serialization::DeclID, 64> VTableUses;
785 
786  /// A snapshot of the pending instantiations in the chain.
787  ///
788  /// This record tracks the instantiations that Sema has to perform at the
789  /// end of the TU. It consists of a pair of values for every pending
790  /// instantiation where the first value is the ID of the decl and the second
791  /// is the instantiation location.
792  SmallVector<serialization::DeclID, 64> PendingInstantiations;
793 
794  //@}
795 
796  /// \name DiagnosticsEngine-relevant special data
797  /// Fields containing data that is used for generating diagnostics
798  //@{
799 
800  /// A snapshot of Sema's unused file-scoped variable tracking, for
801  /// generating warnings.
802  SmallVector<serialization::DeclID, 16> UnusedFileScopedDecls;
803 
804  /// A list of all the delegating constructors we've seen, to diagnose
805  /// cycles.
806  SmallVector<serialization::DeclID, 4> DelegatingCtorDecls;
807 
808  /// Method selectors used in a @selector expression. Used for
809  /// implementation of -Wselector.
810  SmallVector<serialization::SelectorID, 64> ReferencedSelectorsData;
811 
812  /// A snapshot of Sema's weak undeclared identifier tracking, for
813  /// generating warnings.
814  SmallVector<serialization::IdentifierID, 64> WeakUndeclaredIdentifiers;
815 
816  /// The IDs of type aliases for ext_vectors that exist in the chain.
817  ///
818  /// Used by Sema for finding sugared names for ext_vectors in diagnostics.
819  SmallVector<serialization::DeclID, 4> ExtVectorDecls;
820 
821  //@}
822 
823  /// \name Sema-relevant special data
824  /// Fields containing data that is used for semantic analysis
825  //@{
826 
827  /// The IDs of all potentially unused typedef names in the chain.
828  ///
829  /// Sema tracks these to emit warnings.
830  SmallVector<serialization::DeclID, 16> UnusedLocalTypedefNameCandidates;
831 
832  /// Our current depth in #pragma cuda force_host_device begin/end
833  /// macros.
834  unsigned ForceCUDAHostDeviceDepth = 0;
835 
836  /// The IDs of the declarations Sema stores directly.
837  ///
838  /// Sema tracks a few important decls, such as namespace std, directly.
839  SmallVector<serialization::DeclID, 4> SemaDeclRefs;
840 
841  /// The IDs of the types ASTContext stores directly.
842  ///
843  /// The AST context tracks a few important types, such as va_list, directly.
844  SmallVector<serialization::TypeID, 16> SpecialTypes;
845 
846  /// The IDs of CUDA-specific declarations ASTContext stores directly.
847  ///
848  /// The AST context tracks a few important decls, currently cudaConfigureCall,
849  /// directly.
850  SmallVector<serialization::DeclID, 2> CUDASpecialDeclRefs;
851 
852  /// The floating point pragma option settings.
853  SmallVector<uint64_t, 1> FPPragmaOptions;
854 
855  /// The pragma clang optimize location (if the pragma state is "off").
856  SourceLocation OptimizeOffPragmaLocation;
857 
858  /// The PragmaMSStructKind pragma ms_struct state if set, or -1.
859  int PragmaMSStructState = -1;
860 
861  /// The PragmaMSPointersToMembersKind pragma pointers_to_members state.
862  int PragmaMSPointersToMembersState = -1;
863  SourceLocation PointersToMembersPragmaLocation;
864 
865  /// The pragma float_control state.
866  Optional<FPOptionsOverride> FpPragmaCurrentValue;
867  SourceLocation FpPragmaCurrentLocation;
868  struct FpPragmaStackEntry {
869  FPOptionsOverride Value;
870  SourceLocation Location;
871  SourceLocation PushLocation;
872  StringRef SlotLabel;
873  };
875  llvm::SmallVector<std::string, 2> FpPragmaStrings;
876 
877  /// The pragma align/pack state.
878  Optional<Sema::AlignPackInfo> PragmaAlignPackCurrentValue;
879  SourceLocation PragmaAlignPackCurrentLocation;
880  struct PragmaAlignPackStackEntry {
881  Sema::AlignPackInfo Value;
882  SourceLocation Location;
883  SourceLocation PushLocation;
884  StringRef SlotLabel;
885  };
887  llvm::SmallVector<std::string, 2> PragmaAlignPackStrings;
888 
889  /// The OpenCL extension settings.
890  OpenCLOptions OpenCLExtensions;
891 
892  /// Extensions required by an OpenCL type.
893  llvm::DenseMap<const Type *, std::set<std::string>> OpenCLTypeExtMap;
894 
895  /// Extensions required by an OpenCL declaration.
896  llvm::DenseMap<const Decl *, std::set<std::string>> OpenCLDeclExtMap;
897 
898  /// A list of the namespaces we've seen.
899  SmallVector<serialization::DeclID, 4> KnownNamespaces;
900 
901  /// A list of undefined decls with internal linkage followed by the
902  /// SourceLocation of a matching ODR-use.
903  SmallVector<serialization::DeclID, 8> UndefinedButUsed;
904 
905  /// Delete expressions to analyze at the end of translation unit.
906  SmallVector<uint64_t, 8> DelayedDeleteExprs;
907 
908  // A list of late parsed template function data with their module files.
909  SmallVector<std::pair<ModuleFile *, SmallVector<uint64_t, 1>>, 4>
910  LateParsedTemplates;
911 
912  /// The IDs of all decls to be checked for deferred diags.
913  ///
914  /// Sema tracks these to emit deferred diags.
915  llvm::SmallSetVector<serialization::DeclID, 4> DeclsToCheckForDeferredDiags;
916 
917 public:
921 
923  : ID(ID), ImportLoc(ImportLoc) {}
924  };
925 
926 private:
927  /// A list of modules that were imported by precompiled headers or
928  /// any other non-module AST file.
929  SmallVector<ImportedSubmodule, 2> ImportedModules;
930  //@}
931 
932  /// The system include root to be used when loading the
933  /// precompiled header.
934  std::string isysroot;
935 
936  /// Whether to disable the normal validation performed on precompiled
937  /// headers and module files when they are loaded.
938  DisableValidationForModuleKind DisableValidationKind;
939 
940  /// Whether to accept an AST file with compiler errors.
941  bool AllowASTWithCompilerErrors;
942 
943  /// Whether to accept an AST file that has a different configuration
944  /// from the current compiler instance.
945  bool AllowConfigurationMismatch;
946 
947  /// Whether validate system input files.
948  bool ValidateSystemInputs;
949 
950  /// Whether validate headers and module maps using hash based on contents.
951  bool ValidateASTInputFilesContent;
952 
953  /// Whether we are allowed to use the global module index.
954  bool UseGlobalIndex;
955 
956  /// Whether we have tried loading the global module index yet.
957  bool TriedLoadingGlobalIndex = false;
958 
959  ///Whether we are currently processing update records.
960  bool ProcessingUpdateRecords = false;
961 
962  using SwitchCaseMapTy = llvm::DenseMap<unsigned, SwitchCase *>;
963 
964  /// Mapping from switch-case IDs in the chain to switch-case statements
965  ///
966  /// Statements usually don't have IDs, but switch cases need them, so that the
967  /// switch statement can refer to them.
968  SwitchCaseMapTy SwitchCaseStmts;
969 
970  SwitchCaseMapTy *CurrSwitchCaseStmts;
971 
972  /// The number of source location entries de-serialized from
973  /// the PCH file.
974  unsigned NumSLocEntriesRead = 0;
975 
976  /// The number of source location entries in the chain.
977  unsigned TotalNumSLocEntries = 0;
978 
979  /// The number of statements (and expressions) de-serialized
980  /// from the chain.
981  unsigned NumStatementsRead = 0;
982 
983  /// The total number of statements (and expressions) stored
984  /// in the chain.
985  unsigned TotalNumStatements = 0;
986 
987  /// The number of macros de-serialized from the chain.
988  unsigned NumMacrosRead = 0;
989 
990  /// The total number of macros stored in the chain.
991  unsigned TotalNumMacros = 0;
992 
993  /// The number of lookups into identifier tables.
994  unsigned NumIdentifierLookups = 0;
995 
996  /// The number of lookups into identifier tables that succeed.
997  unsigned NumIdentifierLookupHits = 0;
998 
999  /// The number of selectors that have been read.
1000  unsigned NumSelectorsRead = 0;
1001 
1002  /// The number of method pool entries that have been read.
1003  unsigned NumMethodPoolEntriesRead = 0;
1004 
1005  /// The number of times we have looked up a selector in the method
1006  /// pool.
1007  unsigned NumMethodPoolLookups = 0;
1008 
1009  /// The number of times we have looked up a selector in the method
1010  /// pool and found something.
1011  unsigned NumMethodPoolHits = 0;
1012 
1013  /// The number of times we have looked up a selector in the method
1014  /// pool within a specific module.
1015  unsigned NumMethodPoolTableLookups = 0;
1016 
1017  /// The number of times we have looked up a selector in the method
1018  /// pool within a specific module and found something.
1019  unsigned NumMethodPoolTableHits = 0;
1020 
1021  /// The total number of method pool entries in the selector table.
1022  unsigned TotalNumMethodPoolEntries = 0;
1023 
1024  /// Number of lexical decl contexts read/total.
1025  unsigned NumLexicalDeclContextsRead = 0, TotalLexicalDeclContexts = 0;
1026 
1027  /// Number of visible decl contexts read/total.
1028  unsigned NumVisibleDeclContextsRead = 0, TotalVisibleDeclContexts = 0;
1029 
1030  /// Total size of modules, in bits, currently loaded
1031  uint64_t TotalModulesSizeInBits = 0;
1032 
1033  /// Number of Decl/types that are currently deserializing.
1034  unsigned NumCurrentElementsDeserializing = 0;
1035 
1036  /// Set true while we are in the process of passing deserialized
1037  /// "interesting" decls to consumer inside FinishedDeserializing().
1038  /// This is used as a guard to avoid recursively repeating the process of
1039  /// passing decls to consumer.
1040  bool PassingDeclsToConsumer = false;
1041 
1042  /// The set of identifiers that were read while the AST reader was
1043  /// (recursively) loading declarations.
1044  ///
1045  /// The declarations on the identifier chain for these identifiers will be
1046  /// loaded once the recursive loading has completed.
1047  llvm::MapVector<IdentifierInfo *, SmallVector<uint32_t, 4>>
1048  PendingIdentifierInfos;
1049 
1050  /// The set of lookup results that we have faked in order to support
1051  /// merging of partially deserialized decls but that we have not yet removed.
1052  llvm::SmallMapVector<IdentifierInfo *, SmallVector<NamedDecl*, 2>, 16>
1053  PendingFakeLookupResults;
1054 
1055  /// The generation number of each identifier, which keeps track of
1056  /// the last time we loaded information about this identifier.
1057  llvm::DenseMap<IdentifierInfo *, unsigned> IdentifierGeneration;
1058 
1059  class InterestingDecl {
1060  Decl *D;
1061  bool DeclHasPendingBody;
1062 
1063  public:
1064  InterestingDecl(Decl *D, bool HasBody)
1065  : D(D), DeclHasPendingBody(HasBody) {}
1066 
1067  Decl *getDecl() { return D; }
1068 
1069  /// Whether the declaration has a pending body.
1070  bool hasPendingBody() { return DeclHasPendingBody; }
1071  };
1072 
1073  /// Contains declarations and definitions that could be
1074  /// "interesting" to the ASTConsumer, when we get that AST consumer.
1075  ///
1076  /// "Interesting" declarations are those that have data that may
1077  /// need to be emitted, such as inline function definitions or
1078  /// Objective-C protocols.
1079  std::deque<InterestingDecl> PotentiallyInterestingDecls;
1080 
1081  /// The list of deduced function types that we have not yet read, because
1082  /// they might contain a deduced return type that refers to a local type
1083  /// declared within the function.
1084  SmallVector<std::pair<FunctionDecl *, serialization::TypeID>, 16>
1085  PendingFunctionTypes;
1086 
1087  /// The list of redeclaration chains that still need to be
1088  /// reconstructed, and the local offset to the corresponding list
1089  /// of redeclarations.
1090  SmallVector<std::pair<Decl *, uint64_t>, 16> PendingDeclChains;
1091 
1092  /// The list of canonical declarations whose redeclaration chains
1093  /// need to be marked as incomplete once we're done deserializing things.
1094  SmallVector<Decl *, 16> PendingIncompleteDeclChains;
1095 
1096  /// The Decl IDs for the Sema/Lexical DeclContext of a Decl that has
1097  /// been loaded but its DeclContext was not set yet.
1098  struct PendingDeclContextInfo {
1099  Decl *D;
1101  serialization::GlobalDeclID LexicalDC;
1102  };
1103 
1104  /// The set of Decls that have been loaded but their DeclContexts are
1105  /// not set yet.
1106  ///
1107  /// The DeclContexts for these Decls will be set once recursive loading has
1108  /// been completed.
1109  std::deque<PendingDeclContextInfo> PendingDeclContextInfos;
1110 
1111  /// The set of NamedDecls that have been loaded, but are members of a
1112  /// context that has been merged into another context where the corresponding
1113  /// declaration is either missing or has not yet been loaded.
1114  ///
1115  /// We will check whether the corresponding declaration is in fact missing
1116  /// once recursing loading has been completed.
1117  llvm::SmallVector<NamedDecl *, 16> PendingOdrMergeChecks;
1118 
1119  using DataPointers =
1120  std::pair<CXXRecordDecl *, struct CXXRecordDecl::DefinitionData *>;
1121 
1122  /// Record definitions in which we found an ODR violation.
1123  llvm::SmallDenseMap<CXXRecordDecl *, llvm::SmallVector<DataPointers, 2>, 2>
1124  PendingOdrMergeFailures;
1125 
1126  /// Function definitions in which we found an ODR violation.
1127  llvm::SmallDenseMap<FunctionDecl *, llvm::SmallVector<FunctionDecl *, 2>, 2>
1128  PendingFunctionOdrMergeFailures;
1129 
1130  /// Enum definitions in which we found an ODR violation.
1131  llvm::SmallDenseMap<EnumDecl *, llvm::SmallVector<EnumDecl *, 2>, 2>
1132  PendingEnumOdrMergeFailures;
1133 
1134  /// DeclContexts in which we have diagnosed an ODR violation.
1135  llvm::SmallPtrSet<DeclContext*, 2> DiagnosedOdrMergeFailures;
1136 
1137  /// The set of Objective-C categories that have been deserialized
1138  /// since the last time the declaration chains were linked.
1139  llvm::SmallPtrSet<ObjCCategoryDecl *, 16> CategoriesDeserialized;
1140 
1141  /// The set of Objective-C class definitions that have already been
1142  /// loaded, for which we will need to check for categories whenever a new
1143  /// module is loaded.
1144  SmallVector<ObjCInterfaceDecl *, 16> ObjCClassesLoaded;
1145 
1146  using KeyDeclsMap =
1147  llvm::DenseMap<Decl *, SmallVector<serialization::DeclID, 2>>;
1148 
1149  /// A mapping from canonical declarations to the set of global
1150  /// declaration IDs for key declaration that have been merged with that
1151  /// canonical declaration. A key declaration is a formerly-canonical
1152  /// declaration whose module did not import any other key declaration for that
1153  /// entity. These are the IDs that we use as keys when finding redecl chains.
1154  KeyDeclsMap KeyDecls;
1155 
1156  /// A mapping from DeclContexts to the semantic DeclContext that we
1157  /// are treating as the definition of the entity. This is used, for instance,
1158  /// when merging implicit instantiations of class templates across modules.
1159  llvm::DenseMap<DeclContext *, DeclContext *> MergedDeclContexts;
1160 
1161  /// A mapping from canonical declarations of enums to their canonical
1162  /// definitions. Only populated when using modules in C++.
1163  llvm::DenseMap<EnumDecl *, EnumDecl *> EnumDefinitions;
1164 
1165  /// A mapping from canonical declarations of records to their canonical
1166  /// definitions. Doesn't cover CXXRecordDecl.
1167  llvm::DenseMap<RecordDecl *, RecordDecl *> RecordDefinitions;
1168 
1169  /// When reading a Stmt tree, Stmt operands are placed in this stack.
1170  SmallVector<Stmt *, 16> StmtStack;
1171 
1172  /// What kind of records we are reading.
1173  enum ReadingKind {
1174  Read_None, Read_Decl, Read_Type, Read_Stmt
1175  };
1176 
1177  /// What kind of records we are reading.
1178  ReadingKind ReadingKind = Read_None;
1179 
1180  /// RAII object to change the reading kind.
1181  class ReadingKindTracker {
1182  ASTReader &Reader;
1183  enum ReadingKind PrevKind;
1184 
1185  public:
1186  ReadingKindTracker(enum ReadingKind newKind, ASTReader &reader)
1187  : Reader(reader), PrevKind(Reader.ReadingKind) {
1188  Reader.ReadingKind = newKind;
1189  }
1190 
1191  ReadingKindTracker(const ReadingKindTracker &) = delete;
1192  ReadingKindTracker &operator=(const ReadingKindTracker &) = delete;
1193  ~ReadingKindTracker() { Reader.ReadingKind = PrevKind; }
1194  };
1195 
1196  /// RAII object to mark the start of processing updates.
1197  class ProcessingUpdatesRAIIObj {
1198  ASTReader &Reader;
1199  bool PrevState;
1200 
1201  public:
1202  ProcessingUpdatesRAIIObj(ASTReader &reader)
1203  : Reader(reader), PrevState(Reader.ProcessingUpdateRecords) {
1204  Reader.ProcessingUpdateRecords = true;
1205  }
1206 
1207  ProcessingUpdatesRAIIObj(const ProcessingUpdatesRAIIObj &) = delete;
1208  ProcessingUpdatesRAIIObj &
1209  operator=(const ProcessingUpdatesRAIIObj &) = delete;
1210  ~ProcessingUpdatesRAIIObj() { Reader.ProcessingUpdateRecords = PrevState; }
1211  };
1212 
1213  /// Suggested contents of the predefines buffer, after this
1214  /// PCH file has been processed.
1215  ///
1216  /// In most cases, this string will be empty, because the predefines
1217  /// buffer computed to build the PCH file will be identical to the
1218  /// predefines buffer computed from the command line. However, when
1219  /// there are differences that the PCH reader can work around, this
1220  /// predefines buffer may contain additional definitions.
1221  std::string SuggestedPredefines;
1222 
1223  llvm::DenseMap<const Decl *, bool> DefinitionSource;
1224 
1225  bool shouldDisableValidationForFile(const serialization::ModuleFile &M) const;
1226 
1227  /// Reads a statement from the specified cursor.
1228  Stmt *ReadStmtFromStream(ModuleFile &F);
1229 
1230  struct InputFileInfo {
1232  uint64_t ContentHash;
1233  off_t StoredSize;
1234  time_t StoredTime;
1235  bool Overridden;
1236  bool Transient;
1237  bool TopLevelModuleMap;
1238  };
1239 
1240  /// Reads the stored information about an input file.
1241  InputFileInfo readInputFileInfo(ModuleFile &F, unsigned ID);
1242 
1243  /// Retrieve the file entry and 'overridden' bit for an input
1244  /// file in the given module file.
1245  serialization::InputFile getInputFile(ModuleFile &F, unsigned ID,
1246  bool Complain = true);
1247 
1248 public:
1250  static void ResolveImportedPath(std::string &Filename, StringRef Prefix);
1251 
1252  /// Returns the first key declaration for the given declaration. This
1253  /// is one that is formerly-canonical (or still canonical) and whose module
1254  /// did not import any other key declaration of the entity.
1256  D = D->getCanonicalDecl();
1257  if (D->isFromASTFile())
1258  return D;
1259 
1260  auto I = KeyDecls.find(D);
1261  if (I == KeyDecls.end() || I->second.empty())
1262  return D;
1263  return GetExistingDecl(I->second[0]);
1264  }
1265  const Decl *getKeyDeclaration(const Decl *D) {
1266  return getKeyDeclaration(const_cast<Decl*>(D));
1267  }
1268 
1269  /// Run a callback on each imported key declaration of \p D.
1270  template <typename Fn>
1271  void forEachImportedKeyDecl(const Decl *D, Fn Visit) {
1272  D = D->getCanonicalDecl();
1273  if (D->isFromASTFile())
1274  Visit(D);
1275 
1276  auto It = KeyDecls.find(const_cast<Decl*>(D));
1277  if (It != KeyDecls.end())
1278  for (auto ID : It->second)
1279  Visit(GetExistingDecl(ID));
1280  }
1281 
1282  /// Get the loaded lookup tables for \p Primary, if any.
1284  getLoadedLookupTables(DeclContext *Primary) const;
1285 
1286 private:
1287  struct ImportedModule {
1288  ModuleFile *Mod;
1289  ModuleFile *ImportedBy;
1290  SourceLocation ImportLoc;
1291 
1292  ImportedModule(ModuleFile *Mod,
1293  ModuleFile *ImportedBy,
1294  SourceLocation ImportLoc)
1295  : Mod(Mod), ImportedBy(ImportedBy), ImportLoc(ImportLoc) {}
1296  };
1297 
1298  ASTReadResult ReadASTCore(StringRef FileName, ModuleKind Type,
1299  SourceLocation ImportLoc, ModuleFile *ImportedBy,
1300  SmallVectorImpl<ImportedModule> &Loaded,
1301  off_t ExpectedSize, time_t ExpectedModTime,
1302  ASTFileSignature ExpectedSignature,
1303  unsigned ClientLoadCapabilities);
1304  ASTReadResult ReadControlBlock(ModuleFile &F,
1305  SmallVectorImpl<ImportedModule> &Loaded,
1306  const ModuleFile *ImportedBy,
1307  unsigned ClientLoadCapabilities);
1308  static ASTReadResult ReadOptionsBlock(
1309  llvm::BitstreamCursor &Stream, unsigned ClientLoadCapabilities,
1310  bool AllowCompatibleConfigurationMismatch, ASTReaderListener &Listener,
1311  std::string &SuggestedPredefines);
1312 
1313  /// Read the unhashed control block.
1314  ///
1315  /// This has no effect on \c F.Stream, instead creating a fresh cursor from
1316  /// \c F.Data and reading ahead.
1317  ASTReadResult readUnhashedControlBlock(ModuleFile &F, bool WasImportedBy,
1318  unsigned ClientLoadCapabilities);
1319 
1320  static ASTReadResult
1321  readUnhashedControlBlockImpl(ModuleFile *F, llvm::StringRef StreamData,
1322  unsigned ClientLoadCapabilities,
1323  bool AllowCompatibleConfigurationMismatch,
1324  ASTReaderListener *Listener,
1325  bool ValidateDiagnosticOptions);
1326 
1327  llvm::Error ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities);
1328  llvm::Error ReadExtensionBlock(ModuleFile &F);
1329  void ReadModuleOffsetMap(ModuleFile &F) const;
1330  void ParseLineTable(ModuleFile &F, const RecordData &Record);
1331  llvm::Error ReadSourceManagerBlock(ModuleFile &F);
1332  llvm::BitstreamCursor &SLocCursorForID(int ID);
1333  SourceLocation getImportLocation(ModuleFile *F);
1334  ASTReadResult ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F,
1335  const ModuleFile *ImportedBy,
1336  unsigned ClientLoadCapabilities);
1337  llvm::Error ReadSubmoduleBlock(ModuleFile &F,
1338  unsigned ClientLoadCapabilities);
1339  static bool ParseLanguageOptions(const RecordData &Record, bool Complain,
1340  ASTReaderListener &Listener,
1341  bool AllowCompatibleDifferences);
1342  static bool ParseTargetOptions(const RecordData &Record, bool Complain,
1343  ASTReaderListener &Listener,
1344  bool AllowCompatibleDifferences);
1345  static bool ParseDiagnosticOptions(const RecordData &Record, bool Complain,
1346  ASTReaderListener &Listener);
1347  static bool ParseFileSystemOptions(const RecordData &Record, bool Complain,
1348  ASTReaderListener &Listener);
1349  static bool ParseHeaderSearchOptions(const RecordData &Record, bool Complain,
1350  ASTReaderListener &Listener);
1351  static bool ParsePreprocessorOptions(const RecordData &Record, bool Complain,
1352  ASTReaderListener &Listener,
1353  std::string &SuggestedPredefines);
1354 
1355  struct RecordLocation {
1356  ModuleFile *F;
1357  uint64_t Offset;
1358 
1359  RecordLocation(ModuleFile *M, uint64_t O) : F(M), Offset(O) {}
1360  };
1361 
1362  QualType readTypeRecord(unsigned Index);
1363  RecordLocation TypeCursorForIndex(unsigned Index);
1364  void LoadedDecl(unsigned Index, Decl *D);
1365  Decl *ReadDeclRecord(serialization::DeclID ID);
1366  void markIncompleteDeclChain(Decl *Canon);
1367 
1368  /// Returns the most recent declaration of a declaration (which must be
1369  /// of a redeclarable kind) that is either local or has already been loaded
1370  /// merged into its redecl chain.
1371  Decl *getMostRecentExistingDecl(Decl *D);
1372 
1373  RecordLocation DeclCursorForID(serialization::DeclID ID,
1374  SourceLocation &Location);
1375  void loadDeclUpdateRecords(PendingUpdateRecord &Record);
1376  void loadPendingDeclChain(Decl *D, uint64_t LocalOffset);
1377  void loadObjCCategories(serialization::GlobalDeclID ID, ObjCInterfaceDecl *D,
1378  unsigned PreviousGeneration = 0);
1379 
1380  RecordLocation getLocalBitOffset(uint64_t GlobalOffset);
1381  uint64_t getGlobalBitOffset(ModuleFile &M, uint64_t LocalOffset);
1382 
1383  /// Returns the first preprocessed entity ID that begins or ends after
1384  /// \arg Loc.
1386  findPreprocessedEntity(SourceLocation Loc, bool EndsAfter) const;
1387 
1388  /// Find the next module that contains entities and return the ID
1389  /// of the first entry.
1390  ///
1391  /// \param SLocMapI points at a chunk of a module that contains no
1392  /// preprocessed entities or the entities it contains are not the
1393  /// ones we are looking for.
1395  findNextPreprocessedEntity(
1397 
1398  /// Returns (ModuleFile, Local index) pair for \p GlobalIndex of a
1399  /// preprocessed entity.
1400  std::pair<ModuleFile *, unsigned>
1401  getModulePreprocessedEntity(unsigned GlobalIndex);
1402 
1403  /// Returns (begin, end) pair for the preprocessed entities of a
1404  /// particular module.
1405  llvm::iterator_range<PreprocessingRecord::iterator>
1406  getModulePreprocessedEntities(ModuleFile &Mod) const;
1407 
1408  bool canRecoverFromOutOfDate(StringRef ModuleFileName,
1409  unsigned ClientLoadCapabilities);
1410 
1411 public:
1413  : public llvm::iterator_adaptor_base<
1414  ModuleDeclIterator, const serialization::LocalDeclID *,
1415  std::random_access_iterator_tag, const Decl *, ptrdiff_t,
1416  const Decl *, const Decl *> {
1417  ASTReader *Reader = nullptr;
1418  ModuleFile *Mod = nullptr;
1419 
1420  public:
1421  ModuleDeclIterator() : iterator_adaptor_base(nullptr) {}
1422 
1424  const serialization::LocalDeclID *Pos)
1425  : iterator_adaptor_base(Pos), Reader(Reader), Mod(Mod) {}
1426 
1427  value_type operator*() const {
1428  return Reader->GetDecl(Reader->getGlobalDeclID(*Mod, *I));
1429  }
1430 
1431  value_type operator->() const { return **this; }
1432 
1433  bool operator==(const ModuleDeclIterator &RHS) const {
1434  assert(Reader == RHS.Reader && Mod == RHS.Mod);
1435  return I == RHS.I;
1436  }
1437  };
1438 
1439  llvm::iterator_range<ModuleDeclIterator>
1441 
1442 private:
1443  void PassInterestingDeclsToConsumer();
1444  void PassInterestingDeclToConsumer(Decl *D);
1445 
1446  void finishPendingActions();
1447  void diagnoseOdrViolations();
1448 
1449  void pushExternalDeclIntoScope(NamedDecl *D, DeclarationName Name);
1450 
1451  void addPendingDeclContextInfo(Decl *D,
1453  serialization::GlobalDeclID LexicalDC) {
1454  assert(D);
1455  PendingDeclContextInfo Info = { D, SemaDC, LexicalDC };
1456  PendingDeclContextInfos.push_back(Info);
1457  }
1458 
1459  /// Produce an error diagnostic and return true.
1460  ///
1461  /// This routine should only be used for fatal errors that have to
1462  /// do with non-routine failures (e.g., corrupted AST file).
1463  void Error(StringRef Msg) const;
1464  void Error(unsigned DiagID, StringRef Arg1 = StringRef(),
1465  StringRef Arg2 = StringRef(), StringRef Arg3 = StringRef()) const;
1466  void Error(llvm::Error &&Err) const;
1467 
1468 public:
1469  /// Load the AST file and validate its contents against the given
1470  /// Preprocessor.
1471  ///
1472  /// \param PP the preprocessor associated with the context in which this
1473  /// precompiled header will be loaded.
1474  ///
1475  /// \param Context the AST context that this precompiled header will be
1476  /// loaded into, if any.
1477  ///
1478  /// \param PCHContainerRdr the PCHContainerOperations to use for loading and
1479  /// creating modules.
1480  ///
1481  /// \param Extensions the list of module file extensions that can be loaded
1482  /// from the AST files.
1483  ///
1484  /// \param isysroot If non-NULL, the system include path specified by the
1485  /// user. This is only used with relocatable PCH files. If non-NULL,
1486  /// a relocatable PCH file will use the default path "/".
1487  ///
1488  /// \param DisableValidationKind If set, the AST reader will suppress most
1489  /// of its regular consistency checking, allowing the use of precompiled
1490  /// headers and module files that cannot be determined to be compatible.
1491  ///
1492  /// \param AllowASTWithCompilerErrors If true, the AST reader will accept an
1493  /// AST file the was created out of an AST with compiler errors,
1494  /// otherwise it will reject it.
1495  ///
1496  /// \param AllowConfigurationMismatch If true, the AST reader will not check
1497  /// for configuration differences between the AST file and the invocation.
1498  ///
1499  /// \param ValidateSystemInputs If true, the AST reader will validate
1500  /// system input files in addition to user input files. This is only
1501  /// meaningful if \p DisableValidation is false.
1502  ///
1503  /// \param UseGlobalIndex If true, the AST reader will try to load and use
1504  /// the global module index.
1505  ///
1506  /// \param ReadTimer If non-null, a timer used to track the time spent
1507  /// deserializing.
1508  ASTReader(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
1509  ASTContext *Context, const PCHContainerReader &PCHContainerRdr,
1510  ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
1511  StringRef isysroot = "",
1512  DisableValidationForModuleKind DisableValidationKind =
1514  bool AllowASTWithCompilerErrors = false,
1515  bool AllowConfigurationMismatch = false,
1516  bool ValidateSystemInputs = false,
1517  bool ValidateASTInputFilesContent = false,
1518  bool UseGlobalIndex = true,
1519  std::unique_ptr<llvm::Timer> ReadTimer = {});
1520  ASTReader(const ASTReader &) = delete;
1521  ASTReader &operator=(const ASTReader &) = delete;
1522  ~ASTReader() override;
1523 
1524  SourceManager &getSourceManager() const { return SourceMgr; }
1525  FileManager &getFileManager() const { return FileMgr; }
1526  DiagnosticsEngine &getDiags() const { return Diags; }
1527 
1528  /// Flags that indicate what kind of AST loading failures the client
1529  /// of the AST reader can directly handle.
1530  ///
1531  /// When a client states that it can handle a particular kind of failure,
1532  /// the AST reader will not emit errors when producing that kind of failure.
1534  /// The client can't handle any AST loading failures.
1536 
1537  /// The client can handle an AST file that cannot load because it
1538  /// is missing.
1540 
1541  /// The client can handle an AST file that cannot load because it
1542  /// is out-of-date relative to its input files.
1544 
1545  /// The client can handle an AST file that cannot load because it
1546  /// was built with a different version of Clang.
1548 
1549  /// The client can handle an AST file that cannot load because it's
1550  /// compiled configuration doesn't match that of the context it was
1551  /// loaded into.
1553 
1554  /// If a module file is marked with errors treat it as out-of-date so the
1555  /// caller can rebuild it.
1557  };
1558 
1559  /// Load the AST file designated by the given file name.
1560  ///
1561  /// \param FileName The name of the AST file to load.
1562  ///
1563  /// \param Type The kind of AST being loaded, e.g., PCH, module, main file,
1564  /// or preamble.
1565  ///
1566  /// \param ImportLoc the location where the module file will be considered as
1567  /// imported from. For non-module AST types it should be invalid.
1568  ///
1569  /// \param ClientLoadCapabilities The set of client load-failure
1570  /// capabilities, represented as a bitset of the enumerators of
1571  /// LoadFailureCapabilities.
1572  ///
1573  /// \param Imported optional out-parameter to append the list of modules
1574  /// that were imported by precompiled headers or any other non-module AST file
1575  ASTReadResult ReadAST(StringRef FileName, ModuleKind Type,
1576  SourceLocation ImportLoc,
1577  unsigned ClientLoadCapabilities,
1578  SmallVectorImpl<ImportedSubmodule> *Imported = nullptr);
1579 
1580  /// Make the entities in the given module and any of its (non-explicit)
1581  /// submodules visible to name lookup.
1582  ///
1583  /// \param Mod The module whose names should be made visible.
1584  ///
1585  /// \param NameVisibility The level of visibility to give the names in the
1586  /// module. Visibility can only be increased over time.
1587  ///
1588  /// \param ImportLoc The location at which the import occurs.
1589  void makeModuleVisible(Module *Mod,
1590  Module::NameVisibilityKind NameVisibility,
1591  SourceLocation ImportLoc);
1592 
1593  /// Make the names within this set of hidden names visible.
1594  void makeNamesVisible(const HiddenNames &Names, Module *Owner);
1595 
1596  /// Note that MergedDef is a redefinition of the canonical definition
1597  /// Def, so Def should be visible whenever MergedDef is.
1598  void mergeDefinitionVisibility(NamedDecl *Def, NamedDecl *MergedDef);
1599 
1600  /// Take the AST callbacks listener.
1601  std::unique_ptr<ASTReaderListener> takeListener() {
1602  return std::move(Listener);
1603  }
1604 
1605  /// Set the AST callbacks listener.
1606  void setListener(std::unique_ptr<ASTReaderListener> Listener) {
1607  this->Listener = std::move(Listener);
1608  }
1609 
1610  /// Add an AST callback listener.
1611  ///
1612  /// Takes ownership of \p L.
1613  void addListener(std::unique_ptr<ASTReaderListener> L) {
1614  if (Listener)
1615  L = std::make_unique<ChainedASTReaderListener>(std::move(L),
1616  std::move(Listener));
1617  Listener = std::move(L);
1618  }
1619 
1620  /// RAII object to temporarily add an AST callback listener.
1622  ASTReader &Reader;
1623  bool Chained = false;
1624 
1625  public:
1626  ListenerScope(ASTReader &Reader, std::unique_ptr<ASTReaderListener> L)
1627  : Reader(Reader) {
1628  auto Old = Reader.takeListener();
1629  if (Old) {
1630  Chained = true;
1631  L = std::make_unique<ChainedASTReaderListener>(std::move(L),
1632  std::move(Old));
1633  }
1634  Reader.setListener(std::move(L));
1635  }
1636 
1638  auto New = Reader.takeListener();
1639  if (Chained)
1640  Reader.setListener(static_cast<ChainedASTReaderListener *>(New.get())
1641  ->takeSecond());
1642  }
1643  };
1644 
1645  /// Set the AST deserialization listener.
1647  bool TakeOwnership = false);
1648 
1649  /// Get the AST deserialization listener.
1651  return DeserializationListener;
1652  }
1653 
1654  /// Determine whether this AST reader has a global index.
1655  bool hasGlobalIndex() const { return (bool)GlobalIndex; }
1656 
1657  /// Return global module index.
1658  GlobalModuleIndex *getGlobalIndex() { return GlobalIndex.get(); }
1659 
1660  /// Reset reader for a reload try.
1661  void resetForReload() { TriedLoadingGlobalIndex = false; }
1662 
1663  /// Attempts to load the global index.
1664  ///
1665  /// \returns true if loading the global index has failed for any reason.
1666  bool loadGlobalIndex();
1667 
1668  /// Determine whether we tried to load the global index, but failed,
1669  /// e.g., because it is out-of-date or does not exist.
1670  bool isGlobalIndexUnavailable() const;
1671 
1672  /// Initializes the ASTContext
1673  void InitializeContext();
1674 
1675  /// Update the state of Sema after loading some additional modules.
1676  void UpdateSema();
1677 
1678  /// Add in-memory (virtual file) buffer.
1679  void addInMemoryBuffer(StringRef &FileName,
1680  std::unique_ptr<llvm::MemoryBuffer> Buffer) {
1681  ModuleMgr.addInMemoryBuffer(FileName, std::move(Buffer));
1682  }
1683 
1684  /// Finalizes the AST reader's state before writing an AST file to
1685  /// disk.
1686  ///
1687  /// This operation may undo temporary state in the AST that should not be
1688  /// emitted.
1689  void finalizeForWriting();
1690 
1691  /// Retrieve the module manager.
1692  ModuleManager &getModuleManager() { return ModuleMgr; }
1693 
1694  /// Retrieve the preprocessor.
1695  Preprocessor &getPreprocessor() const { return PP; }
1696 
1697  /// Retrieve the name of the original source file name for the primary
1698  /// module file.
1700  return ModuleMgr.getPrimaryModule().OriginalSourceFileName;
1701  }
1702 
1703  /// Retrieve the name of the original source file name directly from
1704  /// the AST file, without actually loading the AST file.
1705  static std::string
1706  getOriginalSourceFile(const std::string &ASTFileName, FileManager &FileMgr,
1707  const PCHContainerReader &PCHContainerRdr,
1708  DiagnosticsEngine &Diags);
1709 
1710  /// Read the control block for the named AST file.
1711  ///
1712  /// \returns true if an error occurred, false otherwise.
1713  static bool
1714  readASTFileControlBlock(StringRef Filename, FileManager &FileMgr,
1715  const PCHContainerReader &PCHContainerRdr,
1716  bool FindModuleFileExtensions,
1717  ASTReaderListener &Listener,
1718  bool ValidateDiagnosticOptions);
1719 
1720  /// Determine whether the given AST file is acceptable to load into a
1721  /// translation unit with the given language and target options.
1722  static bool isAcceptableASTFile(StringRef Filename, FileManager &FileMgr,
1723  const PCHContainerReader &PCHContainerRdr,
1724  const LangOptions &LangOpts,
1725  const TargetOptions &TargetOpts,
1726  const PreprocessorOptions &PPOpts,
1727  StringRef ExistingModuleCachePath);
1728 
1729  /// Returns the suggested contents of the predefines buffer,
1730  /// which contains a (typically-empty) subset of the predefines
1731  /// build prior to including the precompiled header.
1732  const std::string &getSuggestedPredefines() { return SuggestedPredefines; }
1733 
1734  /// Read a preallocated preprocessed entity from the external source.
1735  ///
1736  /// \returns null if an error occurred that prevented the preprocessed
1737  /// entity from being loaded.
1738  PreprocessedEntity *ReadPreprocessedEntity(unsigned Index) override;
1739 
1740  /// Returns a pair of [Begin, End) indices of preallocated
1741  /// preprocessed entities that \p Range encompasses.
1742  std::pair<unsigned, unsigned>
1744 
1745  /// Optionally returns true or false if the preallocated preprocessed
1746  /// entity with index \p Index came from file \p FID.
1748  FileID FID) override;
1749 
1750  /// Read a preallocated skipped range from the external source.
1751  SourceRange ReadSkippedRange(unsigned Index) override;
1752 
1753  /// Read the header file information for the given file entry.
1754  HeaderFileInfo GetHeaderFileInfo(const FileEntry *FE) override;
1755 
1757 
1758  /// Returns the number of source locations found in the chain.
1759  unsigned getTotalNumSLocs() const {
1760  return TotalNumSLocEntries;
1761  }
1762 
1763  /// Returns the number of identifiers found in the chain.
1764  unsigned getTotalNumIdentifiers() const {
1765  return static_cast<unsigned>(IdentifiersLoaded.size());
1766  }
1767 
1768  /// Returns the number of macros found in the chain.
1769  unsigned getTotalNumMacros() const {
1770  return static_cast<unsigned>(MacrosLoaded.size());
1771  }
1772 
1773  /// Returns the number of types found in the chain.
1774  unsigned getTotalNumTypes() const {
1775  return static_cast<unsigned>(TypesLoaded.size());
1776  }
1777 
1778  /// Returns the number of declarations found in the chain.
1779  unsigned getTotalNumDecls() const {
1780  return static_cast<unsigned>(DeclsLoaded.size());
1781  }
1782 
1783  /// Returns the number of submodules known.
1784  unsigned getTotalNumSubmodules() const {
1785  return static_cast<unsigned>(SubmodulesLoaded.size());
1786  }
1787 
1788  /// Returns the number of selectors found in the chain.
1789  unsigned getTotalNumSelectors() const {
1790  return static_cast<unsigned>(SelectorsLoaded.size());
1791  }
1792 
1793  /// Returns the number of preprocessed entities known to the AST
1794  /// reader.
1796  unsigned Result = 0;
1797  for (const auto &M : ModuleMgr)
1798  Result += M.NumPreprocessedEntities;
1799  return Result;
1800  }
1801 
1802  /// Resolve a type ID into a type, potentially building a new
1803  /// type.
1805 
1806  /// Resolve a local type ID within a given AST file into a type.
1807  QualType getLocalType(ModuleFile &F, unsigned LocalID);
1808 
1809  /// Map a local type ID within a given AST file into a global type ID.
1810  serialization::TypeID getGlobalTypeID(ModuleFile &F, unsigned LocalID) const;
1811 
1812  /// Read a type from the current position in the given record, which
1813  /// was read from the given AST file.
1814  QualType readType(ModuleFile &F, const RecordData &Record, unsigned &Idx) {
1815  if (Idx >= Record.size())
1816  return {};
1817 
1818  return getLocalType(F, Record[Idx++]);
1819  }
1820 
1821  /// Map from a local declaration ID within a given module to a
1822  /// global declaration ID.
1824  serialization::LocalDeclID LocalID) const;
1825 
1826  /// Returns true if global DeclID \p ID originated from module \p M.
1828 
1829  /// Retrieve the module file that owns the given declaration, or NULL
1830  /// if the declaration is not from a module file.
1831  ModuleFile *getOwningModuleFile(const Decl *D);
1832 
1833  /// Get the best name we know for the module that owns the given
1834  /// declaration, or an empty string if the declaration is not from a module.
1836 
1837  /// Returns the source location for the decl \p ID.
1839 
1840  /// Resolve a declaration ID into a declaration, potentially
1841  /// building a new declaration.
1843  Decl *GetExternalDecl(uint32_t ID) override;
1844 
1845  /// Resolve a declaration ID into a declaration. Return 0 if it's not
1846  /// been loaded yet.
1848 
1849  /// Reads a declaration with the given local ID in the given module.
1850  Decl *GetLocalDecl(ModuleFile &F, uint32_t LocalID) {
1851  return GetDecl(getGlobalDeclID(F, LocalID));
1852  }
1853 
1854  /// Reads a declaration with the given local ID in the given module.
1855  ///
1856  /// \returns The requested declaration, casted to the given return type.
1857  template<typename T>
1858  T *GetLocalDeclAs(ModuleFile &F, uint32_t LocalID) {
1859  return cast_or_null<T>(GetLocalDecl(F, LocalID));
1860  }
1861 
1862  /// Map a global declaration ID into the declaration ID used to
1863  /// refer to this declaration within the given module fule.
1864  ///
1865  /// \returns the global ID of the given declaration as known in the given
1866  /// module file.
1869  serialization::DeclID GlobalID);
1870 
1871  /// Reads a declaration ID from the given position in a record in the
1872  /// given module.
1873  ///
1874  /// \returns The declaration ID read from the record, adjusted to a global ID.
1876  unsigned &Idx);
1877 
1878  /// Reads a declaration from the given position in a record in the
1879  /// given module.
1880  Decl *ReadDecl(ModuleFile &F, const RecordData &R, unsigned &I) {
1881  return GetDecl(ReadDeclID(F, R, I));
1882  }
1883 
1884  /// Reads a declaration from the given position in a record in the
1885  /// given module.
1886  ///
1887  /// \returns The declaration read from this location, casted to the given
1888  /// result type.
1889  template<typename T>
1890  T *ReadDeclAs(ModuleFile &F, const RecordData &R, unsigned &I) {
1891  return cast_or_null<T>(GetDecl(ReadDeclID(F, R, I)));
1892  }
1893 
1894  /// If any redeclarations of \p D have been imported since it was
1895  /// last checked, this digs out those redeclarations and adds them to the
1896  /// redeclaration chain for \p D.
1897  void CompleteRedeclChain(const Decl *D) override;
1898 
1900 
1901  /// Resolve the offset of a statement into a statement.
1902  ///
1903  /// This operation will read a new statement from the external
1904  /// source each time it is called, and is meant to be used via a
1905  /// LazyOffsetPtr (which is used by Decls for the body of functions, etc).
1906  Stmt *GetExternalDeclStmt(uint64_t Offset) override;
1907 
1908  /// ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the
1909  /// specified cursor. Read the abbreviations that are at the top of the block
1910  /// and then leave the cursor pointing into the block.
1911  static llvm::Error ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
1912  unsigned BlockID,
1913  uint64_t *StartOfBlockOffset = nullptr);
1914 
1915  /// Finds all the visible declarations with a given name.
1916  /// The current implementation of this method just loads the entire
1917  /// lookup table as unmaterialized references.
1919  DeclarationName Name) override;
1920 
1921  /// Read all of the declarations lexically stored in a
1922  /// declaration context.
1923  ///
1924  /// \param DC The declaration context whose declarations will be
1925  /// read.
1926  ///
1927  /// \param IsKindWeWant A predicate indicating which declaration kinds
1928  /// we are interested in.
1929  ///
1930  /// \param Decls Vector that will contain the declarations loaded
1931  /// from the external source. The caller is responsible for merging
1932  /// these declarations with any declarations already stored in the
1933  /// declaration context.
1934  void
1936  llvm::function_ref<bool(Decl::Kind)> IsKindWeWant,
1937  SmallVectorImpl<Decl *> &Decls) override;
1938 
1939  /// Get the decls that are contained in a file in the Offset/Length
1940  /// range. \p Length can be 0 to indicate a point at \p Offset instead of
1941  /// a range.
1942  void FindFileRegionDecls(FileID File, unsigned Offset, unsigned Length,
1943  SmallVectorImpl<Decl *> &Decls) override;
1944 
1945  /// Notify ASTReader that we started deserialization of
1946  /// a decl or type so until FinishedDeserializing is called there may be
1947  /// decls that are initializing. Must be paired with FinishedDeserializing.
1948  void StartedDeserializing() override;
1949 
1950  /// Notify ASTReader that we finished the deserialization of
1951  /// a decl or type. Must be paired with StartedDeserializing.
1952  void FinishedDeserializing() override;
1953 
1954  /// Function that will be invoked when we begin parsing a new
1955  /// translation unit involving this external AST source.
1956  ///
1957  /// This function will provide all of the external definitions to
1958  /// the ASTConsumer.
1959  void StartTranslationUnit(ASTConsumer *Consumer) override;
1960 
1961  /// Print some statistics about AST usage.
1962  void PrintStats() override;
1963 
1964  /// Dump information about the AST reader to standard error.
1965  void dump();
1966 
1967  /// Return the amount of memory used by memory buffers, breaking down
1968  /// by heap-backed versus mmap'ed memory.
1969  void getMemoryBufferSizes(MemoryBufferSizes &sizes) const override;
1970 
1971  /// Initialize the semantic source with the Sema instance
1972  /// being used to perform semantic analysis on the abstract syntax
1973  /// tree.
1974  void InitializeSema(Sema &S) override;
1975 
1976  /// Inform the semantic consumer that Sema is no longer available.
1977  void ForgetSema() override { SemaObj = nullptr; }
1978 
1979  /// Retrieve the IdentifierInfo for the named identifier.
1980  ///
1981  /// This routine builds a new IdentifierInfo for the given identifier. If any
1982  /// declarations with this name are visible from translation unit scope, their
1983  /// declarations will be deserialized and introduced into the declaration
1984  /// chain of the identifier.
1985  IdentifierInfo *get(StringRef Name) override;
1986 
1987  /// Retrieve an iterator into the set of all identifiers
1988  /// in all loaded AST files.
1989  IdentifierIterator *getIdentifiers() override;
1990 
1991  /// Load the contents of the global method pool for a given
1992  /// selector.
1993  void ReadMethodPool(Selector Sel) override;
1994 
1995  /// Load the contents of the global method pool for a given
1996  /// selector if necessary.
1997  void updateOutOfDateSelector(Selector Sel) override;
1998 
1999  /// Load the set of namespaces that are known to the external source,
2000  /// which will be used during typo correction.
2001  void ReadKnownNamespaces(
2002  SmallVectorImpl<NamespaceDecl *> &Namespaces) override;
2003 
2004  void ReadUndefinedButUsed(
2005  llvm::MapVector<NamedDecl *, SourceLocation> &Undefined) override;
2006 
2007  void ReadMismatchingDeleteExpressions(llvm::MapVector<
2008  FieldDecl *, llvm::SmallVector<std::pair<SourceLocation, bool>, 4>> &
2009  Exprs) override;
2010 
2012  SmallVectorImpl<VarDecl *> &TentativeDefs) override;
2013 
2015  SmallVectorImpl<const DeclaratorDecl *> &Decls) override;
2016 
2018  SmallVectorImpl<CXXConstructorDecl *> &Decls) override;
2019 
2021 
2024 
2026  llvm::SmallSetVector<Decl *, 4> &Decls) override;
2027 
2029  SmallVectorImpl<std::pair<Selector, SourceLocation>> &Sels) override;
2030 
2032  SmallVectorImpl<std::pair<IdentifierInfo *, WeakInfo>> &WI) override;
2033 
2034  void ReadUsedVTables(SmallVectorImpl<ExternalVTableUse> &VTables) override;
2035 
2037  SmallVectorImpl<std::pair<ValueDecl *,
2038  SourceLocation>> &Pending) override;
2039 
2041  llvm::MapVector<const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
2042  &LPTMap) override;
2043 
2044  /// Load a selector from disk, registering its ID if it exists.
2045  void LoadSelector(Selector Sel);
2046 
2047  void SetIdentifierInfo(unsigned ID, IdentifierInfo *II);
2049  const SmallVectorImpl<uint32_t> &DeclIDs,
2050  SmallVectorImpl<Decl *> *Decls = nullptr);
2051 
2052  /// Report a diagnostic.
2053  DiagnosticBuilder Diag(unsigned DiagID) const;
2054 
2055  /// Report a diagnostic.
2056  DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const;
2057 
2059 
2061  unsigned &Idx) {
2062  return DecodeIdentifierInfo(getGlobalIdentifierID(M, Record[Idx++]));
2063  }
2064 
2066  // Note that we are loading an identifier.
2067  Deserializing AnIdentifier(this);
2068 
2069  return DecodeIdentifierInfo(ID);
2070  }
2071 
2072  IdentifierInfo *getLocalIdentifier(ModuleFile &M, unsigned LocalID);
2073 
2075  unsigned LocalID);
2076 
2077  void resolvePendingMacro(IdentifierInfo *II, const PendingMacroInfo &PMInfo);
2078 
2079  /// Retrieve the macro with the given ID.
2081 
2082  /// Retrieve the global macro ID corresponding to the given local
2083  /// ID within the given module file.
2084  serialization::MacroID getGlobalMacroID(ModuleFile &M, unsigned LocalID);
2085 
2086  /// Read the source location entry with index ID.
2087  bool ReadSLocEntry(int ID) override;
2088 
2089  /// Retrieve the module import location and module name for the
2090  /// given source manager entry ID.
2091  std::pair<SourceLocation, StringRef> getModuleImportLoc(int ID) override;
2092 
2093  /// Retrieve the global submodule ID given a module and its local ID
2094  /// number.
2096  getGlobalSubmoduleID(ModuleFile &M, unsigned LocalID);
2097 
2098  /// Retrieve the submodule that corresponds to a global submodule ID.
2099  ///
2101 
2102  /// Retrieve the module that corresponds to the given module ID.
2103  ///
2104  /// Note: overrides method in ExternalASTSource
2105  Module *getModule(unsigned ID) override;
2106 
2107  /// Retrieve the module file with a given local ID within the specified
2108  /// ModuleFile.
2109  ModuleFile *getLocalModuleFile(ModuleFile &M, unsigned ID);
2110 
2111  /// Get an ID for the given module file.
2112  unsigned getModuleFileID(ModuleFile *M);
2113 
2114  /// Return a descriptor for the corresponding module.
2116 
2117  ExtKind hasExternalDefinitions(const Decl *D) override;
2118 
2119  /// Retrieve a selector from the given module with its local ID
2120  /// number.
2121  Selector getLocalSelector(ModuleFile &M, unsigned LocalID);
2122 
2124 
2126  uint32_t GetNumExternalSelectors() override;
2127 
2128  Selector ReadSelector(ModuleFile &M, const RecordData &Record, unsigned &Idx) {
2129  return getLocalSelector(M, Record[Idx++]);
2130  }
2131 
2132  /// Retrieve the global selector ID that corresponds to this
2133  /// the local selector ID in a given module.
2135  unsigned LocalID) const;
2136 
2137  /// Read the contents of a CXXCtorInitializer array.
2139 
2140  /// Read a AlignPackInfo from raw form.
2143  }
2144 
2145  /// Read a source location from raw form and return it in its
2146  /// originating module file's source location space.
2149  return SourceLocation::getFromRawEncoding((Raw >> 1) |
2150  (Raw << (8 * sizeof(Raw) - 1)));
2151  }
2152 
2153  /// Read a source location from raw form.
2155  SourceLocation::UIntTy Raw) const {
2157  return TranslateSourceLocation(ModuleFile, Loc);
2158  }
2159 
2160  /// Translate a source location from another module file's source
2161  /// location space into ours.
2163  SourceLocation Loc) const {
2164  if (!ModuleFile.ModuleOffsetMap.empty())
2165  ReadModuleOffsetMap(ModuleFile);
2166  assert(ModuleFile.SLocRemap.find(Loc.getOffset()) !=
2167  ModuleFile.SLocRemap.end() &&
2168  "Cannot find offset to remap.");
2169  SourceLocation::IntTy Remap =
2170  ModuleFile.SLocRemap.find(Loc.getOffset())->second;
2171  return Loc.getLocWithOffset(Remap);
2172  }
2173 
2174  /// Read a source location.
2176  const RecordDataImpl &Record,
2177  unsigned &Idx) {
2178  return ReadSourceLocation(ModuleFile, Record[Idx++]);
2179  }
2180 
2181  /// Read a source range.
2183  const RecordData &Record, unsigned &Idx);
2184 
2185  // Read a string
2186  static std::string ReadString(const RecordData &Record, unsigned &Idx);
2187 
2188  // Skip a string
2189  static void SkipString(const RecordData &Record, unsigned &Idx) {
2190  Idx += Record[Idx] + 1;
2191  }
2192 
2193  // Read a path
2194  std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx);
2195 
2196  // Read a path
2197  std::string ReadPath(StringRef BaseDirectory, const RecordData &Record,
2198  unsigned &Idx);
2199 
2200  // Skip a path
2201  static void SkipPath(const RecordData &Record, unsigned &Idx) {
2202  SkipString(Record, Idx);
2203  }
2204 
2205  /// Read a version tuple.
2206  static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx);
2207 
2209  unsigned &Idx);
2210 
2211  /// Reads a statement.
2212  Stmt *ReadStmt(ModuleFile &F);
2213 
2214  /// Reads an expression.
2215  Expr *ReadExpr(ModuleFile &F);
2216 
2217  /// Reads a sub-statement operand during statement reading.
2219  assert(ReadingKind == Read_Stmt &&
2220  "Should be called only during statement reading!");
2221  // Subexpressions are stored from last to first, so the next Stmt we need
2222  // is at the back of the stack.
2223  assert(!StmtStack.empty() && "Read too many sub-statements!");
2224  return StmtStack.pop_back_val();
2225  }
2226 
2227  /// Reads a sub-expression operand during statement reading.
2228  Expr *ReadSubExpr();
2229 
2230  /// Reads a token out of a record.
2231  Token ReadToken(ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx);
2232 
2233  /// Reads the macro record located at the given offset.
2234  MacroInfo *ReadMacroRecord(ModuleFile &F, uint64_t Offset);
2235 
2236  /// Determine the global preprocessed entity ID that corresponds to
2237  /// the given local ID within the given module.
2239  getGlobalPreprocessedEntityID(ModuleFile &M, unsigned LocalID) const;
2240 
2241  /// Add a macro to deserialize its macro directive history.
2242  ///
2243  /// \param II The name of the macro.
2244  /// \param M The module file.
2245  /// \param MacroDirectivesOffset Offset of the serialized macro directive
2246  /// history.
2248  uint32_t MacroDirectivesOffset);
2249 
2250  /// Read the set of macros defined by this external macro source.
2251  void ReadDefinedMacros() override;
2252 
2253  /// Update an out-of-date identifier.
2254  void updateOutOfDateIdentifier(IdentifierInfo &II) override;
2255 
2256  /// Note that this identifier is up-to-date.
2258 
2259  /// Load all external visible decls in the given DeclContext.
2260  void completeVisibleDeclsMap(const DeclContext *DC) override;
2261 
2262  /// Retrieve the AST context that this AST reader supplements.
2264  assert(ContextObj && "requested AST context when not loading AST");
2265  return *ContextObj;
2266  }
2267 
2268  // Contains the IDs for declarations that were requested before we have
2269  // access to a Sema object.
2271 
2272  /// Retrieve the semantic analysis object used to analyze the
2273  /// translation unit in which the precompiled header is being
2274  /// imported.
2275  Sema *getSema() { return SemaObj; }
2276 
2277  /// Get the identifier resolver used for name lookup / updates
2278  /// in the translation unit scope. We have one of these even if we don't
2279  /// have a Sema object.
2281 
2282  /// Retrieve the identifier table associated with the
2283  /// preprocessor.
2285 
2286  /// Record that the given ID maps to the given switch-case
2287  /// statement.
2288  void RecordSwitchCaseID(SwitchCase *SC, unsigned ID);
2289 
2290  /// Retrieve the switch-case statement with the given ID.
2291  SwitchCase *getSwitchCaseWithID(unsigned ID);
2292 
2293  void ClearSwitchCaseIDs();
2294 
2295  /// Cursors for comments blocks.
2296  SmallVector<std::pair<llvm::BitstreamCursor,
2298 
2299  /// Loads comments ranges.
2300  void ReadComments() override;
2301 
2302  /// Visit all the input files of the given module file.
2304  bool IncludeSystem, bool Complain,
2305  llvm::function_ref<void(const serialization::InputFile &IF,
2306  bool isSystem)> Visitor);
2307 
2308  /// Visit all the top-level module maps loaded when building the given module
2309  /// file.
2311  llvm::function_ref<
2312  void(const FileEntry *)> Visitor);
2313 
2314  bool isProcessingUpdateRecords() { return ProcessingUpdateRecords; }
2315 };
2316 
2317 } // namespace clang
2318 
2319 #endif // LLVM_CLANG_SERIALIZATION_ASTREADER_H
clang::ASTReader::getTotalNumIdentifiers
unsigned getTotalNumIdentifiers() const
Returns the number of identifiers found in the chain.
Definition: ASTReader.h:1764
clang::serialization::ReadMethodPoolVisitor
Definition: ASTReader.cpp:8120
clang::ASTReader::getFileManager
FileManager & getFileManager() const
Definition: ASTReader.h:1525
clang::ASTReaderListener::ReadLanguageOptions
virtual bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences)
Receives the language options.
Definition: ASTReader.h:132
clang::ASTReader::DecodeIdentifierInfo
IdentifierInfo * DecodeIdentifierInfo(serialization::IdentifierID ID)
Definition: ASTReader.cpp:8497
clang::ChainedASTReaderListener::ReadLanguageOptions
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
Definition: ASTReader.cpp:168
clang::ASTUnit
Utility class for loading a ASTContext from an AST file.
Definition: ASTUnit.h:89
clang::ChainedASTReaderListener::readModuleFileExtension
void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata) override
Indicates that a particular module file extension has been read.
Definition: ASTReader.cpp:254
clang::ASTReader::getContext
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Definition: ASTReader.h:2263
clang::ASTReaderListener::needsInputFileVisitation
virtual bool needsInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
Definition: ASTReader.h:200
clang::GlobalModuleIndex
A global index for a set of module files, providing information about the identifiers within those mo...
Definition: GlobalModuleIndex.h:56
clang::Sema::AlignPackInfo::getFromRawEncoding
static AlignPackInfo getFromRawEncoding(unsigned Encoding)
Definition: Sema.h:528
clang::ASTReader::resetForReload
void resetForReload()
Reset reader for a reload try.
Definition: ASTReader.h:1661
clang::ExternalPreprocessorSource
Abstract interface for external sources of preprocessor information.
Definition: ExternalPreprocessorSource.h:26
clang::ExternalPreprocessingRecordSource
An abstract class that should be subclassed by any external source of preprocessing record entries.
Definition: PreprocessingRecord.h:279
clang::ASTReader::ModuleDeclIterator
Definition: ASTReader.h:1412
clang::DiagnosticBuilder
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:1264
clang::ASTReader::ClearSwitchCaseIDs
void ClearSwitchCaseIDs()
Definition: ASTReader.cpp:9042
clang::serialization::ModuleManager
Manages the set of modules loaded by an AST reader.
Definition: ModuleManager.h:48
clang::ASTReader::ModuleDeclIterator::operator==
bool operator==(const ModuleDeclIterator &RHS) const
Definition: ASTReader.h:1433
clang::ASTReader::operator=
ASTReader & operator=(const ASTReader &)=delete
clang::ASTReader::HadErrors
@ HadErrors
The AST file has errors.
Definition: ASTReader.h:390
clang::DeclaratorContext::File
@ File
Error
llvm::Error Error
Definition: ByteCodeEmitter.cpp:20
clang::ASTReader::GetExternalDeclStmt
Stmt * GetExternalDeclStmt(uint64_t Offset) override
Resolve the offset of a statement into a statement.
Definition: ASTReader.cpp:7480
clang::ASTReader::makeModuleVisible
void makeModuleVisible(Module *Mod, Module::NameVisibilityKind NameVisibility, SourceLocation ImportLoc)
Make the entities in the given module and any of its (non-explicit) submodules visible to name lookup...
Definition: ASTReader.cpp:4042
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::PreprocessorOptions
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
Definition: PreprocessorOptions.h:64
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1347
OpenCLOptions.h
clang::ASTReader::UpdateSema
void UpdateSema()
Update the state of Sema after loading some additional modules.
Definition: ASTReader.cpp:7875
clang::ASTReader::getTotalNumDecls
unsigned getTotalNumDecls() const
Returns the number of declarations found in the chain.
Definition: ASTReader.h:1779
clang::ASTReader::getTotalNumMacros
unsigned getTotalNumMacros() const
Returns the number of macros found in the chain.
Definition: ASTReader.h:1769
clang::ASTReader::ReadUntranslatedSourceLocation
SourceLocation ReadUntranslatedSourceLocation(SourceLocation::UIntTy Raw) const
Read a source location from raw form and return it in its originating module file's source location s...
Definition: ASTReader.h:2148
clang::TypeLocReader
Definition: ASTReader.cpp:6433
clang::serialization::ModuleManager::addInMemoryBuffer
void addInMemoryBuffer(StringRef FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Add an in-memory buffer the list of known buffers.
Definition: ModuleManager.cpp:300
clang::ASTReaderListener::ReadPreprocessorOptions
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines)
Receives the preprocessor options.
Definition: ASTReader.h:184
clang::ASTReader::ReadPendingInstantiations
void ReadPendingInstantiations(SmallVectorImpl< std::pair< ValueDecl *, SourceLocation >> &Pending) override
Definition: ASTReader.cpp:8394
clang::ASTReader::Failure
@ Failure
The AST file itself appears corrupted.
Definition: ASTReader.h:373
clang::serialization::reader::ASTIdentifierLookupTrait
Class that performs lookup for an identifier stored in an AST file.
Definition: ASTReaderInternals.h:159
clang::ASTReader::FindExternalVisibleDeclsByName
bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) override
Finds all the visible declarations with a given name.
Definition: ASTReader.cpp:7614
llvm::SmallVector< uint64_t, 64 >
clang::ASTReader::ReadSubStmt
Stmt * ReadSubStmt()
Reads a sub-statement operand during statement reading.
Definition: ASTReader.h:2218
clang::ASTReader::ReadMismatchingDeleteExpressions
void ReadMismatchingDeleteExpressions(llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 >> &Exprs) override
Definition: ASTReader.cpp:8265
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::SourceLocation::getLocWithOffset
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
Definition: SourceLocation.h:136
clang::ASTReader::GetLocalDeclAs
T * GetLocalDeclAs(ModuleFile &F, uint32_t LocalID)
Reads a declaration with the given local ID in the given module.
Definition: ASTReader.h:1858
clang::ASTRecordReader
An object for streaming information from a record.
Definition: ASTRecordReader.h:30
clang::ASTReader::RecordData
SmallVector< uint64_t, 64 > RecordData
Definition: ASTReader.h:362
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:249
clang::ChainedASTReaderListener::ReadFileSystemOptions
bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain) override
Receives the file system options.
Definition: ASTReader.cpp:193
IdentifierResolver.h
clang::ASTReader::getSema
Sema * getSema()
Retrieve the semantic analysis object used to analyze the translation unit in which the precompiled h...
Definition: ASTReader.h:2275
clang::ASTReader::ReadSelector
Selector ReadSelector(ModuleFile &M, const RecordData &Record, unsigned &Idx)
Definition: ASTReader.h:2128
clang::ASTReader::get
IdentifierInfo * get(StringRef Name) override
Retrieve the IdentifierInfo for the named identifier.
Definition: ASTReader.cpp:7979
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:673
clang::ASTReaderListener::ReadTargetOptions
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, bool AllowCompatibleDifferences)
Receives the target options.
Definition: ASTReader.h:142
clang::ASTReader::visitInputFiles
void visitInputFiles(serialization::ModuleFile &MF, bool IncludeSystem, bool Complain, llvm::function_ref< void(const serialization::InputFile &IF, bool isSystem)> Visitor)
Visit all the input files of the given module file.
Definition: ASTReader.cpp:9118
clang::ASTReader::ReadAST
ASTReadResult ReadAST(StringRef FileName, ModuleKind Type, SourceLocation ImportLoc, unsigned ClientLoadCapabilities, SmallVectorImpl< ImportedSubmodule > *Imported=nullptr)
Load the AST file designated by the given file name.
Definition: ASTReader.cpp:4197
clang::ASTReader::getIdentifiers
IdentifierIterator * getIdentifiers() override
Retrieve an iterator into the set of all identifiers in all loaded AST files.
Definition: ASTReader.cpp:8104
clang::ASTReader::GetExistingDecl
Decl * GetExistingDecl(serialization::DeclID ID)
Resolve a declaration ID into a declaration.
Definition: ASTReader.cpp:7401
Cursor
Cursor
Definition: SerializedDiagnosticReader.cpp:109
clang::FieldDecl
Represents a member of a struct/union/class.
Definition: Decl.h:2835
clang::ASTReader::ReadExtVectorDecls
void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls) override
Read the set of ext_vector type declarations known to the external Sema source.
Definition: ASTReader.cpp:8312
Filename
StringRef Filename
Definition: Format.cpp:2333
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:191
clang::ASTReader::getSourceDescriptor
llvm::Optional< ASTSourceDescriptor > getSourceDescriptor(unsigned ID) override
Return a descriptor for the corresponding module.
Definition: ASTReader.cpp:8653
clang::ASTReader::ARR_ConfigurationMismatch
@ ARR_ConfigurationMismatch
The client can handle an AST file that cannot load because it's compiled configuration doesn't match ...
Definition: ASTReader.h:1552
clang::ASTReader::readIdentifier
IdentifierInfo * readIdentifier(ModuleFile &M, const RecordData &Record, unsigned &Idx)
Definition: ASTReader.h:2060
clang::ASTReader::ModuleReverseIterator
ModuleManager::ModuleReverseIterator ModuleReverseIterator
Definition: ASTReader.h:398
clang::Module::NameVisibilityKind
NameVisibilityKind
Describes the visibility of the various names within a particular module.
Definition: Module.h:312
clang::ChainedASTReaderListener::ReadTargetOptions
bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
Definition: ASTReader.cpp:177
clang::ASTReader::ReadVersionTuple
static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx)
Read a version tuple.
Definition: ASTReader.cpp:8995
clang::ASTReader::ASTReader
ASTReader(Preprocessor &PP, InMemoryModuleCache &ModuleCache, ASTContext *Context, const PCHContainerReader &PCHContainerRdr, ArrayRef< std::shared_ptr< ModuleFileExtension >> Extensions, StringRef isysroot="", DisableValidationForModuleKind DisableValidationKind=DisableValidationForModuleKind::None, bool AllowASTWithCompilerErrors=false, bool AllowConfigurationMismatch=false, bool ValidateSystemInputs=false, bool ValidateASTInputFilesContent=false, bool UseGlobalIndex=true, std::unique_ptr< llvm::Timer > ReadTimer={})
Load the AST file and validate its contents against the given Preprocessor.
Definition: ASTReader.cpp:11618
clang::ASTReader::getOriginalSourceFile
StringRef getOriginalSourceFile()
Retrieve the name of the original source file name for the primary module file.
Definition: ASTReader.h:1699
clang::ASTReader::getPreprocessor
Preprocessor & getPreprocessor() const
Retrieve the preprocessor.
Definition: ASTReader.h:1695
clang::ASTReader::getMacro
MacroInfo * getMacro(serialization::MacroID ID)
Retrieve the macro with the given ID.
Definition: ASTReader.cpp:8547
llvm::Optional< ModuleKind >
clang::PCHValidator::ReadCounter
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
Definition: ASTReader.cpp:809
clang::ComparisonCategoryType::First
@ First
clang::ASTReader::ReadPreprocessedEntity
PreprocessedEntity * ReadPreprocessedEntity(unsigned Index) override
Read a preallocated preprocessed entity from the external source.
Definition: ASTReader.cpp:5937
clang::ASTReader::TranslateSourceLocation
SourceLocation TranslateSourceLocation(ModuleFile &ModuleFile, SourceLocation Loc) const
Translate a source location from another module file's source location space into ours.
Definition: ASTReader.h:2162
llvm::SmallPtrSet
Definition: ASTContext.h:82
clang::MacroInfo
Encapsulates the data about a macro definition (e.g.
Definition: MacroInfo.h:39
clang::SimpleASTReaderListener::ReadPreprocessorOptions
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
Definition: ASTReader.cpp:764
clang::PCHValidator::PCHValidator
PCHValidator(Preprocessor &PP, ASTReader &Reader)
Definition: ASTReader.h:281
clang::ASTReader::getKeyDeclaration
const Decl * getKeyDeclaration(const Decl *D)
Definition: ASTReader.h:1265
clang::ASTReader::getGlobalDeclID
serialization::DeclID getGlobalDeclID(ModuleFile &F, serialization::LocalDeclID LocalID) const
Map from a local declaration ID within a given module to a global declaration ID.
Definition: ASTReader.cpp:7291
ContinuousRangeMap.h
clang::ASTReader::ReadSLocEntry
bool ReadSLocEntry(int ID) override
Read the source location entry with index ID.
Definition: ASTReader.cpp:1432
clang::serialization::ModuleManager::ModuleReverseIterator
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::reverse_iterator > ModuleReverseIterator
Definition: ModuleManager.h:139
clang::Token
Token - This structure provides full information about a lexed token.
Definition: Token.h:34
clang::ASTReader::getModule
Module * getModule(unsigned ID) override
Retrieve the module that corresponds to the given module ID.
Definition: ASTReader.cpp:8618
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:145
clang::ASTReaderListener::~ASTReaderListener
virtual ~ASTReaderListener()
clang::PCHContainerReader
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
Definition: PCHContainerOperations.h:57
clang::DisableValidationForModuleKind::None
@ None
Perform validation, don't disable it.
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:626
clang::ASTReader::CompleteRedeclChain
void CompleteRedeclChain(const Decl *D) override
If any redeclarations of D have been imported since it was last checked, this digs out those redeclar...
Definition: ASTReader.cpp:7160
clang::ASTReader::FinishedDeserializing
void FinishedDeserializing() override
Notify ASTReader that we finished the deserialization of a decl or type.
Definition: ASTReader.cpp:11540
clang::serialization::MacroID
uint32_t MacroID
An ID number that refers to a macro in an AST file.
Definition: ASTBitCodes.h:140
clang::ASTReader::GetDecl
Decl * GetDecl(serialization::DeclID ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
Definition: ASTReader.cpp:7426
clang::ASTReader::ReadDefinedMacros
void ReadDefinedMacros() override
Read the set of macros defined by this external macro source.
Definition: ASTReader.cpp:1942
clang::ASTReader::makeNamesVisible
void makeNamesVisible(const HiddenNames &Names, Module *Owner)
Make the names within this set of hidden names visible.
Definition: ASTReader.cpp:4028
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1490
clang::ChainedASTReaderListener::ReadCounter
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
Definition: ASTReader.cpp:216
Offset
unsigned Offset
Definition: Format.cpp:2335
clang::FileSystemOptions
Keeps track of options that affect how file operations are performed.
Definition: FileSystemOptions.h:22
clang::ASTReader::ReadDelegatingConstructors
void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls) override
Read the set of delegating constructors known to the external Sema source.
Definition: ASTReader.cpp:8301
clang::ASTReader::ARR_VersionMismatch
@ ARR_VersionMismatch
The client can handle an AST file that cannot load because it was built with a different version of C...
Definition: ASTReader.h:1547
clang::CodeGen::AlignmentSource::Decl
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
clang::ASTReader::ReadWeakUndeclaredIdentifiers
void ReadWeakUndeclaredIdentifiers(SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo >> &WI) override
Definition: ASTReader.cpp:8362
clang::SourceLocation::IntTy
int32_t IntTy
Definition: SourceLocation.h:96
clang::ASTReader::StartTranslationUnit
void StartTranslationUnit(ASTConsumer *Consumer) override
Function that will be invoked when we begin parsing a new translation unit involving this external AS...
Definition: ASTReader.cpp:7691
clang::ASTReader::getLoadedLookupTables
const serialization::reader::DeclContextLookupTable * getLoadedLookupTables(DeclContext *Primary) const
Get the loaded lookup tables for Primary, if any.
Definition: ASTReader.cpp:7665
clang::ContinuousRangeMap::find
iterator find(Int K)
Definition: ContinuousRangeMap.h:93
clang::ChainedASTReaderListener::ReadPreprocessorOptions
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
Definition: ASTReader.cpp:208
clang::ASTReader::ReadUndefinedButUsed
void ReadUndefinedButUsed(llvm::MapVector< NamedDecl *, SourceLocation > &Undefined) override
Load the set of used but not defined functions or variables with internal linkage,...
Definition: ASTReader.cpp:8255
clang::ASTReader::GetExternalDecl
Decl * GetExternalDecl(uint32_t ID) override
Resolve a declaration ID into a declaration, potentially building a new declaration.
Definition: ASTReader.cpp:7156
clang::ASTReader::addListener
void addListener(std::unique_ptr< ASTReaderListener > L)
Add an AST callback listener.
Definition: ASTReader.h:1613
clang::ChainedASTReaderListener::visitModuleFile
void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind) override
This is called for each AST file loaded.
Definition: ASTReader.cpp:232
clang::ASTReader::ReadKnownNamespaces
void ReadKnownNamespaces(SmallVectorImpl< NamespaceDecl * > &Namespaces) override
Load the set of namespaces that are known to the external source, which will be used during typo corr...
Definition: ASTReader.cpp:8244
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::ASTReader::ModuleFile
serialization::ModuleFile ModuleFile
Definition: ASTReader.h:393
clang::Decl::Kind
Kind
Lists the kind of concrete classes of Decl.
Definition: DeclBase.h:92
clang::ASTReader::Success
@ Success
The control block was read successfully.
Definition: ASTReader.h:370
clang::ASTReaderListener::ReadModuleMapFile
virtual void ReadModuleMapFile(StringRef ModuleMapPath)
Definition: ASTReader.h:127
clang::Module
Describes a module or submodule.
Definition: Module.h:96
clang::ASTReaderListener::ReadFullVersionInformation
virtual bool ReadFullVersionInformation(StringRef FullVersion)
Receives the full Clang version information.
Definition: ASTReader.h:122
clang::PCHValidator
ASTReaderListener implementation to validate the information of the PCH file against an initialized P...
Definition: ASTReader.h:276
clang::ASTReaderListener::readModuleFileExtension
virtual void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata)
Indicates that a particular module file extension has been read.
Definition: ASTReader.h:226
clang::ASTReader::ReadComments
void ReadComments() override
Loads comments ranges.
Definition: ASTReader.cpp:9046
clang::ASTReader::ImportedSubmodule::ImportLoc
SourceLocation ImportLoc
Definition: ASTReader.h:920
clang::ASTReaderListener::needsSystemInputFileVisitation
virtual bool needsSystemInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
Definition: ASTReader.h:204
clang::ASTReader::GetIdentifier
IdentifierInfo * GetIdentifier(serialization::IdentifierID ID) override
Definition: ASTReader.h:2065
clang::ExternalHeaderFileInfoSource
An external source of header file information, which may supply information about header files alread...
Definition: HeaderSearch.h:144
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:7085
clang::ASTReader::getModuleFileID
unsigned getModuleFileID(ModuleFile *M)
Get an ID for the given module file.
Definition: ASTReader.cpp:8635
clang::ASTReaderListener::visitInputFile
virtual bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden, bool isExplicitModule)
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
Definition: ASTReader.h:212
clang::ASTReader::getModuleManager
ModuleManager & getModuleManager()
Retrieve the module manager.
Definition: ASTReader.h:1692
clang::ASTReader::ReadUsedVTables
void ReadUsedVTables(SmallVectorImpl< ExternalVTableUse > &VTables) override
Read the set of used vtables known to the external Sema source.
Definition: ASTReader.cpp:8382
clang::ASTReader::ReadSkippedRange
SourceRange ReadSkippedRange(unsigned Index) override
Read a preallocated skipped range from the external source.
Definition: ASTReader.cpp:5923
clang::ASTReader::updateOutOfDateIdentifier
void updateOutOfDateIdentifier(IdentifierInfo &II) override
Update an out-of-date identifier.
Definition: ASTReader.cpp:2060
clang::serialization::InputFile
The input file that has been loaded from this AST file, along with bools indicating whether this was ...
Definition: ModuleFile.h:65
clang::ASTReader::getTotalNumSubmodules
unsigned getTotalNumSubmodules() const
Returns the number of submodules known.
Definition: ASTReader.h:1784
clang::ASTReader::ARR_None
@ ARR_None
The client can't handle any AST loading failures.
Definition: ASTReader.h:1535
clang::ASTReader::getKeyDeclaration
Decl * getKeyDeclaration(Decl *D)
Returns the first key declaration for the given declaration.
Definition: ASTReader.h:1255
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:8589
clang::index::SymbolKind::Module
@ Module
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:212
clang::PCHValidator::ReadLanguageOptions
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
Definition: ASTReader.cpp:439
clang::ASTReader::getGlobalSelectorID
serialization::SelectorID getGlobalSelectorID(ModuleFile &F, unsigned LocalID) const
Retrieve the global selector ID that corresponds to this the local selector ID in a given module.
Definition: ASTReader.cpp:8716
Version.h
clang::serialization::ModuleManager::ModuleIterator
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::iterator > ModuleIterator
Definition: ModuleManager.h:135
Diagnostic.h
clang::ASTReaderListener::ReadDiagnosticOptions
virtual bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain)
Receives the diagnostic options.
Definition: ASTReader.h:152
clang::ASTIdentifierIterator
An identifier-lookup iterator that enumerates all of the identifiers stored within a set of AST files...
Definition: ASTReader.cpp:8018
clang::ASTReader::hasExternalDefinitions
ExtKind hasExternalDefinitions(const Decl *D) override
Definition: ASTReader.cpp:8670
clang::ASTConsumer
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Definition: ASTConsumer.h:33
clang::Sema::AlignPackInfo
Definition: Sema.h:489
clang::ExternalSemaSource
An abstract interface that should be implemented by external AST sources that also provide informatio...
Definition: ExternalSemaSource.h:52
clang::ASTReader::ImportedSubmodule::ID
serialization::SubmoduleID ID
Definition: ASTReader.h:919
clang::Decl::getCanonicalDecl
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:901
clang::DisableValidationForModuleKind
DisableValidationForModuleKind
Whether to disable the normal validation performed on precompiled headers and module files when they ...
Definition: PreprocessorOptions.h:46
clang::ChainedASTReaderListener::visitInputFile
bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden, bool isExplicitModule) override
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
Definition: ASTReader.cpp:238
clang::ASTReader::ARR_OutOfDate
@ ARR_OutOfDate
The client can handle an AST file that cannot load because it is out-of-date relative to its input fi...
Definition: ASTReader.h:1543
clang::serialization::ModuleFile::SLocRemap
ContinuousRangeMap< SourceLocation::UIntTy, SourceLocation::IntTy, 2 > SLocRemap
Remapping table for source locations in this module.
Definition: ModuleFile.h:282
clang::ASTReader::getModuleImportLoc
std::pair< SourceLocation, StringRef > getModuleImportLoc(int ID) override
Retrieve the module import location and module name for the given source manager entry ID.
Definition: ASTReader.cpp:1606
clang::api_notes::BlockID
BlockID
The various types of blocks that can occur within a API notes file.
Definition: APINotesFormat.h:38
IdentifierTable.h
clang::ContinuousRangeMap::end
iterator end()
Definition: ContinuousRangeMap.h:89
clang::ASTReader::getSubmodule
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
Definition: ASTReader.cpp:8604
Type.h
clang::ChainedASTReaderListener::ReadDiagnosticOptions
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain) override
Receives the diagnostic options.
Definition: ASTReader.cpp:186
clang::ASTReader::updateOutOfDateSelector
void updateOutOfDateSelector(Selector Sel) override
Load the contents of the global method pool for a given selector if necessary.
Definition: ASTReader.cpp:8239
clang::ASTReader::ARR_Missing
@ ARR_Missing
The client can handle an AST file that cannot load because it is missing.
Definition: ASTReader.h:1539
clang::IdentifierIterator
An iterator that walks over all of the known identifiers in the lookup table.
Definition: IdentifierTable.h:511
clang::ASTReaderListener::ReadModuleName
virtual void ReadModuleName(StringRef ModuleName)
Definition: ASTReader.h:126
clang::getClangFullRepositoryVersion
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
Definition: Version.cpp:60
clang::serialization::IdentifierID
uint32_t IdentifierID
An ID number that refers to an identifier in an AST file.
Definition: ASTBitCodes.h:60
clang::serialization::TypeID
uint32_t TypeID
An ID number that refers to a type in an AST file.
Definition: ASTBitCodes.h:85
clang::ASTReader::getDiags
DiagnosticsEngine & getDiags() const
Definition: ASTReader.h:1526
clang::ASTReader::ReadSourceLocation
SourceLocation ReadSourceLocation(ModuleFile &ModuleFile, const RecordDataImpl &Record, unsigned &Idx)
Read a source location.
Definition: ASTReader.h:2175
clang::PCHValidator::ReadHeaderSearchOptions
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
Definition: ASTReader.cpp:800
clang::ASTReader::loadGlobalIndex
bool loadGlobalIndex()
Attempts to load the global index.
Definition: ASTReader.cpp:4106
clang::ASTReader::getModuleFileLevelDecls
llvm::iterator_range< ModuleDeclIterator > getModuleFileLevelDecls(ModuleFile &Mod)
Definition: ASTReader.cpp:5916
llvm::DenseSet< LoadedMacroInfo >
clang::ASTReader::dump
void dump()
Dump information about the AST reader to standard error.
Definition: ASTReader.cpp:7813
clang::ASTReader::readASTFileControlBlock
static bool readASTFileControlBlock(StringRef Filename, FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, bool FindModuleFileExtensions, ASTReaderListener &Listener, bool ValidateDiagnosticOptions)
Read the control block for the named AST file.
Definition: ASTReader.cpp:5149
clang::CXXTemporary
Represents a C++ temporary.
Definition: ExprCXX.h:1380
clang::ASTReader::ARR_TreatModuleWithErrorsAsOutOfDate
@ ARR_TreatModuleWithErrorsAsOutOfDate
If a module file is marked with errors treat it as out-of-date so the caller can rebuild it.
Definition: ASTReader.h:1556
clang::SwitchCase
Definition: Stmt.h:1522
clang::ASTReader::ReadUnusedFileScopedDecls
void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls) override
Read the set of unused file-scope declarations known to the external Sema source.
Definition: ASTReader.cpp:8290
clang::ASTReader::getTotalNumPreprocessedEntities
unsigned getTotalNumPreprocessedEntities() const
Returns the number of preprocessed entities known to the AST reader.
Definition: ASTReader.h:1795
clang::ASTWriter
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:99
clang::ASTReader::isGlobalIndexUnavailable
bool isGlobalIndexUnavailable() const
Determine whether we tried to load the global index, but failed, e.g., because it is out-of-date or d...
Definition: ASTReader.cpp:4131
clang::ASTReader::visitTopLevelModuleMaps
void visitTopLevelModuleMaps(serialization::ModuleFile &MF, llvm::function_ref< void(const FileEntry *)> Visitor)
Visit all the top-level module maps loaded when building the given module file.
Definition: ASTReader.cpp:9133
clang::ASTReader::ListenerScope
RAII object to temporarily add an AST callback listener.
Definition: ASTReader.h:1621
clang::ASTReader::Diag
DiagnosticBuilder Diag(unsigned DiagID) const
Report a diagnostic.
Definition: ASTReader.cpp:9014
clang::IdentifierResolver
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
Definition: IdentifierResolver.h:38
clang::ASTReader::ReadLateParsedTemplates
void ReadLateParsedTemplates(llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate >> &LPTMap) override
Read the set of late parsed template functions for this source.
Definition: ASTReader.cpp:8406
clang::ASTReader::ImportedSubmodule
Definition: ASTReader.h:918
Sema.h
clang::FileEntry
Cached information about one file (either on disk or in the virtual file system).
Definition: FileEntry.h:331
clang::PCHValidator::ReadPreprocessorOptions
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
Definition: ASTReader.cpp:752
clang::ASTReader::GetExternalSelector
Selector GetExternalSelector(serialization::SelectorID ID) override
Resolve a selector ID into a selector.
Definition: ASTReader.cpp:8706
clang::ASTReader::getSourceManager
SourceManager & getSourceManager() const
Definition: ASTReader.h:1524
clang::PCHValidator::ReadTargetOptions
bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
Definition: ASTReader.cpp:448
clang::ASTReader::ReadString
static std::string ReadString(const RecordData &Record, unsigned &Idx)
Definition: ASTReader.cpp:8973
clang::ASTReader::addPendingMacro
void addPendingMacro(IdentifierInfo *II, ModuleFile *M, uint32_t MacroDirectivesOffset)
Add a macro to deserialize its macro directive history.
Definition: ASTReader.cpp:1936
clang::ASTReader::LoadSelector
void LoadSelector(Selector Sel)
Load a selector from disk, registering its ID if it exists.
Definition: ASTReader.cpp:8435
clang::ASTReader::setListener
void setListener(std::unique_ptr< ASTReaderListener > Listener)
Set the AST callbacks listener.
Definition: ASTReader.h:1606
clang::ASTReader::ModuleDeclIterator::operator*
value_type operator*() const
Definition: ASTReader.h:1427
clang::ASTReader::ReadSubExpr
Expr * ReadSubExpr()
Reads a sub-expression operand during statement reading.
Definition: ASTReaderStmt.cpp:2657
clang::ASTReader::ReadToken
Token ReadToken(ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx)
Reads a token out of a record.
Definition: ASTReader.cpp:1670
clang::serialization::PreprocessedEntityID
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
Definition: ASTBitCodes.h:168
clang::ASTReader::RecordDataImpl
SmallVectorImpl< uint64_t > RecordDataImpl
Definition: ASTReader.h:363
clang::ASTReader::getLocalType
QualType getLocalType(ModuleFile &F, unsigned LocalID)
Resolve a local type ID within a given AST file into a type.
Definition: ASTReader.cpp:7080
clang::ASTReader::markIdentifierUpToDate
void markIdentifierUpToDate(IdentifierInfo *II)
Note that this identifier is up-to-date.
Definition: ASTReader.cpp:2085
clang::ExternalASTSource::getMemoryBufferSizes
MemoryBufferSizes getMemoryBufferSizes() const
Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memor...
Definition: ExternalASTSource.h:288
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
ASTBitCodes.h
clang::serialization::ModuleFile::ModuleOffsetMap
StringRef ModuleOffsetMap
The module offset map data for this file.
Definition: ModuleFile.h:229
clang::ASTReader::ModuleKind
serialization::ModuleKind ModuleKind
Definition: ASTReader.h:394
SourceLocation.h
clang::ASTReader::GetType
QualType GetType(serialization::TypeID ID)
Resolve a type ID into a type, potentially building a new type.
Definition: ASTReader.cpp:6800
clang::ASTReader::ResolveImportedPath
void ResolveImportedPath(ModuleFile &M, std::string &Filename)
If we are loading a relocatable PCH or module file, and the filename is not an absolute path,...
Definition: ASTReader.cpp:2471
clang::ASTReader::ReadSourceRange
SourceRange ReadSourceRange(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a source range.
Definition: ASTReader.cpp:8960
clang::ASTReader::ReadSourceLocation
SourceLocation ReadSourceLocation(ModuleFile &ModuleFile, SourceLocation::UIntTy Raw) const
Read a source location from raw form.
Definition: ASTReader.h:2154
clang::ChainedASTReaderListener::ReadModuleMapFile
void ReadModuleMapFile(StringRef ModuleMapPath) override
Definition: ASTReader.cpp:162
clang::ASTReader::ModuleDeclIterator::ModuleDeclIterator
ModuleDeclIterator(ASTReader *Reader, ModuleFile *Mod, const serialization::LocalDeclID *Pos)
Definition: ASTReader.h:1423
clang::ASTReader::LoadFailureCapabilities
LoadFailureCapabilities
Flags that indicate what kind of AST loading failures the client of the AST reader can directly handl...
Definition: ASTReader.h:1533
clang::ASTReader::getSourceLocationForDeclID
SourceLocation getSourceLocationForDeclID(serialization::GlobalDeclID ID)
Returns the source location for the decl ID.
Definition: ASTReader.cpp:7323
clang::ASTReader::getGlobalMacroID
serialization::MacroID getGlobalMacroID(ModuleFile &M, unsigned LocalID)
Retrieve the global macro ID corresponding to the given local ID within the given module file.
Definition: ASTReader.cpp:8574
clang::ASTReader::getTotalNumSelectors
unsigned getTotalNumSelectors() const
Returns the number of selectors found in the chain.
Definition: ASTReader.h:1789
clang::Decl::isFromASTFile
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:716
clang::ASTReader::ListenerScope::~ListenerScope
~ListenerScope()
Definition: ASTReader.h:1637
ExternalSemaSource.h
clang::ASTDeserializationListener
Definition: ASTDeserializationListener.h:30
clang::ASTReader::getLocalModuleFile
ModuleFile * getLocalModuleFile(ModuleFile &M, unsigned ID)
Retrieve the module file with a given local ID within the specified ModuleFile.
Definition: ASTReader.cpp:8622
clang::ASTReader::getGlobalIndex
GlobalModuleIndex * getGlobalIndex()
Return global module index.
Definition: ASTReader.h:1658
clang::ASTReader::SkipString
static void SkipString(const RecordData &Record, unsigned &Idx)
Definition: ASTReader.h:2189
clang::ValueDecl
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:676
clang::ASTReader::InitializeSema
void InitializeSema(Sema &S) override
Initialize the semantic source with the Sema instance being used to perform semantic analysis on the ...
Definition: ASTReader.cpp:7849
clang::ASTReader::getTotalNumTypes
unsigned getTotalNumTypes() const
Returns the number of types found in the chain.
Definition: ASTReader.h:1774
clang::ASTReaderListener::visitImport
virtual void visitImport(StringRef ModuleName, StringRef Filename)
If needsImportVisitation returns true, this is called for each AST file imported by this AST file.
Definition: ASTReader.h:223
clang::ASTReader::ModuleIterator
ModuleManager::ModuleIterator ModuleIterator
Definition: ASTReader.h:396
clang::ASTReader::OutOfDate
@ OutOfDate
The AST file is out-of-date relative to its input files, and needs to be regenerated.
Definition: ASTReader.h:380
PreprocessingRecord.h
clang::ChainedASTReaderListener::ChainedASTReaderListener
ChainedASTReaderListener(std::unique_ptr< ASTReaderListener > First, std::unique_ptr< ASTReaderListener > Second)
Takes ownership of First and Second.
Definition: ASTReader.h:237
Value
Value
Definition: UninitializedValues.cpp:102
clang::ExternalASTSource::ExtKind
ExtKind
Definition: ExternalASTSource.h:165
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
clang::ChainedASTReaderListener::takeFirst
std::unique_ptr< ASTReaderListener > takeFirst()
Definition: ASTReader.h:241
clang::ASTReader::~ASTReader
~ASTReader() override
Definition: ASTReader.cpp:11657
clang::ASTReader::RecordSwitchCaseID
void RecordSwitchCaseID(SwitchCase *SC, unsigned ID)
Record that the given ID maps to the given switch-case statement.
Definition: ASTReader.cpp:9030
clang::ASTReader::getSuggestedPredefines
const std::string & getSuggestedPredefines()
Returns the suggested contents of the predefines buffer, which contains a (typically-empty) subset of...
Definition: ASTReader.h:1732
clang::ChainedASTReaderListener::needsInputFileVisitation
bool needsInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
Definition: ASTReader.cpp:222
clang::ASTReader::getGlobalIdentifierID
serialization::IdentifierID getGlobalIdentifierID(ModuleFile &M, unsigned LocalID)
Definition: ASTReader.cpp:8532
HeaderSearch.h
clang::ASTReader::FindExternalLexicalDecls
void FindExternalLexicalDecls(const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl * > &Decls) override
Read all of the declarations lexically stored in a declaration context.
Definition: ASTReader.cpp:7496
clang::ASTReader::takeListener
std::unique_ptr< ASTReaderListener > takeListener()
Take the AST callbacks listener.
Definition: ASTReader.h:1601
clang::ASTReader::ConfigurationMismatch
@ ConfigurationMismatch
The AST file was writtten with a different language/target configuration.
Definition: ASTReader.h:387
clang::ASTReader::getLocalIdentifier
IdentifierInfo * getLocalIdentifier(ModuleFile &M, unsigned LocalID)
Definition: ASTReader.cpp:8528
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:355
clang::ASTReaderListener::visitModuleFile
virtual void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind)
This is called for each AST file loaded.
Definition: ASTReader.h:195
clang::ASTReader::ReadUnusedLocalTypedefNameCandidates
void ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls) override
Read the set of potentially unused typedefs known to the source.
Definition: ASTReader.cpp:8322
clang::ASTReader::ReadBlockAbbrevs
static llvm::Error ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor, unsigned BlockID, uint64_t *StartOfBlockOffset=nullptr)
ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the specified cursor.
Definition: ASTReader.cpp:1643
clang::ASTReader::getOwningModuleNameForDiagnostic
std::string getOwningModuleNameForDiagnostic(const Decl *D)
Get the best name we know for the module that owns the given declaration, or an empty string if the d...
Definition: ASTReader.cpp:9146
clang::ASTReader::ReadTentativeDefinitions
void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs) override
Read the set of tentative definitions known to the external Sema source.
Definition: ASTReader.cpp:8280
clang::ASTReader::GetNumExternalSelectors
uint32_t GetNumExternalSelectors() override
Returns the number of selectors known to the external AST source.
Definition: ASTReader.cpp:8710
clang::ASTReader::ReadReferencedSelectors
void ReadReferencedSelectors(SmallVectorImpl< std::pair< Selector, SourceLocation >> &Sels) override
Definition: ASTReader.cpp:8344
clang::ASTReader::ReadMethodPool
void ReadMethodPool(Selector Sel) override
Load the contents of the global method pool for a given selector.
Definition: ASTReader.cpp:8201
clang::serialization::ModuleManager::getPrimaryModule
ModuleFile & getPrimaryModule()
Returns the primary module associated with the manager, that is, the first module loaded.
Definition: ModuleManager.h:173
clang::ASTReader::mapGlobalIDToModuleFileGlobalID
serialization::DeclID mapGlobalIDToModuleFileGlobalID(ModuleFile &M, serialization::DeclID GlobalID)
Map a global declaration ID into the declaration ID used to refer to this declaration within the give...
Definition: ASTReader.cpp:7447
clang::ASTReader::ReadMacroRecord
MacroInfo * ReadMacroRecord(ModuleFile &F, uint64_t Offset)
Reads the macro record located at the given offset.
Definition: ASTReader.cpp:1683
clang::serialization::ModuleManager::ModuleConstIterator
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::const_iterator > ModuleConstIterator
Definition: ModuleManager.h:137
clang::HeaderFileInfo
The preprocessor keeps track of this information for each file that is #included.
Definition: HeaderSearch.h:53
ModuleManager.h
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:84
clang::ASTReader::resolvePendingMacro
void resolvePendingMacro(IdentifierInfo *II, const PendingMacroInfo &PMInfo)
Definition: ASTReader.cpp:2096
clang::serialization::LocalDeclID
DeclID LocalDeclID
Definition: ASTBitCodes.h:72
clang::ASTReader::mergeDefinitionVisibility
void mergeDefinitionVisibility(NamedDecl *Def, NamedDecl *MergedDef)
Note that MergedDef is a redefinition of the canonical definition Def, so Def should be visible whene...
Definition: ASTReader.cpp:4091
ModuleFileExtension.h
clang::ASTReader::getIdentifierTable
IdentifierTable & getIdentifierTable()
Retrieve the identifier table associated with the preprocessor.
Definition: ASTReader.cpp:9024
clang::ASTReaderListener::ReadHeaderSearchOptions
virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain)
Receives the header search options.
Definition: ASTReader.h:170
clang::SourceLocation::getFromRawEncoding
static SourceLocation getFromRawEncoding(UIntTy Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
Definition: SourceLocation.h:154
clang::ASTReader::SkipPath
static void SkipPath(const RecordData &Record, unsigned &Idx)
Definition: ASTReader.h:2201
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
clang::ASTReader::ReadAlignPackInfo
Sema::AlignPackInfo ReadAlignPackInfo(uint32_t Raw) const
Read a AlignPackInfo from raw form.
Definition: ASTReader.h:2141
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::ASTReader::PrintStats
void PrintStats() override
Print some statistics about AST usage.
Definition: ASTReader.cpp:7701
clang::ASTReader
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:342
std
Definition: Format.h:4034
clang::ASTReader::CommentsCursors
SmallVector< std::pair< llvm::BitstreamCursor, serialization::ModuleFile * >, 8 > CommentsCursors
Cursors for comments blocks.
Definition: ASTReader.h:2297
clang::ChainedASTReaderListener::ReadModuleName
void ReadModuleName(StringRef ModuleName) override
Definition: ASTReader.cpp:157
clang::SimpleASTReaderListener::SimpleASTReaderListener
SimpleASTReaderListener(Preprocessor &PP)
Definition: ASTReader.h:309
clang::ASTReader::SetIdentifierInfo
void SetIdentifierInfo(unsigned ID, IdentifierInfo *II)
Definition: ASTReader.cpp:8440
ModuleFile.h
clang::ASTReader::isPreprocessedEntityInFileID
Optional< bool > isPreprocessedEntityInFileID(unsigned Index, FileID FID) override
Optionally returns true or false if the preallocated preprocessed entity with index Index came from f...
Definition: ASTReader.cpp:6157
clang::Builtin::ID
ID
Definition: Builtins.h:48
clang::serialization::reader::DeclContextLookupTable
Definition: ASTReaderInternals.h:119
clang::ASTReader::ListenerScope::ListenerScope
ListenerScope(ASTReader &Reader, std::unique_ptr< ASTReaderListener > L)
Definition: ASTReader.h:1626
clang
Definition: CalledOnceCheck.h:17
clang::ASTReader::getTotalNumSLocs
unsigned getTotalNumSLocs() const
Returns the number of source locations found in the chain.
Definition: ASTReader.h:1759
clang::FileManager
Implements support for file system lookup, file system caching, and directory search management.
Definition: FileManager.h:53
clang::ASTReader::addInMemoryBuffer
void addInMemoryBuffer(StringRef &FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Add in-memory (virtual file) buffer.
Definition: ASTReader.h:1679
clang::Selector
Smart pointer class that efficiently represents Objective-C method names.
Definition: IdentifierTable.h:748
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:69
clang::ASTReader::ModuleDeclIterator::operator->
value_type operator->() const
Definition: ASTReader.h:1431
clang::ASTReader::StartedDeserializing
void StartedDeserializing() override
Notify ASTReader that we started deserialization of a decl or type so until FinishedDeserializing is ...
Definition: ASTReader.cpp:11535
clang::ContinuousRangeMap
A map from continuous integer ranges to some value, with a very specialized interface.
Definition: ContinuousRangeMap.h:37
clang::ContinuousRangeMap< unsigned, ModuleFile *, 64 >::const_iterator
typename Representation::const_iterator const_iterator
Definition: ContinuousRangeMap.h:86
clang::ASTReaderListener
Abstract interface for callback invocations by the ASTReader.
Definition: ASTReader.h:114
clang::ModuleFileExtensionMetadata
Metadata for a module file extension.
Definition: ModuleFileExtension.h:36
clang::FileID
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Definition: SourceLocation.h:40
clang::ASTReader::VersionMismatch
@ VersionMismatch
The AST file was written by a different version of Clang.
Definition: ASTReader.h:383
clang::ASTReader::ReadStmt
Stmt * ReadStmt(ModuleFile &F)
Reads a statement.
Definition: ASTReaderStmt.cpp:2639
clang::CXXBaseSpecifier
Represents a base class of a C++ class.
Definition: DeclCXX.h:147
clang::IdentifierTable
Implements an efficient mapping from strings to IdentifierInfo nodes.
Definition: IdentifierTable.h:559
clang::ASTReaderListener::needsImportVisitation
virtual bool needsImportVisitation() const
Returns true if this ASTReaderListener wants to receive the imports of the AST file via visitImport,...
Definition: ASTReader.h:219
clang::ASTReader::setDeserializationListener
void setDeserializationListener(ASTDeserializationListener *Listener, bool TakeOwnership=false)
Set the AST deserialization listener.
Definition: ASTReader.cpp:842
clang::SrcMgr::isSystem
bool isSystem(CharacteristicKind CK)
Determine whether a file / directory characteristic is for system code.
Definition: SourceManager.h:87
clang::IdentifierInfoLookup
Provides lookups to, and iteration over, IdentiferInfo objects.
Definition: IdentifierTable.h:530
clang::ChainedASTReaderListener::ReadHeaderSearchOptions
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
Definition: ASTReader.cpp:199
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::ASTReader::ReadCXXTemporary
CXXTemporary * ReadCXXTemporary(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Definition: ASTReader.cpp:9007
clang::ASTReader::getLocalSelector
Selector getLocalSelector(ModuleFile &M, unsigned LocalID)
Retrieve a selector from the given module with its local ID number.
Definition: ASTReader.cpp:8677
clang::ASTReader::ReadExpr
Expr * ReadExpr(ModuleFile &F)
Reads an expression.
Definition: ASTReaderStmt.cpp:2653
clang::ASTReader::PreloadedDeclIDs
SmallVector< uint64_t, 16 > PreloadedDeclIDs
Definition: ASTReader.h:2270
clang::ChainedASTReaderListener::takeSecond
std::unique_ptr< ASTReaderListener > takeSecond()
Definition: ASTReader.h:242
clang::ASTReader::ReadPragmaDiagnosticMappings
void ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag)
Definition: ASTReader.cpp:6216
clang::ASTReader::ReadDeclsToCheckForDeferredDiags
void ReadDeclsToCheckForDeferredDiags(llvm::SmallSetVector< Decl *, 4 > &Decls) override
Read the set of decls to be checked for deferred diags.
Definition: ASTReader.cpp:8334
DiagnosticOptions.h
clang::ASTReader::ForgetSema
void ForgetSema() override
Inform the semantic consumer that Sema is no longer available.
Definition: ASTReader.h:1977
clang::ASTReader::ModuleConstIterator
ModuleManager::ModuleConstIterator ModuleConstIterator
Definition: ASTReader.h:397
clang::serialization::ModuleFile::OriginalSourceFileName
std::string OriginalSourceFileName
The original source file name that was used to build the primary AST file, which may have been modifi...
Definition: ModuleFile.h:141
clang::ExternalASTSource::Deserializing
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
Definition: ExternalASTSource.h:76
clang::serialization::ModuleKind
ModuleKind
Specifies the kind of module that has been loaded.
Definition: ModuleFile.h:42
clang::ASTReader::hasGlobalIndex
bool hasGlobalIndex() const
Determine whether this AST reader has a global index.
Definition: ASTReader.h:1655
clang::ASTReader::getOwningModuleFile
ModuleFile * getOwningModuleFile(const Decl *D)
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
Definition: ASTReader.cpp:7315
clang::ASTReader::forEachImportedKeyDecl
void forEachImportedKeyDecl(const Decl *D, Fn Visit)
Run a callback on each imported key declaration of D.
Definition: ASTReader.h:1271
clang::TargetOptions
Options for controlling the target.
Definition: TargetOptions.h:26
clang::ASTReader::DecodeSelector
Selector DecodeSelector(serialization::SelectorID Idx)
Definition: ASTReader.cpp:8681
llvm::SmallVectorImpl
Definition: LLVM.h:39
clang::ASTReader::GetExternalCXXCtorInitializers
CXXCtorInitializer ** GetExternalCXXCtorInitializers(uint64_t Offset) override
Read the contents of a CXXCtorInitializer array.
Definition: ASTReader.cpp:7218
llvm::SmallSetVector< serialization::DeclID, 4 >
PreprocessorOptions.h
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::Preprocessor
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:130
clang::ASTReader::isProcessingUpdateRecords
bool isProcessingUpdateRecords()
Definition: ASTReader.h:2314
clang::ASTDeclReader
Definition: ASTReaderDecl.cpp:80
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
clang::ASTReader::getSwitchCaseWithID
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
Definition: ASTReader.cpp:9037
clang::ASTReader::getIdResolver
IdentifierResolver & getIdResolver()
Get the identifier resolver used for name lookup / updates in the translation unit scope.
Definition: ASTReader.cpp:11662
clang::serialization::GlobalDeclID
DeclID GlobalDeclID
Definition: ASTBitCodes.h:73
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:7464
clang::ASTReader::isAcceptableASTFile
static bool isAcceptableASTFile(StringRef Filename, FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, StringRef ExistingModuleCachePath)
Determine whether the given AST file is acceptable to load into a translation unit with the given lan...
Definition: ASTReader.cpp:5415
clang::ExternalSLocEntrySource
External source of source location entries.
Definition: SourceManager.h:517
clang::SimpleASTReaderListener
ASTReaderListenter implementation to set SuggestedPredefines of ASTReader which is required to use a ...
Definition: ASTReader.h:305
clang::ASTReader::findPreprocessedEntitiesInRange
std::pair< unsigned, unsigned > findPreprocessedEntitiesInRange(SourceRange Range) override
Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses.
Definition: ASTReader.cpp:6144
clang::serialization::SelectorID
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
Definition: ASTBitCodes.h:153
clang::ChainedASTReaderListener::ReadFullVersionInformation
bool ReadFullVersionInformation(StringRef FullVersion) override
Receives the full Clang version information.
Definition: ASTReader.cpp:152
clang::ASTReader::FindFileRegionDecls
void FindFileRegionDecls(FileID File, unsigned Offset, unsigned Length, SmallVectorImpl< Decl * > &Decls) override
Get the decls that are contained in a file in the Offset/Length range.
Definition: ASTReader.cpp:7572
clang::ASTReaderListener::ReadCounter
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value)
Receives COUNTER value.
Definition: ASTReader.h:191
clang::ASTReader::finalizeForWriting
void finalizeForWriting()
Finalizes the AST reader's state before writing an AST file to disk.
Definition: ASTReader.cpp:4991
clang::ASTReader::GetHeaderFileInfo
HeaderFileInfo GetHeaderFileInfo(const FileEntry *FE) override
Read the header file information for the given file entry.
Definition: ASTReader.cpp:6207
clang::ASTReader::isDeclIDFromModule
bool isDeclIDFromModule(serialization::GlobalDeclID ID, ModuleFile &M) const
Returns true if global DeclID ID originated from module M.
Definition: ASTReader.cpp:7305
clang::ASTReader::getDeserializationListener
ASTDeserializationListener * getDeserializationListener()
Get the AST deserialization listener.
Definition: ASTReader.h:1650
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::PreprocessedEntity
Base class that describes a preprocessed entity, which may be a preprocessor directive or macro expan...
Definition: PreprocessingRecord.h:60
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1856
clang::ASTReader::getGlobalPreprocessedEntityID
serialization::PreprocessedEntityID getGlobalPreprocessedEntityID(ModuleFile &M, unsigned LocalID) const
Determine the global preprocessed entity ID that corresponds to the given local ID within the given m...
Definition: ASTReader.cpp:1808
clang::ASTReader::ImportedSubmodule::ImportedSubmodule
ImportedSubmodule(serialization::SubmoduleID ID, SourceLocation ImportLoc)
Definition: ASTReader.h:922
clang::ChainedASTReaderListener
Simple wrapper class for chaining listeners.
Definition: ASTReader.h:231
clang::serialization::ModuleFile
Information about a module that has been loaded by the ASTReader.
Definition: ModuleFile.h:111
clang::ASTReader::GetExternalCXXBaseSpecifiers
CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override
Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers.
Definition: ASTReader.cpp:7249
clang::ASTReader::ASTReadResult
ASTReadResult
The result of reading the control block of an AST file, which can fail for various reasons.
Definition: ASTReader.h:367
clang::ASTReader::SetGloballyVisibleDecls
void SetGloballyVisibleDecls(IdentifierInfo *II, const SmallVectorImpl< uint32_t > &DeclIDs, SmallVectorImpl< Decl * > *Decls=nullptr)
Set the globally-visible declarations associated with the given identifier.
Definition: ASTReader.cpp:8465
clang::ASTReader::InitializeContext
void InitializeContext()
Initializes the ASTContext.
Definition: ASTReader.cpp:4852
clang::ASTReader::ReadPath
std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Definition: ASTReader.cpp:8980
llvm::IntrusiveRefCntPtr
Definition: LLVM.h:47
clang::ChainedASTReaderListener::needsSystemInputFileVisitation
bool needsSystemInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
Definition: ASTReader.cpp:227
clang::SourceLocation::UIntTy
uint32_t UIntTy
Definition: SourceLocation.h:95
clang::ASTReader::completeVisibleDeclsMap
void completeVisibleDeclsMap(const DeclContext *DC) override
Load all external visible decls in the given DeclContext.
Definition: ASTReader.cpp:7641
clang::ASTReaderListener::ReadFileSystemOptions
virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain)
Receives the file system options.
Definition: ASTReader.h:161
ExternalPreprocessorSource.h
clang::HeaderSearchOptions
HeaderSearchOptions - Helper class for storing options related to the initialization of the HeaderSea...
Definition: HeaderSearchOptions.h:68
clang::PCHValidator::ReadDiagnosticOptions
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain) override
Receives the diagnostic options.
Definition: ASTReader.cpp:565
clang::ASTReader::ModuleDeclIterator::ModuleDeclIterator
ModuleDeclIterator()
Definition: ASTReader.h:1421
clang::ASTReader::Missing
@ Missing
The AST file was missing.
Definition: ASTReader.h:376