r217710 - clang-cl: Warn when a /TC or /TP argument is unused
Ehsan Akhgari
ehsan.akhgari at gmail.com
Fri Sep 12 14:44:24 PDT 2014
Author: ehsan
Date: Fri Sep 12 16:44:24 2014
New Revision: 217710
URL: http://llvm.org/viewvc/llvm-project?rev=217710&view=rev
Log:
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
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/cl-inputs.c
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=217710&r1=217709&r2=217710&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Sep 12 16:44:24 2014
@@ -987,8 +987,8 @@ void Driver::BuildInputs(const ToolChain
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;
Modified: cfe/trunk/test/Driver/cl-inputs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-inputs.c?rev=217710&r1=217709&r2=217710&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-inputs.c (original)
+++ cfe/trunk/test/Driver/cl-inputs.c Fri Sep 12 16:44:24 2014
@@ -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
More information about the cfe-commits
mailing list