[llvm] r372053 - llvm-reduce: Remove some string copies
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 16:54:57 PDT 2019
Author: dblaikie
Date: Mon Sep 16 16:54:57 2019
New Revision: 372053
URL: http://llvm.org/viewvc/llvm-project?rev=372053&view=rev
Log:
llvm-reduce: Remove some string copies
Modified:
llvm/trunk/tools/llvm-reduce/TestRunner.cpp
llvm/trunk/tools/llvm-reduce/TestRunner.h
Modified: llvm/trunk/tools/llvm-reduce/TestRunner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-reduce/TestRunner.cpp?rev=372053&r1=372052&r2=372053&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-reduce/TestRunner.cpp (original)
+++ llvm/trunk/tools/llvm-reduce/TestRunner.cpp Mon Sep 16 16:54:57 2019
@@ -10,25 +10,8 @@
using namespace llvm;
-/// Gets Current Working Directory and tries to create a Tmp Directory
-static SmallString<128> initializeTmpDirectory() {
- SmallString<128> CWD;
- if (std::error_code EC = sys::fs::current_path(CWD)) {
- errs() << "Error getting current directory: " << EC.message() << "!\n";
- exit(1);
- }
-
- SmallString<128> TmpDirectory;
- sys::path::append(TmpDirectory, CWD, "tmp");
- if (std::error_code EC = sys::fs::create_directory(TmpDirectory))
- errs() << "Error creating tmp directory: " << EC.message() << "!\n";
-
- return TmpDirectory;
-}
-
-TestRunner::TestRunner(StringRef TestName, std::vector<std::string> TestArgs)
- : TestName(TestName), TestArgs(std::move(TestArgs)) {
- TmpDirectory = initializeTmpDirectory();
+TestRunner::TestRunner(StringRef TestName, const std::vector<std::string> &TestArgs)
+ : TestName(TestName), TestArgs(TestArgs) {
}
/// Runs the interestingness test, passes file to be tested as first argument
Modified: llvm/trunk/tools/llvm-reduce/TestRunner.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-reduce/TestRunner.h?rev=372053&r1=372052&r2=372053&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-reduce/TestRunner.h (original)
+++ llvm/trunk/tools/llvm-reduce/TestRunner.h Mon Sep 16 16:54:57 2019
@@ -24,23 +24,20 @@ namespace llvm {
// respective filename.
class TestRunner {
public:
- TestRunner(StringRef TestName, std::vector<std::string> TestArgs);
+ TestRunner(StringRef TestName, const std::vector<std::string> &TestArgs);
/// Runs the interesting-ness test for the specified file
/// @returns 0 if test was successful, 1 if otherwise
int run(StringRef Filename);
- /// Directory where tmp files are created
- StringRef getTmpDir() const { return TmpDirectory; }
/// Returns the most reduced version of the original testcase
Module *getProgram() const { return Program.get(); }
void setProgram(std::unique_ptr<Module> P) { Program = std::move(P); }
private:
- SmallString<128> TestName;
- std::vector<std::string> TestArgs;
- SmallString<128> TmpDirectory;
+ StringRef TestName;
+ const std::vector<std::string> &TestArgs;
std::unique_ptr<Module> Program;
};
More information about the llvm-commits
mailing list