Index: lib/Basic/SourceManager.cpp =================================================================== --- lib/Basic/SourceManager.cpp +++ lib/Basic/SourceManager.cpp @@ -2034,6 +2034,9 @@ } /// \brief Determines the order of 2 source locations in the translation unit. +/// It also works when two locations are from different translation +/// units. In that case it will return *some* order, that is +/// deterministic for that invocation of the compiler. /// /// \returns true if LHS source location comes before RHS, false otherwise. bool SourceManager::isBeforeInTranslationUnit(SourceLocation LHS, @@ -2130,7 +2133,8 @@ return LIsScratch; return LOffs.second < ROffs.second; } - llvm_unreachable("Unsortable locations found"); + // Source locations from different translation units. + return LOffs.first < ROffs.first; } void SourceManager::PrintStats() const {