diff options
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index acdfcb8..159c563 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -107,6 +107,16 @@ static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args, // By default the frontend driver creates a ParseSyntaxOnly action. opts.programAction = ParseSyntaxOnly; + // Treat multiple action options as an invocation error. Note that `clang + // -cc1` does accept multiple action options, but will only consider the + // rightmost one. + if (args.hasMultipleArgs(clang::driver::options::OPT_Action_Group)) { + const unsigned diagID = diags.getCustomDiagID( + clang::DiagnosticsEngine::Error, "Only one action option is allowed"); + diags.Report(diagID); + return false; + } + // Identify the action (i.e. opts.ProgramAction) if (const llvm::opt::Arg *a = args.getLastArg(clang::driver::options::OPT_Action_Group)) { |