[PATCH] D64527: driver: Don't warn about assembler flags being unused when not assembling
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 10 15:33:53 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365703: driver: Don't warn about assembler flags being unused when not assembling (authored by nico, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D64527?vs=209041&id=209081#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64527/new/
https://reviews.llvm.org/D64527
Files:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/as-options.s
Index: cfe/trunk/test/Driver/as-options.s
===================================================================
--- cfe/trunk/test/Driver/as-options.s
+++ cfe/trunk/test/Driver/as-options.s
@@ -35,3 +35,14 @@
// RUN: | FileCheck %s
// CHECK: "-I" "foo_dir"
+
+// Test that assembler options don't cause warnings when there's no assembler
+// stage.
+
+// RUN: %clang -mincremental-linker-compatible -E -o /dev/null %s 2>&1 \
+// RUN: | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -mimplicit-it=always -target armv7-linux-gnueabihf -E %s \
+// RUN: | FileCheck --check-prefix=WARN --allow-empty %s
+// RUN: %clang -Wa,-mbig-obj -target i386-pc-windows -E %s \
+// RUN: | FileCheck --check-prefix=WARN --allow-empty %s
+// WARN-NOT: unused
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -3545,6 +3545,18 @@
// Select the appropriate action.
RewriteKind rewriteKind = RK_None;
+ // If CollectArgsForIntegratedAssembler() isn't called below, call it here
+ // with a dummy args list to mark assembler flags as used even when not
+ // running an assembler. Otherwise, clang would emit "argument unused"
+ // warnings for assembler flags when e.g. adding "-E" to flags while debugging
+ // something. That'd be somewhat inconvenient, and it's also inconsistent with
+ // most other flags -- we don't warn on -ffunction-sections not being used
+ // in -E mode either for example, even though it's not really used either.
+ if (!isa<AssembleJobAction>(JA)) {
+ ArgStringList DummyArgs;
+ CollectArgsForIntegratedAssembler(C, Args, DummyArgs, D);
+ }
+
if (isa<AnalyzeJobAction>(JA)) {
assert(JA.getType() == types::TY_Plist && "Invalid output type.");
CmdArgs.push_back("-analyze");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64527.209081.patch
Type: text/x-patch
Size: 1905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190710/5af56719/attachment-0001.bin>
More information about the cfe-commits
mailing list