llvm.org GIT mirror llvm / fbaa379
On Darwin, the string header file isn't 64-bit clean. The use of "-Wshorten-64-to-32 -Werror" will cause a failure when compiling this complex program: #include <string> class Path { mutable std::string path; public: bool operator == (const Path &that) { return path == that.path; } }; Using strcmp gets us past this annoying error. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51218 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 12 years ago
1 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
205205 /// @returns true if \p this and \p that refer to the same thing.
206206 /// @brief Equality Operator
207207 bool operator==(const Path &that) const {
208 return path == that.path;
208 return strcmp(path.c_str(), that.path.c_str()) == 0;
209209 }
210210
211211 /// Compares \p this Path with \p that Path for inequality.
212212 /// @returns true if \p this and \p that refer to different things.
213213 /// @brief Inequality Operator
214214 bool operator!=(const Path &that) const {
215 return path != that.path;
215 return strcmp(path.c_str(), that.path.c_str()) != 0;
216216 }
217217
218218 /// Determines if \p this Path is less than \p that Path. This is required
222222 /// @returns true if \p this path is lexicographically less than \p that.
223223 /// @brief Less Than Operator
224224 bool operator<(const Path& that) const {
225 return path < that.path;
225 return strcmp(path.c_str(), that.path.c_str()) < 0;
226226 }
227227
228228 /// @}