summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/FileUtilities.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-10-18 20:23:52 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-10-18 20:23:52 +0000
commit309e03aea25c4dfadb0632e3fbed7a0244e75197 (patch)
treea1ed87944bce4a126a8489fc35c064f553b67ea8 /llvm/lib/Support/FileUtilities.cpp
parent8f0acfbe6a849a66cd29d32228526ba92b68a339 (diff)
downloadbcm5719-llvm-309e03aea25c4dfadb0632e3fbed7a0244e75197.tar.gz
bcm5719-llvm-309e03aea25c4dfadb0632e3fbed7a0244e75197.zip
Beef up the output from DiffFilesWithTolerance by setting the error code
to describe the difference being reported. This assists with understanding differences an llvm-test and should help with bugpoint too. llvm-svn: 31044
Diffstat (limited to 'llvm/lib/Support/FileUtilities.cpp')
-rw-r--r--llvm/lib/Support/FileUtilities.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/llvm/lib/Support/FileUtilities.cpp b/llvm/lib/Support/FileUtilities.cpp
index ad4ab8f004f..2160c77d8a0 100644
--- a/llvm/lib/Support/FileUtilities.cpp
+++ b/llvm/lib/Support/FileUtilities.cpp
@@ -85,7 +85,13 @@ static bool CompareNumbers(char *&F1P, char *&F2P, char *F1End, char *F2End,
}
if (F1NumEnd == F1P || F2NumEnd == F2P) {
- if (ErrorMsg) *ErrorMsg = "Comparison failed, not a numeric difference.";
+ if (ErrorMsg) {
+ *ErrorMsg = "FP Comparison failed, not a numeric difference between '";
+ *ErrorMsg += F1P[0];
+ *ErrorMsg += "' and '";
+ *ErrorMsg += F2P[0];
+ *ErrorMsg += "'";
+ }
return true;
}
@@ -160,9 +166,13 @@ int llvm::DiffFilesWithTolerance(const sys::Path &FileA,
// If they are both zero sized then they're the same
if (A_size == 0 && B_size == 0)
return 0;
+
// If only one of them is zero sized then they can't be the same
- if ((A_size == 0 || B_size == 0))
+ if ((A_size == 0 || B_size == 0)) {
+ if (Error)
+ *Error = "Files differ: one is zero-sized, the other isn't";
return 1;
+ }
// Now its safe to mmap the files into memory becasue both files
// have a non-zero size.
@@ -190,8 +200,11 @@ int llvm::DiffFilesWithTolerance(const sys::Path &FileA,
if (std::memcmp(File1Start, File2Start, A_size) == 0)
return 0;
- if (AbsTol == 0 && RelTol == 0)
+ if (AbsTol == 0 && RelTol == 0) {
+ if (Error)
+ *Error = "Files differ without tolerance allowance";
return 1; // Files different!
+ }
}
char *OrigFile1Start = File1Start;
OpenPOWER on IntegriCloud