Don't use PathV1.h in FileUtilities.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183941 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2013-06-13 20:41:00 +00:00
parent 675e0ac0bf
commit bbf97ea7d5
5 changed files with 13 additions and 10 deletions

View File

@ -17,7 +17,6 @@
#include "llvm/Support/FileSystem.h" #include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h" #include "llvm/Support/Path.h"
#include "llvm/Support/PathV1.h"
namespace llvm { namespace llvm {
@ -28,8 +27,8 @@ namespace llvm {
/// option, it will set the string to an error message if an error occurs, or /// option, it will set the string to an error message if an error occurs, or
/// if the files are different. /// if the files are different.
/// ///
int DiffFilesWithTolerance(const sys::PathWithStatus &FileA, int DiffFilesWithTolerance(StringRef FileA,
const sys::PathWithStatus &FileB, StringRef FileB,
double AbsTol, double RelTol, double AbsTol, double RelTol,
std::string *Error = 0); std::string *Error = 0);

View File

@ -17,6 +17,7 @@
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h" #include "llvm/Support/Path.h"
#include "llvm/Support/PathV1.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h" #include "llvm/Support/system_error.h"
#include <cctype> #include <cctype>
@ -171,10 +172,13 @@ static bool CompareNumbers(const char *&F1P, const char *&F2P,
/// error occurs, allowing the caller to distinguish between a failed diff and a /// error occurs, allowing the caller to distinguish between a failed diff and a
/// file system error. /// file system error.
/// ///
int llvm::DiffFilesWithTolerance(const sys::PathWithStatus &FileA, int llvm::DiffFilesWithTolerance(StringRef NameA,
const sys::PathWithStatus &FileB, StringRef NameB,
double AbsTol, double RelTol, double AbsTol, double RelTol,
std::string *Error) { std::string *Error) {
sys::PathWithStatus FileA(NameA);
sys::PathWithStatus FileB(NameB);
const sys::FileStatus *FileAStat = FileA.getFileStatus(false, Error); const sys::FileStatus *FileAStat = FileA.getFileStatus(false, Error);
if (!FileAStat) if (!FileAStat)
return 2; return 2;

View File

@ -446,8 +446,8 @@ bool BugDriver::diffProgram(const Module *Program,
std::string Error; std::string Error;
bool FilesDifferent = false; bool FilesDifferent = false;
if (int Diff = DiffFilesWithTolerance(sys::Path(ReferenceOutputFile), if (int Diff = DiffFilesWithTolerance(ReferenceOutputFile,
sys::Path(Output.str()), Output.str(),
AbsTolerance, RelTolerance, &Error)) { AbsTolerance, RelTolerance, &Error)) {
if (Diff == 2) { if (Diff == 2) {
errs() << "While diffing output: " << Error << '\n'; errs() << "While diffing output: " << Error << '\n';

View File

@ -25,6 +25,7 @@
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/FileUtilities.h" #include "llvm/Support/FileUtilities.h"
#include "llvm/Support/Path.h" #include "llvm/Support/Path.h"
#include "llvm/Support/PathV1.h"
#include "llvm/Support/Program.h" #include "llvm/Support/Program.h"
#include "llvm/Support/SystemUtils.h" #include "llvm/Support/SystemUtils.h"
#include "llvm/Support/ToolOutputFile.h" #include "llvm/Support/ToolOutputFile.h"

View File

@ -33,9 +33,8 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv); cl::ParseCommandLineOptions(argc, argv);
std::string ErrorMsg; std::string ErrorMsg;
int DF = DiffFilesWithTolerance(sys::PathWithStatus(File1), int DF = DiffFilesWithTolerance(File1, File2, AbsTolerance, RelTolerance,
sys::PathWithStatus(File2), &ErrorMsg);
AbsTolerance, RelTolerance, &ErrorMsg);
if (!ErrorMsg.empty()) if (!ErrorMsg.empty())
errs() << argv[0] << ": " << ErrorMsg << "\n"; errs() << argv[0] << ": " << ErrorMsg << "\n";
return DF; return DF;