[cfe-commits] r129084 - /cfe/trunk/include/clang/Basic/SourceLocation.h

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Apr 7 11:10:08 PDT 2011


Author: akirtzidis
Date: Thu Apr  7 13:10:07 2011
New Revision: 129084

URL: http://llvm.org/viewvc/llvm-project?rev=129084&view=rev
Log:
Add FullSourceLoc::BeforeThanCompare. a comparison function class, useful for sorting FullSourceLocs.

Modified:
    cfe/trunk/include/clang/Basic/SourceLocation.h

Modified: cfe/trunk/include/clang/Basic/SourceLocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=129084&r1=129083&r2=129084&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceLocation.h (original)
+++ cfe/trunk/include/clang/Basic/SourceLocation.h Thu Apr  7 13:10:07 2011
@@ -16,6 +16,7 @@
 
 #include "llvm/Support/PointerLikeTypeTraits.h"
 #include <utility>
+#include <functional>
 #include <cassert>
 
 namespace llvm {
@@ -295,6 +296,14 @@
     return isBeforeInTranslationUnitThan((SourceLocation)Loc);
   }
 
+  /// \brief Comparison function class, useful for sorting FullSourceLocs.
+  struct BeforeThanCompare : public std::binary_function<FullSourceLoc,
+                                                         FullSourceLoc, bool> {
+    bool operator()(const FullSourceLoc& lhs, const FullSourceLoc& rhs) const {
+      return lhs.isBeforeInTranslationUnitThan(rhs);
+    }
+  };
+
   /// Prints information about this FullSourceLoc to stderr. Useful for
   ///  debugging.
   void dump() const { SourceLocation::dump(*SrcMgr); }





More information about the cfe-commits mailing list