diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-08-19 22:34:01 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-08-19 22:34:01 +0000 |
commit | 54232ade44d31e98ea83f43ca066128e315dcbda (patch) | |
tree | 31129e143caf9b7718abf23ec9aaa670b8cb999b /lib/Basic/SourceManager.cpp | |
parent | 50bbc165b063155cc23c360deb7b865502e068e2 (diff) | |
download | clang-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.cpp | 15 |
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. |