#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
-#include "llvm/Support/PathV1.h"
namespace llvm {
/// option, it will set the string to an error message if an error occurs, or
/// if the files are different.
///
- int DiffFilesWithTolerance(const sys::PathWithStatus &FileA,
- const sys::PathWithStatus &FileB,
+ int DiffFilesWithTolerance(StringRef FileA,
+ StringRef FileB,
double AbsTol, double RelTol,
std::string *Error = 0);
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/PathV1.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
#include <cctype>
/// error occurs, allowing the caller to distinguish between a failed diff and a
/// file system error.
///
-int llvm::DiffFilesWithTolerance(const sys::PathWithStatus &FileA,
- const sys::PathWithStatus &FileB,
+int llvm::DiffFilesWithTolerance(StringRef NameA,
+ StringRef NameB,
double AbsTol, double RelTol,
std::string *Error) {
+ sys::PathWithStatus FileA(NameA);
+ sys::PathWithStatus FileB(NameB);
+
const sys::FileStatus *FileAStat = FileA.getFileStatus(false, Error);
if (!FileAStat)
return 2;
std::string Error;
bool FilesDifferent = false;
- if (int Diff = DiffFilesWithTolerance(sys::Path(ReferenceOutputFile),
- sys::Path(Output.str()),
+ if (int Diff = DiffFilesWithTolerance(ReferenceOutputFile,
+ Output.str(),
AbsTolerance, RelTolerance, &Error)) {
if (Diff == 2) {
errs() << "While diffing output: " << Error << '\n';
#include "llvm/Support/Debug.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/PathV1.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/ToolOutputFile.h"
cl::ParseCommandLineOptions(argc, argv);
std::string ErrorMsg;
- int DF = DiffFilesWithTolerance(sys::PathWithStatus(File1),
- sys::PathWithStatus(File2),
- AbsTolerance, RelTolerance, &ErrorMsg);
+ int DF = DiffFilesWithTolerance(File1, File2, AbsTolerance, RelTolerance,
+ &ErrorMsg);
if (!ErrorMsg.empty())
errs() << argv[0] << ": " << ErrorMsg << "\n";
return DF;