diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-06-15 19:20:30 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-06-15 19:20:30 +0000 |
commit | 71907fbebf5a812b9a117574b196d8ff9561ac75 (patch) | |
tree | d52440589f791bc48f47181625155aa5fb63fe89 /lib/Support/FileUtilities.cpp | |
parent | d1c82fe726a8776cb965c5bf1f6f6c0d311ef6bc (diff) | |
download | external_llvm-71907fbebf5a812b9a117574b196d8ff9561ac75.zip external_llvm-71907fbebf5a812b9a117574b196d8ff9561ac75.tar.gz external_llvm-71907fbebf5a812b9a117574b196d8ff9561ac75.tar.bz2 |
fpcmp: Fix bug where fpcmp wouldn't early exit when files obviously differ and
no tolerance is set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/FileUtilities.cpp')
-rw-r--r-- | lib/Support/FileUtilities.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/Support/FileUtilities.cpp b/lib/Support/FileUtilities.cpp index 11c1e02..1bde2fe 100644 --- a/lib/Support/FileUtilities.cpp +++ b/lib/Support/FileUtilities.cpp @@ -212,16 +212,16 @@ int llvm::DiffFilesWithTolerance(const sys::PathWithStatus &FileA, const char *F1P = File1Start; const char *F2P = File2Start; - if (A_size == B_size) { - // Are the buffers identical? Common case: Handle this efficiently. - if (std::memcmp(File1Start, File2Start, A_size) == 0) - return 0; + // Are the buffers identical? Common case: Handle this efficiently. + if (A_size == B_size && + std::memcmp(File1Start, File2Start, A_size) == 0) + return 0; - if (AbsTol == 0 && RelTol == 0) { - if (Error) - *Error = "Files differ without tolerance allowance"; - return 1; // Files different! - } + // Otherwise, we are done a tolerances are set. + if (AbsTol == 0 && RelTol == 0) { + if (Error) + *Error = "Files differ without tolerance allowance"; + return 1; // Files different! } bool CompareFailed = false; |