From: Chad Rosier Date: Wed, 22 Feb 2012 17:55:22 +0000 (+0000) Subject: [driver] Add a warning for when -mcpu= is specified without an argument. There X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2dd17a15ddc0184790d790b6128d79ffddae4964;p=clang [driver] Add a warning for when -mcpu= is specified without an argument. There are likely many other OPT_xxxx_EQ options that could/should be added here. rdar://10704648 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151174 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index f3d9504891..3ada80f671 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -105,6 +105,8 @@ def warn_drv_preprocessed_input_file_unused : Warning< def warn_drv_unused_argument : Warning< "argument unused during compilation: '%0'">, InGroup>; +def warn_drv_empty_joined_argument : Warning< + "joined argument expects addition arg: '%0'">; def warn_drv_not_using_clang_cpp : Warning< "not using the clang preprocessor due to user override">; def warn_drv_not_using_clang_cxx : Warning< diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index f9e5d82c02..06953170d7 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -113,6 +113,12 @@ InputArgList *Driver::ParseArgStrings(ArrayRef ArgList) { Diag(clang::diag::err_drv_unsupported_opt) << A->getAsString(*Args); continue; } + + // Warn about -mcpu= without an argument. + if (A->getOption().matches(options::OPT_mcpu_EQ) && + A->containsValue("")) { + Diag(clang::diag::warn_drv_empty_joined_argument) << A->getAsString(*Args); + } } return Args;