summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-10-22 04:10:06 +0000
committerRui Ueyama <ruiu@google.com>2013-10-22 04:10:06 +0000
commita93033cc89648a8df95493ca6a1cee4f257ed312 (patch)
tree598c6c7105df466630be445b9168b97da15b43cb
parent6defa0a9607a47c823cf5f0d90c52e14c72d4d9f (diff)
downloadbcm5719-llvm-a93033cc89648a8df95493ca6a1cee4f257ed312.tar.gz
bcm5719-llvm-a93033cc89648a8df95493ca6a1cee4f257ed312.zip
[PECOFF] Better error handling for /manifest.
llvm-svn: 193143
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index dadb9529c04..a57ffb74064 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -140,30 +140,25 @@ llvm::COFF::MachineTypes stringToMachineType(StringRef str) {
}
// Parse /manifest:EMBED[,ID=#]|NO.
-bool parseManifest(StringRef option, raw_ostream &diagnostics, bool &enable,
- bool &embed, int &id) {
+bool parseManifest(StringRef option, bool &enable, bool &embed, int &id) {
std::string optionLower = option.lower();
if (optionLower == "no") {
enable = false;
return true;
}
if (!StringRef(optionLower).startswith("embed"))
- goto parse_error;
+ return false;
embed = true;
optionLower = optionLower.substr(strlen("embed"));
if (optionLower.empty())
return true;
if (!StringRef(optionLower).startswith(",id="))
- goto parse_error;
+ return false;
optionLower = optionLower.substr(strlen(",id="));
if (StringRef(optionLower).getAsInteger(0, id))
- goto parse_error;
+ return false;
return true;
-
-parse_error:
- diagnostics << "Unknown argument for /manifest: " << option << "\n";
- return false;
}
// Handle /failifmismatch option.
@@ -431,8 +426,11 @@ WinLinkDriver::parse(int argc, const char *argv[], PECOFFLinkingContext &ctx,
bool enable = true;
bool embed = false;
int id = 1;
- if (!parseManifest(inputArg->getValue(), diagnostics, enable, embed, id))
+ if (!parseManifest(inputArg->getValue(), enable, embed, id)) {
+ diagnostics << "Unknown argument for /manifest: "
+ << inputArg->getValue() << "\n";
return false;
+ }
ctx.setCreateManifest(enable);
ctx.setEmbedManifest(embed);
ctx.setManifestId(id);
OpenPOWER on IntegriCloud