aboutsummaryrefslogtreecommitdiff
path: root/Basic/SourceManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Basic/SourceManager.cpp')
-rw-r--r--Basic/SourceManager.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Basic/SourceManager.cpp b/Basic/SourceManager.cpp
index 2a9a553fcc..a2520e3aff 100644
--- a/Basic/SourceManager.cpp
+++ b/Basic/SourceManager.cpp
@@ -166,11 +166,12 @@ unsigned SourceManager::createFileID(const InfoRec *File,
/// getInstantiationLoc - Return a new SourceLocation that encodes the fact
/// that a token from physloc PhysLoc should actually be referenced from
/// InstantiationLoc.
-SourceLocation SourceManager::getInstantiationLoc(SourceLocation PhysLoc,
+SourceLocation SourceManager::getInstantiationLoc(SourceLocation VirtLoc,
SourceLocation InstantLoc) {
- assert(getFIDInfo(PhysLoc.getFileID())->IDType !=
- SrcMgr::FileIDInfo::MacroExpansion &&
- "Location instantiated in a macro?");
+ // The specified source location may be a mapped location, due to a macro
+ // instantiation or #line directive. Strip off this information to find out
+ // where the characters are actually located.
+ SourceLocation PhysLoc = getPhysicalLoc(VirtLoc);
// Resolve InstantLoc down to a real logical location.
InstantLoc = getLogicalLoc(InstantLoc);