Index: lib/Basic/SourceManager.cpp =================================================================== --- lib/Basic/SourceManager.cpp +++ lib/Basic/SourceManager.cpp @@ -2035,7 +2035,10 @@ return LIsScratch; return LOffs.second < ROffs.second; } - llvm_unreachable("Unsortable locations found"); + + // If SourceLocations originate from different TUs, but cannot be handled + // by one of the previous cases, just compare the FileIDs directly. + return LOffs.first < ROffs.first; } std::pair SourceManager::isInTheSameTranslationUnit(