"Corrupted global preprocessed entity map");
Module &M = *I->second;
unsigned LocalIndex = Index - M.BasePreprocessedEntityID;
+ const PPEntityOffset &PPOffs = M.PreprocessedEntityOffsets[LocalIndex];
SavedStreamPosition SavedPosition(M.PreprocessorDetailCursor);
- M.PreprocessorDetailCursor.JumpToBit(
- M.PreprocessedEntityOffsets[LocalIndex].BitOffset);
+ M.PreprocessorDetailCursor.JumpToBit(PPOffs.BitOffset);
unsigned Code = M.PreprocessorDetailCursor.ReadCode();
switch (Code) {
}
// Read the record.
+ SourceRange Range(ReadSourceLocation(M, PPOffs.Begin),
+ ReadSourceLocation(M, PPOffs.End));
PreprocessingRecord &PPRec = *PP.getPreprocessingRecord();
const char *BlobStart = 0;
unsigned BlobLen = 0;
Code, Record, BlobStart, BlobLen);
switch (RecType) {
case PPD_MACRO_EXPANSION: {
- SourceRange Range(ReadSourceLocation(M, Record[0]),
- ReadSourceLocation(M, Record[1]));
- bool isBuiltin = Record[2];
+ bool isBuiltin = Record[0];
IdentifierInfo *Name = 0;
MacroDefinition *Def = 0;
if (isBuiltin)
- Name = getLocalIdentifier(M, Record[3]);
+ Name = getLocalIdentifier(M, Record[1]);
else {
PreprocessedEntityID
- GlobalID = getGlobalPreprocessedEntityID(M, Record[3]);
+ GlobalID = getGlobalPreprocessedEntityID(M, Record[1]);
Def =cast<MacroDefinition>(PPRec.getLoadedPreprocessedEntity(GlobalID-1));
}
case PPD_MACRO_DEFINITION: {
// Decode the identifier info and then check again; if the macro is
// still defined and associated with the identifier,
- IdentifierInfo *II = getLocalIdentifier(M, Record[2]);
+ IdentifierInfo *II = getLocalIdentifier(M, Record[0]);
MacroDefinition *MD
- = new (PPRec) MacroDefinition(II,
- SourceRange(
- ReadSourceLocation(M, Record[0]),
- ReadSourceLocation(M, Record[1])));
+ = new (PPRec) MacroDefinition(II, Range);
if (DeserializationListener)
DeserializationListener->MacroDefinitionRead(PPID, MD);
}
case PPD_INCLUSION_DIRECTIVE: {
- const char *FullFileNameStart = BlobStart + Record[2];
+ const char *FullFileNameStart = BlobStart + Record[0];
const FileEntry *File
= PP.getFileManager().getFile(StringRef(FullFileNameStart,
- BlobLen - Record[2]));
+ BlobLen - Record[0]));
// FIXME: Stable encoding
InclusionDirective::InclusionKind Kind
- = static_cast<InclusionDirective::InclusionKind>(Record[4]);
+ = static_cast<InclusionDirective::InclusionKind>(Record[2]);
InclusionDirective *ID
= new (PPRec) InclusionDirective(PPRec, Kind,
- StringRef(BlobStart, Record[2]),
- Record[3],
+ StringRef(BlobStart, Record[0]),
+ Record[1],
File,
- SourceRange(ReadSourceLocation(M, Record[0]),
- ReadSourceLocation(M, Record[1])));
+ Range);
return ID;
}
}
{
BitCodeAbbrev *Abbrev = new BitCodeAbbrev();
Abbrev->Add(BitCodeAbbrevOp(PPD_INCLUSION_DIRECTIVE));
- Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // start location
- Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // end location
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // filename length
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // in quotes
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // kind
// Record this macro definition's ID.
MacroDefinitions[MD] = NextPreprocessorEntityID;
- AddSourceLocation(MD->getSourceRange().getBegin(), Record);
- AddSourceLocation(MD->getSourceRange().getEnd(), Record);
AddIdentifierRef(MD->getName(), Record);
Stream.EmitRecord(PPD_MACRO_DEFINITION, Record);
continue;
}
if (MacroExpansion *ME = dyn_cast<MacroExpansion>(*E)) {
- AddSourceLocation(ME->getSourceRange().getBegin(), Record);
- AddSourceLocation(ME->getSourceRange().getEnd(), Record);
Record.push_back(ME->isBuiltinMacro());
if (ME->isBuiltinMacro())
AddIdentifierRef(ME->getName(), Record);
if (InclusionDirective *ID = dyn_cast<InclusionDirective>(*E)) {
Record.push_back(PPD_INCLUSION_DIRECTIVE);
- AddSourceLocation(ID->getSourceRange().getBegin(), Record);
- AddSourceLocation(ID->getSourceRange().getEnd(), Record);
Record.push_back(ID->getFileName().size());
Record.push_back(ID->wasInQuotes());
Record.push_back(static_cast<unsigned>(ID->getKind()));