aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorAndrzej Warzynski <andrzej.warzynski@arm.com>2021-06-02 21:53:02 +0100
committerAndrzej Warzynski <andrzej.warzynski@arm.com>2021-06-04 15:16:56 +0100
commit2b4c9bc4d489a4be1c5aa1924fba542dc80ab0c9 (patch)
tree83777df26bb41edc7484725f328fea73b5d295a6 /flang/lib/Frontend/CompilerInvocation.cpp
parentf03f4944cf829c86bc2c080b9a564bbc59aad277 (diff)
downloadllvm-2b4c9bc4d489a4be1c5aa1924fba542dc80ab0c9.zip
llvm-2b4c9bc4d489a4be1c5aa1924fba542dc80ab0c9.tar.gz
llvm-2b4c9bc4d489a4be1c5aa1924fba542dc80ab0c9.tar.bz2
[flang][driver] Add checks for missing option arguments
With this patch, the following invocation of the frontend driver will return an error: ``` flang-new -fc1 input-file.f90 -o ``` Similar logic applies to other options that require arguments. Similar checks are already available in the compiler driver, flang-new (that's implemented in clangDriver). Differential Revision: https://reviews.llvm.org/D103554
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 1d18dda..6d9a3a7 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -501,6 +501,13 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &res,
llvm::opt::InputArgList args = opts.ParseArgs(
commandLineArgs, missingArgIndex, missingArgCount, includedFlagsBitmask);
+ // Check for missing argument error.
+ if (missingArgCount) {
+ diags.Report(clang::diag::err_drv_missing_argument)
+ << args.getArgString(missingArgIndex) << missingArgCount;
+ success = false;
+ }
+
// Issue errors on unknown arguments
for (const auto *a : args.filtered(clang::driver::options::OPT_UNKNOWN)) {
auto argString = a->getAsString(args);