diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-04-07 18:10:07 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-04-07 18:10:07 +0000 |
commit | 3fd80c1f1a720380501705b3d5f24c326a52c90b (patch) | |
tree | fef09cf156b49c83cc6a7e5a021ebe611acf3c29 | |
parent | 529c03bc1ea8f447b8a1e6cd0b7b7e9742f6fd4f (diff) | |
download | bcm5719-llvm-3fd80c1f1a720380501705b3d5f24c326a52c90b.tar.gz bcm5719-llvm-3fd80c1f1a720380501705b3d5f24c326a52c90b.zip |
Add FullSourceLoc::BeforeThanCompare. a comparison function class, useful for sorting FullSourceLocs.
llvm-svn: 129084
-rw-r--r-- | clang/include/clang/Basic/SourceLocation.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/SourceLocation.h b/clang/include/clang/Basic/SourceLocation.h index 605c4bbafc7..14bb2b724fd 100644 --- a/clang/include/clang/Basic/SourceLocation.h +++ b/clang/include/clang/Basic/SourceLocation.h @@ -16,6 +16,7 @@ #include "llvm/Support/PointerLikeTypeTraits.h" #include <utility> +#include <functional> #include <cassert> namespace llvm { @@ -295,6 +296,14 @@ public: 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); } |