]> granicus.if.org Git - clang/commitdiff
For SourceManager::isBeforeInTranslationUnit, when one location
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 19 Sep 2011 20:39:51 +0000 (20:39 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 19 Sep 2011 20:39:51 +0000 (20:39 +0000)
points at the inclusion/expansion point of the other, regard this
as coming before the other.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140051 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/SourceManager.h

index 7ddc887edca1c862a71bec972ff13e43aed42e9c..fb48430e25cea4c33bce3c92c92b8d64501885b0 100644 (file)
@@ -434,8 +434,11 @@ public:
 
     // It is common for multiple macro expansions to be "included" from the same
     // location (expansion location), in which case use the order of the FileIDs
-    // to determine which came first.
-    if (LOffset == ROffset && LQueryFID != CommonFID && RQueryFID != CommonFID)
+    // to determine which came first. This will also take care the case where
+    // one of the locations points at the inclusion/expansion point of the other
+    // in which case its FileID will come before the other.
+    if (LOffset == ROffset &&
+        (LQueryFID != CommonFID || RQueryFID != CommonFID))
       return IsLQFIDBeforeRQFID;
 
     return LOffset < ROffset;