[cfe-commits] r62497 - in /cfe/trunk: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp
Chris Lattner
sabre at nondot.org
Sun Jan 18 23:40:40 PST 2009
Author: lattner
Date: Mon Jan 19 01:40:40 2009
New Revision: 62497
URL: http://llvm.org/viewvc/llvm-project?rev=62497&view=rev
Log:
remove the public SourceManager::getContentCacheForLoc method.
Modified:
cfe/trunk/include/clang/Basic/SourceManager.h
cfe/trunk/lib/Basic/SourceManager.cpp
Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=62497&r1=62496&r2=62497&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Mon Jan 19 01:40:40 2009
@@ -403,14 +403,6 @@
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 {
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=62497&r1=62496&r2=62497&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Mon Jan 19 01:40:40 2009
@@ -228,9 +228,12 @@
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();
}
More information about the cfe-commits
mailing list