Bug in SourceManager::isInTheSameTranslationUnit ?

In some cases it is possible that one sourceLocation has a file with
relative path and the other sourceLocation has the same file but with
absolute path. In these cases we fail to recognize that the
sourceLocations are for the same TU.


(gdb) p LB
$2 = {static npos = 18446744073709551615,
  Data = 0x6a70b8
Length = 95}
(gdb) p RB
$3 = {static npos = 18446744073709551615,
  Data = 0x2429dc8
  Length = 224}
(gdb) p InSameTU
$4 = {first = false, second = false}

The side effect of this bug is that we can't dump some of the
declarations because in `SourceManager::isBeforeInTranslationUnit` we
reach an unreachable point. This is really frustrating during

(gdb) p ((RecordDecl*)ToDC)->dump()
ClassTemplatePartialSpecializationDecl 0x1f1f650
line:51:12> col:12 struct __add_c_ref
> -TemplateArgument type 'type-parameter-0-0 &'Unsortable locations found

UNREACHABLE executed at

Program received signal SIGABRT, Aborted.

One quickfix is this:

--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -2061,6 +2061,7 @@ bool
SourceManager::isBeforeInTranslationUnit(SourceLocation LHS,
       return LIsScratch;
     return LOffs.second < ROffs.second;
+  return LB < RB;
   llvm_unreachable("Unsortable locations found");

This is of course not the real solution.

Would it be possible to make both paths absolute in
isBeforeInTranslationUnit? Or it just would add other difficulties?