diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index afa1884d94b7..420340aaab88 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -3082,7 +3082,7 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args, InputTypeArg->claim(); // stdin must be handled specially. - if (memcmp(Value, "-", 2) == 0) { + if (strcmp(Value, "-") == 0) { if (IsFlangMode()) { Ty = types::TY_Fortran; } else if (IsDXCMode()) { diff --git a/clang/test/Driver/empty_arg.c b/clang/test/Driver/empty_arg.c new file mode 100644 index 000000000000..94ed8f13cbec --- /dev/null +++ b/clang/test/Driver/empty_arg.c @@ -0,0 +1,2 @@ +// RUN: not %clang -- "" 2>&1 | FileCheck %s +// CHECK: error: no such file or directory: '' diff --git a/llvm/lib/Option/OptTable.cpp b/llvm/lib/Option/OptTable.cpp index 065036cedc2a..8444675b847e 100644 --- a/llvm/lib/Option/OptTable.cpp +++ b/llvm/lib/Option/OptTable.cpp @@ -264,8 +264,6 @@ unsigned OptTable::internalFindNearest( StringRef Option, std::string &NearestString, unsigned MinimumLength, unsigned MaximumDistance, std::function ExcludeOption) const { - assert(!Option.empty()); - // Consider each [option prefix + option name] pair as a candidate, finding // the closest match. unsigned BestDistance =