r259031 - Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline.

Yury Gribov via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 28 01:28:18 PST 2016


Author: ygribov
Date: Thu Jan 28 03:28:18 2016
New Revision: 259031

URL: http://llvm.org/viewvc/llvm-project?rev=259031&view=rev
Log:
Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline.

Differential Revision: http://reviews.llvm.org/D15804

Modified:
    cfe/trunk/lib/Basic/SourceManager.cpp

Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=259031&r1=259030&r2=259031&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Thu Jan 28 03:28:18 2016
@@ -2110,6 +2110,14 @@ bool SourceManager::isBeforeInTranslatio
     assert(LOffs.first == ROffs.first);
     return false;
   }
+  bool LIsScratch = strcmp("<scratch space>", LB) == 0;
+  bool RIsScratch = strcmp("<scratch space>", RB) == 0;
+  // Sort scratch after inline asm, but before the rest.
+  if (LIsScratch || RIsScratch) {
+    if (LIsScratch != RIsScratch)
+      return LIsScratch;
+    return LOffs.second < ROffs.second;
+  }
   llvm_unreachable("Unsortable locations found");
 }
 




More information about the cfe-commits mailing list