From 54232ade44d31e98ea83f43ca066128e315dcbda Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 19 Aug 2011 22:34:01 +0000 Subject: 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 --- lib/Basic/SourceManager.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'lib/Basic/SourceManager.cpp') 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. -- cgit v1.2.3