[llvm-branch-commits] [cfe-branch] r123013 - /cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp

Daniel Dunbar daniel at zuster.org
Fri Jan 7 11:32:52 PST 2011


Author: ddunbar
Date: Fri Jan  7 13:32:52 2011
New Revision: 123013

URL: http://llvm.org/viewvc/llvm-project?rev=123013&view=rev
Log:
Merge r122536:
--
Author: Argyrios Kyrtzidis <akyrtzi at gmail.com>
Date:   Fri Dec 24 02:53:53 2010 +0000

    Handle locations coming from macro instantiations properly in SourceManager::isBeforeInTranslationUnit().
    Fixes rdar://8790245 and http://llvm.org/PR8821.

*** MANUAL MERGE ***

Modified:
    cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp

Modified: cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp?rev=123013&r1=123012&r2=123013&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp Fri Jan  7 13:32:52 2011
@@ -1204,6 +1204,13 @@
   if (LHS == RHS)
     return false;
 
+  // If both locations are macro instantiations, the order of their offsets
+  // reflect the order that the tokens, pointed to by these locations, were
+  // instantiated (during parsing each token that is instantiated by a macro,
+  // expands the SLocEntries).
+  if (LHS.isMacroID() && RHS.isMacroID())
+    return LHS.getOffset() < RHS.getOffset();
+
   std::pair<FileID, unsigned> LOffs = getDecomposedLoc(LHS);
   std::pair<FileID, unsigned> ROffs = getDecomposedLoc(RHS);
 





More information about the llvm-branch-commits mailing list