remove the public SourceManager::getContentCacheForLoc method.

llvm-svn: 62497
This commit is contained in:
Chris Lattner 2009-01-19 07:40:40 +00:00
parent f809bbdbb8
commit 1e9e86f470
2 changed files with 4 additions and 9 deletions

View File

@ -403,14 +403,6 @@ public:
return PLoc.getFileLocWithOffset(Loc.getMacroSpellingOffs());
}
/// getContentCacheForLoc - Return the ContentCache for the spelling loc of
/// the specified SourceLocation, if one exists.
const SrcMgr::ContentCache* getContentCacheForLoc(SourceLocation Loc) const {
Loc = getSpellingLoc(Loc);
unsigned ChunkID = Loc.getChunkID();
assert(ChunkID-1 < FileIDs.size() && "Invalid FileID!");
return FileIDs[ChunkID-1].getContentCache();
}
/// getFileEntryForID - Returns the FileEntry record for the provided FileID.
const FileEntry *getFileEntryForID(FileID FID) const {

View File

@ -228,9 +228,12 @@ unsigned SourceManager::getColumnNumber(SourceLocation Loc) const {
const char *SourceManager::getSourceName(SourceLocation Loc) const {
if (Loc.getChunkID() == 0) return "";
Loc = getSpellingLoc(Loc);
unsigned ChunkID = Loc.getChunkID();
const SrcMgr::ContentCache *C = getFIDInfo(ChunkID)->getContentCache();
// To get the source name, first consult the FileEntry (if one exists) before
// the MemBuffer as this will avoid unnecessarily paging in the MemBuffer.
const SrcMgr::ContentCache *C = getContentCacheForLoc(Loc);
return C->Entry ? C->Entry->getName() : C->getBuffer()->getBufferIdentifier();
}