clang-cl: Warn when a /TC or /TP argument is unused
Test Plan: The patch includes a test case. Reviewers: hansw Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5338 llvm-svn: 217710
This commit is contained in:
parent
ac43144e5a
commit
c249abba05
2 changed files with 6 additions and 4 deletions
|
|
@ -987,8 +987,8 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args,
|
|||
Arg *InputTypeArg = nullptr;
|
||||
|
||||
// The last /TC or /TP option sets the input type to C or C++ globally.
|
||||
if (Arg *TCTP = Args.getLastArg(options::OPT__SLASH_TC,
|
||||
options::OPT__SLASH_TP)) {
|
||||
if (Arg *TCTP = Args.getLastArgNoClaim(options::OPT__SLASH_TC,
|
||||
options::OPT__SLASH_TP)) {
|
||||
InputTypeArg = TCTP;
|
||||
InputType = TCTP->getOption().matches(options::OPT__SLASH_TC)
|
||||
? types::TY_C : types::TY_CXX;
|
||||
|
|
|
|||
|
|
@ -34,12 +34,14 @@
|
|||
// WARN: note: The last /TC or /TP option takes precedence over earlier instances
|
||||
// WARN-NOT: note
|
||||
|
||||
// RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TP cl-test.lib %s -### 2>&1 | FileCheck -check-prefix=TPlib %s
|
||||
// RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TP cl-test.lib -### 2>&1 | FileCheck -check-prefix=TPlib %s
|
||||
// TPlib: warning: cl-test.lib: 'linker' input unused
|
||||
// TPlib: warning: argument unused during compilation: '/TP'
|
||||
// TPlib-NOT: cl-test.lib
|
||||
|
||||
// RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TC cl-test.lib %s -### 2>&1 | FileCheck -check-prefix=TClib %s
|
||||
// RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TC cl-test.lib -### 2>&1 | FileCheck -check-prefix=TClib %s
|
||||
// TClib: warning: cl-test.lib: 'linker' input unused
|
||||
// TClib: warning: argument unused during compilation: '/TC'
|
||||
// TClib-NOT: cl-test.lib
|
||||
|
||||
// RUN: not %clang_cl - 2>&1 | FileCheck -check-prefix=STDIN %s
|
||||
|
|
|
|||
Loading…
Reference in a new issue