diff options
author | Chris Lattner <sabre@nondot.org> | 2007-07-15 06:35:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-07-15 06:35:27 +0000 |
commit | abca2bba54197256f2830f757218cfbea2ed9cd1 (patch) | |
tree | 2a4f7e2429572041e60ee6ad6c2acb417875c552 /Basic/SourceManager.cpp | |
parent | fa2eaabd304172dd8afc561f6156a65f8d0e442b (diff) |
Change SourceManager::getInstantiationLoc to take virtual locations, doing its
virtual->physical mapping explicitly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39867 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic/SourceManager.cpp')
-rw-r--r-- | Basic/SourceManager.cpp | 9 |
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); |