aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-ml/llvm-ml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-ml/llvm-ml.cpp')
-rw-r--r--llvm/tools/llvm-ml/llvm-ml.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/tools/llvm-ml/llvm-ml.cpp b/llvm/tools/llvm-ml/llvm-ml.cpp
index 2651132f2..12cd727 100644
--- a/llvm/tools/llvm-ml/llvm-ml.cpp
+++ b/llvm/tools/llvm-ml/llvm-ml.cpp
@@ -208,9 +208,10 @@ int main(int Argc, char **Argv) {
std::string InputFilename;
for (auto *Arg : InputArgs.filtered(OPT_INPUT)) {
std::string ArgString = Arg->getAsString(InputArgs);
- StringRef ArgStringRef(ArgString);
- if (ArgString == "-" || ArgStringRef.endswith(".asm") ||
- ArgStringRef.endswith(".S")) {
+ bool IsFile = false;
+ std::error_code IsFileEC =
+ llvm::sys::fs::is_regular_file(ArgString, IsFile);
+ if (ArgString == "-" || IsFile) {
if (!InputFilename.empty()) {
WithColor::warning(errs(), ProgName)
<< "does not support multiple assembly files in one command; "
@@ -220,7 +221,7 @@ int main(int Argc, char **Argv) {
} else {
std::string Diag;
raw_string_ostream OS(Diag);
- OS << "invalid option '" << ArgString << "'";
+ OS << ArgString << ": " << IsFileEC.message();
std::string Nearest;
if (T.findNearest(ArgString, Nearest) < 2)