Skip to content

Commit 17980bd

Browse files
Restore getDecompiledLoc
1 parent 6d82050 commit 17980bd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clang/include/clang/Basic/SourceManager.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,8 +1275,10 @@ class SourceManager : public RefCountedBase<SourceManager> {
12751275
/// start of the buffer of the location.
12761276
FileIDAndOffset getDecomposedLoc(SourceLocation Loc) const {
12771277
FileID FID = getFileID(Loc);
1278-
const SrcMgr::SLocEntry &Entry = getSLocEntry(FID);
1279-
return std::make_pair(FID, Loc.getOffset() - Entry.getOffset());
1278+
auto *Entry = getSLocEntryOrNull(FID);
1279+
if (!Entry)
1280+
return std::make_pair(FileID(), 0);
1281+
return std::make_pair(FID, Loc.getOffset() - Entry->getOffset());
12801282
}
12811283

12821284
/// Decompose the specified location into a raw FileID + Offset pair.

0 commit comments

Comments
 (0)