aboutsummaryrefslogtreecommitdiff
path: root/clang/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
commit34d729d46d340a0c62cfca695a39fc8db27047e6 (patch)
treeb6213d3b74f838c3140524837440855a8ba6375f /clang/lib/Basic/SourceManager.cpp
parentf86615ca5c985063be4c898363f28bfd77c90434 (diff)
downloadllvm-34d729d46d340a0c62cfca695a39fc8db27047e6.zip
llvm-34d729d46d340a0c62cfca695a39fc8db27047e6.tar.gz
llvm-34d729d46d340a0c62cfca695a39fc8db27047e6.tar.bz2
Refactor common functionality into SourceManager::getFileIDSize, no functionality change.
llvm-svn: 138127
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 8190ca3..2d8a47d 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/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.