summaryrefslogtreecommitdiff
path: root/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-08-19 22:34:01 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-08-19 22:34:01 +0000
commit54232ade44d31e98ea83f43ca066128e315dcbda (patch)
tree31129e143caf9b7718abf23ec9aaa670b8cb999b /lib/Basic/SourceManager.cpp
parent50bbc165b063155cc23c360deb7b865502e068e2 (diff)
downloadclang-54232ade44d31e98ea83f43ca066128e315dcbda.tar.gz
Refactor common functionality into SourceManager::getFileIDSize, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r--lib/Basic/SourceManager.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index 8190ca397a..2d8a47d089 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -1498,21 +1498,8 @@ SourceLocation SourceManager::getMacroArgExpandedLocation(SourceLocation Loc) {
// that was lexed.
SourceLocation SpellLoc = Entry.getExpansion().getSpellingLoc();
- unsigned NextOffset;
- if (ID > 0) {
- if (unsigned(ID+1) == local_sloc_entry_size())
- NextOffset = getNextLocalOffset();
- else
- NextOffset = getLocalSLocEntry(ID+1).getOffset();
- } else {
- if (ID+1 == -1)
- NextOffset = MaxLoadedOffset;
- else
- NextOffset = getSLocEntry(FileID::get(ID+1)).getOffset();
- }
- unsigned EntrySize = NextOffset - Entry.getOffset() - 1;
unsigned BeginOffs = SpellLoc.getOffset();
- unsigned EndOffs = BeginOffs + EntrySize;
+ unsigned EndOffs = BeginOffs + getFileIDSize(FileID::get(ID));
if (BeginOffs <= Loc.getOffset() && Loc.getOffset() < EndOffs) {
SourceLocation ExpandLoc = SourceLocation::getMacroLoc(Entry.getOffset());
// Replace current Loc with the expanded location and continue.