diff options
Diffstat (limited to 'Basic/SourceManager.cpp')
-rw-r--r-- | Basic/SourceManager.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Basic/SourceManager.cpp b/Basic/SourceManager.cpp index d05da5d971..be8eeee408 100644 --- a/Basic/SourceManager.cpp +++ b/Basic/SourceManager.cpp @@ -180,20 +180,19 @@ SourceLocation SourceManager::getInstantiationLoc(SourceLocation PhysLoc, // reuse it. This implements a single-entry cache. if (!MacroIDs.empty()) { MacroIDInfo &LastOne = MacroIDs.back(); + if (LastOne.getInstantiationLoc() == InstantLoc && LastOne.getPhysicalLoc().getFileID() == PhysLoc.getFileID()) { int PhysDelta = PhysLoc.getRawFilePos() - LastOne.getPhysicalLoc().getRawFilePos(); - if (unsigned(PhysDelta) < (1 << SourceLocation::MacroPhysOffsBits)) - return SourceLocation::getMacroLoc(MacroIDs.size()-1, - (unsigned)PhysDelta, 0); + if (SourceLocation::isValidMacroPhysOffs(PhysDelta)) + return SourceLocation::getMacroLoc(MacroIDs.size()-1, PhysDelta, 0); } } MacroIDs.push_back(MacroIDInfo::get(InstantLoc, PhysLoc)); - return SourceLocation::getMacroLoc(MacroIDs.size()-1, 0, 0); } |