Follow-up to the reverting of r51218. This puts the checks out-of-line. Because

they aren't in the header file, systems with a <string> header file that isn't
64-bit clean shouldn't warn if #including Path.h and specifying
-Wshorten-64-to-32.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51393 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2008-05-21 21:20:07 +00:00
parent 0263140c9e
commit 40db5d4539
2 changed files with 15 additions and 9 deletions

View File

@ -205,16 +205,12 @@ namespace sys {
/// Compares \p this Path with \p that Path for equality. /// Compares \p this Path with \p that Path for equality.
/// @returns true if \p this and \p that refer to the same thing. /// @returns true if \p this and \p that refer to the same thing.
/// @brief Equality Operator /// @brief Equality Operator
bool operator==(const Path &that) const { bool operator==(const Path &that) const;
return path == that.path;
}
/// Compares \p this Path with \p that Path for inequality. /// Compares \p this Path with \p that Path for inequality.
/// @returns true if \p this and \p that refer to different things. /// @returns true if \p this and \p that refer to different things.
/// @brief Inequality Operator /// @brief Inequality Operator
bool operator!=(const Path &that) const { bool operator!=(const Path &that) const;
return path != that.path;
}
/// Determines if \p this Path is less than \p that Path. This is required /// Determines if \p this Path is less than \p that Path. This is required
/// so that Path objects can be placed into ordered collections (e.g. /// so that Path objects can be placed into ordered collections (e.g.
@ -222,9 +218,7 @@ namespace sys {
/// the std::string::compare method. /// the std::string::compare method.
/// @returns true if \p this path is lexicographically less than \p that. /// @returns true if \p this path is lexicographically less than \p that.
/// @brief Less Than Operator /// @brief Less Than Operator
bool operator<(const Path& that) const { bool operator<(const Path& that) const;
return path < that.path;
}
/// @} /// @}
/// @name Path Accessors /// @name Path Accessors

View File

@ -24,6 +24,18 @@ using namespace sys;
//=== independent code. //=== independent code.
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
bool Path::operator==(const Path &that) const {
return path == that.path;
}
bool Path::operator!=(const Path &that) const {
return path != that.path;
}
bool Path::operator<(const Path& that) const {
return path < that.path;
}
std::ostream& llvm::operator<<(std::ostream &strm, const sys::Path &aPath) { std::ostream& llvm::operator<<(std::ostream &strm, const sys::Path &aPath) {
strm << aPath.toString(); strm << aPath.toString();
return strm; return strm;