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