summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-17 08:45:21 +0000
committerChris Lattner <sabre@nondot.org>2009-01-17 08:45:21 +0000
commit71dc14b9f0ea58d1c113ab7226bc67793347e4a3 (patch)
treebe04630aeca6bdb5544c8800baa930b929109f7b /clang/lib/Basic/SourceManager.cpp
parent5509d533f6843a977e8f11819b747f6cd09f3273 (diff)
downloadbcm5719-llvm-71dc14b9f0ea58d1c113ab7226bc67793347e4a3.tar.gz
bcm5719-llvm-71dc14b9f0ea58d1c113ab7226bc67793347e4a3.zip
Rename SourceLocation::getFileID to getChunkID, because it returns
the chunk ID not the file ID. This exposes problems in TextDiagnosticPrinter where it should have been using the canonical file ID but wasn't. Fix these along the way. llvm-svn: 62427
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index b6c4ffab4db..f793c978ccb 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -121,7 +121,7 @@ FileID SourceManager::createFileID(const ContentCache *File,
unsigned FileSize = File->getSize();
if (FileSize+1 < (1 << SourceLocation::FilePosBits)) {
FileIDs.push_back(FileIDInfo::get(IncludePos, 0, File, FileCharacter));
- assert(FileIDs.size() < (1 << SourceLocation::FileIDBits) &&
+ assert(FileIDs.size() < (1 << SourceLocation::ChunkIDBits) &&
"Ran out of file ID's!");
return FileID::Create(FileIDs.size());
}
@@ -138,7 +138,7 @@ FileID SourceManager::createFileID(const ContentCache *File,
FileSize -= (1 << SourceLocation::FilePosBits);
}
- assert(FileIDs.size() < (1 << SourceLocation::FileIDBits) &&
+ assert(FileIDs.size() < (1 << SourceLocation::ChunkIDBits) &&
"Ran out of file ID's!");
return FileID::Create(Result);
}
@@ -165,7 +165,7 @@ SourceLocation SourceManager::getInstantiationLoc(SourceLocation SpellingLoc,
// The instanitation point and source SpellingLoc have to exactly match to
// reuse (for now). We could allow "nearby" instantiations in the future.
if (LastOne.getInstantiationLoc() != InstantLoc ||
- LastOne.getSpellingLoc().getFileID() != SpellingLoc.getFileID())
+ LastOne.getSpellingLoc().getChunkID() != SpellingLoc.getChunkID())
continue;
// Check to see if the spellloc of the token came from near enough to reuse.
@@ -215,7 +215,7 @@ const char *SourceManager::getCharacterData(SourceLocation SL) const {
/// this is significantly cheaper to compute than the line number. This returns
/// zero if the column number isn't known.
unsigned SourceManager::getColumnNumber(SourceLocation Loc) const {
- if (Loc.getFileID() == 0) return 0;
+ if (Loc.getChunkID() == 0) return 0;
std::pair<FileID, unsigned> LocInfo = getDecomposedFileLoc(Loc);
unsigned FilePos = LocInfo.second;
@@ -232,7 +232,7 @@ unsigned SourceManager::getColumnNumber(SourceLocation Loc) const {
/// the SourceLocation specifies. This can be modified with #line directives,
/// etc.
const char *SourceManager::getSourceName(SourceLocation Loc) const {
- if (Loc.getFileID() == 0) return "";
+ if (Loc.getChunkID() == 0) return "";
// To get the source name, first consult the FileEntry (if one exists) before
// the MemBuffer as this will avoid unnecessarily paging in the MemBuffer.
@@ -290,7 +290,7 @@ static void ComputeLineNumbers(ContentCache* FI) {
/// line offsets for the MemoryBuffer, so this is not cheap: use only when
/// about to emit a diagnostic.
unsigned SourceManager::getLineNumber(SourceLocation Loc) const {
- if (Loc.getFileID() == 0) return 0;
+ if (Loc.getChunkID() == 0) return 0;
ContentCache *Content;
OpenPOWER on IntegriCloud