GNU: Use StringRef::empty instead of a boolean flag.
This local variable name did not follow the style guide,
and it is not actually needed.
llvm-svn: 228722
diff --git a/lld/lib/Driver/GnuLdDriver.cpp b/lld/lib/Driver/GnuLdDriver.cpp
index 43474a2..32a5db2 100644
--- a/lld/lib/Driver/GnuLdDriver.cpp
+++ b/lld/lib/Driver/GnuLdDriver.cpp
@@ -393,12 +393,8 @@
std::stack<int> groupStack;
int numfiles = 0;
-
bool asNeeded = false;
bool wholeArchive = false;
-
- bool _outputOptionSet = false;
-
bool hasNoStdLib = false;
// Ignore unknown arguments.
@@ -513,7 +509,6 @@
break;
case OPT_output:
- _outputOptionSet = true;
ctx->setOutputPath(inputArg->getValue());
break;
@@ -723,9 +718,8 @@
return false;
}
- // Set default output file name if the output file was not
- // specified.
- if (!_outputOptionSet) {
+ // Set default output file name if the output file was not specified.
+ if (ctx->outputPath().empty()) {
switch (ctx->outputFileType()) {
case LinkingContext::OutputFileType::YAML:
ctx->setOutputPath("-");
diff --git a/lld/unittests/DriverTests/GnuLdDriverTest.cpp b/lld/unittests/DriverTests/GnuLdDriverTest.cpp
index 5e40b4b..1199136 100644
--- a/lld/unittests/DriverTests/GnuLdDriverTest.cpp
+++ b/lld/unittests/DriverTests/GnuLdDriverTest.cpp
@@ -62,6 +62,11 @@
EXPECT_EQ("foo", _context->outputPath());
}
+TEST_F(GnuLdParserTest, OutputDefault) {
+ EXPECT_TRUE(parse("ld", "abc.o", nullptr));
+ EXPECT_EQ("a.out", _context->outputPath());
+}
+
// --noinhibit-exec
TEST_F(GnuLdParserTest, NoinhibitExec) {