Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions clang/include/clang/Serialization/ASTBitCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ struct UnsafeQualTypeDenseMapInfo {
};

/// An ID number that refers to a macro in an AST file.
using MacroID = uint32_t;
using MacroID = uint64_t;

/// A global ID number that refers to a macro in an AST file.
using GlobalMacroID = uint32_t;
using GlobalMacroID = uint64_t;

/// A local to a module ID number that refers to a macro in an
/// AST file.
using LocalMacroID = uint32_t;
using LocalMacroID = uint64_t;

/// The number of predefined macro IDs.
const unsigned int NUM_PREDEF_MACRO_IDS = 1;
Expand All @@ -179,7 +179,7 @@ using CXXCtorInitializersID = uint32_t;

/// An ID number that refers to an entity in the detailed
/// preprocessing record.
using PreprocessedEntityID = uint32_t;
using PreprocessedEntityID = uint64_t;

/// An ID number that refers to a submodule in a module file.
using SubmoduleID = uint32_t;
Expand Down
39 changes: 23 additions & 16 deletions clang/include/clang/Serialization/ASTReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -800,14 +800,6 @@ class ASTReader
/// files.
llvm::DenseSet<LoadedMacroInfo> LoadedUndefs;

using GlobalMacroMapType =
ContinuousRangeMap<serialization::MacroID, ModuleFile *, 4>;

/// Mapping from global macro IDs to the module in which the
/// macro resides along with the offset that should be added to the
/// global macro ID to produce a local ID.
GlobalMacroMapType GlobalMacroMap;

/// A vector containing submodules that have already been loaded.
///
/// This vector is indexed by the Submodule ID (-1). NULL submodule entries
Expand Down Expand Up @@ -1655,18 +1647,16 @@ class ASTReader

/// Returns the first preprocessed entity ID that begins or ends after
/// \arg Loc.
serialization::PreprocessedEntityID
findPreprocessedEntity(SourceLocation Loc, bool EndsAfter) const;
unsigned findPreprocessedEntity(SourceLocation Loc, bool EndsAfter) const;

/// Find the next module that contains entities and return the ID
/// of the first entry.
///
/// \param SLocMapI points at a chunk of a module that contains no
/// preprocessed entities or the entities it contains are not the
/// ones we are looking for.
serialization::PreprocessedEntityID
findNextPreprocessedEntity(
GlobalSLocOffsetMapType::const_iterator SLocMapI) const;
unsigned findNextPreprocessedEntity(
GlobalSLocOffsetMapType::const_iterator SLocMapI) const;

/// Returns (ModuleFile, Local index) pair for \p GlobalIndex of a
/// preprocessed entity.
Expand Down Expand Up @@ -1748,6 +1738,14 @@ class ASTReader
std::pair<ModuleFile *, unsigned>
translateIdentifierIDToIndex(serialization::IdentifierID ID) const;

/// Translate an \param MacroID ID to the index of MacrosLoaded
/// array and the corresponding module file.
std::pair<ModuleFile *, unsigned>
translateMacroIDToIndex(serialization::MacroID ID) const;

unsigned translatePreprocessedEntityIDToIndex(
serialization::PreprocessedEntityID ID) const;

/// Translate an \param TypeID ID to the index of TypesLoaded
/// array and the corresponding module file.
std::pair<ModuleFile *, unsigned>
Expand Down Expand Up @@ -2163,6 +2161,14 @@ class ASTReader
LocalDeclID mapGlobalIDToModuleFileGlobalID(ModuleFile &M,
GlobalDeclID GlobalID);

/// Reads a macro ID from the given position in a record in the
/// given module.
///
/// \returns The declaration ID read from the record, adjusted to a global
/// Macro ID.
serialization::MacroID
ReadMacroID(ModuleFile &F, const RecordDataImpl &Record, unsigned &Idx);

/// Reads a declaration ID from the given position in a record in the
/// given module.
///
Expand Down Expand Up @@ -2388,7 +2394,8 @@ class ASTReader

/// Retrieve the global macro ID corresponding to the given local
/// ID within the given module file.
serialization::MacroID getGlobalMacroID(ModuleFile &M, unsigned LocalID);
serialization::MacroID getGlobalMacroID(ModuleFile &M,
serialization::MacroID LocalID);

/// Read the source location entry with index ID.
bool ReadSLocEntry(int ID) override;
Expand Down Expand Up @@ -2572,8 +2579,8 @@ class ASTReader

/// Determine the global preprocessed entity ID that corresponds to
/// the given local ID within the given module.
serialization::PreprocessedEntityID
getGlobalPreprocessedEntityID(ModuleFile &M, unsigned LocalID) const;
serialization::PreprocessedEntityID getGlobalPreprocessedEntityID(
ModuleFile &M, serialization::PreprocessedEntityID LocalID) const;

/// Add a macro to deserialize its macro directive history.
///
Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/Serialization/ASTWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,10 @@ class ASTWriter : public ASTDeserializationListener,
void AddLookupOffsets(const LookupBlockOffsets &Offsets,
RecordDataImpl &Record);

/// Emit a reference to a macro.
void AddMacroRef(MacroInfo *MI, const IdentifierInfo *Name,
RecordDataImpl &Record);

/// Emit a reference to a declaration.
void AddDeclRef(const Decl *D, RecordDataImpl &Record);
// Emit a reference to a declaration if the declaration was emitted.
Expand Down
6 changes: 0 additions & 6 deletions clang/include/clang/Serialization/ModuleFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,6 @@ class ModuleFile {
/// Base macro ID for macros local to this module.
serialization::MacroID BaseMacroID = 0;

/// Remapping table for macro IDs in this module.
ContinuousRangeMap<uint32_t, int, 2> MacroRemap;

/// The offset of the start of the set of defined macros.
uint64_t MacroStartOffset = 0;

Expand All @@ -372,9 +369,6 @@ class ModuleFile {
/// this module.
serialization::PreprocessedEntityID BasePreprocessedEntityID = 0;

/// Remapping table for preprocessed entity IDs in this module.
ContinuousRangeMap<uint32_t, int, 2> PreprocessedEntityRemap;

const PPEntityOffset *PreprocessedEntityOffsets = nullptr;
unsigned NumPreprocessedEntities = 0;

Expand Down
Loading