Eliminate SourceManager::createFileIDForMacroExp, inlining it into its single use.

llvm-svn: 38599
This commit is contained in:
Chris Lattner 2006-06-30 06:15:08 +00:00
parent 7d1b0062d2
commit 4c37a8c353
2 changed files with 8 additions and 22 deletions

View File

@ -110,27 +110,19 @@ unsigned SourceManager::createFileID(const InfoRec *File,
return Result;
}
/// createFileIDForMacroExp - Return a new FileID for a macro expansion at
/// SourcePos, where the macro token character came from PhysicalFileID.
///
unsigned SourceManager::createFileIDForMacroExp(SourceLocation SourcePos,
unsigned PhysicalFileID) {
SourcePos = getLogicalLoc(SourcePos);
FileIDs.push_back(FileIDInfo::getMacroExpansion(SourcePos, PhysicalFileID));
return FileIDs.size();
}
/// getInstantiationLoc - Return a new SourceLocation that encodes the fact
/// that a token from physloc PhysLoc should actually be referenced from
/// InstantiationLoc.
SourceLocation SourceManager::getInstantiationLoc(SourceLocation PhysLoc,
SourceLocation InstantLoc) {
unsigned CharFilePos = PhysLoc.getRawFilePos();
unsigned CharFileID = PhysLoc.getFileID();
unsigned InstantiationFileID =
createFileIDForMacroExp(InstantLoc, CharFileID);
return SourceLocation(InstantiationFileID, CharFilePos);
// Resolve InstantLoc down to a real logical location.
InstantLoc = getLogicalLoc(InstantLoc);
// Add a FileID for this. FIXME: should cache these!
FileIDs.push_back(FileIDInfo::getMacroExpansion(InstantLoc,
PhysLoc.getFileID()));
unsigned InstantiationFileID = FileIDs.size();
return SourceLocation(InstantiationFileID, PhysLoc.getRawFilePos());
}

View File

@ -190,12 +190,6 @@ public:
SourceLocation getInstantiationLoc(SourceLocation PhysLoc,
SourceLocation InstantiationLoc);
/// createFileIDForMacroExp - Return a new FileID for a macro expansion at
/// SourcePos, where the macro token character came from PhysicalFileID.
///
unsigned createFileIDForMacroExp(SourceLocation SourcePos,
unsigned PhysicalFileID);
/// getBuffer - Return the buffer for the specified FileID.
///
const SourceBuffer *getBuffer(unsigned FileID) const {