diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -3552,7 +3552,7 @@ // 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(JA)) { + if (!isa(JA) && TC.useIntegratedAs()) { ArgStringList DummyArgs; CollectArgsForIntegratedAssembler(C, Args, DummyArgs, D); } diff --git a/clang/test/Driver/as-options.s b/clang/test/Driver/as-options.s --- a/clang/test/Driver/as-options.s +++ b/clang/test/Driver/as-options.s @@ -58,3 +58,10 @@ // RUN: -o /dev/null -x assembler-with-cpp %s 2>&1 \ // RUN: | FileCheck --check-prefix=WARN --allow-empty %s // WARN-NOT: unused + +// Test that unsupported arguments do not cause errors when -no-integrated-as +// is set. +// RUN: %clang -Wa,-mno-warn-deprecated -no-integrated-as %s -S \ +// RUN: -Wno-unused-command-line-argument 2>&1 \ +// RUN: | FileCheck --check-prefix=NOERROR --allow-empty %s +// NOERROR-NOT: error: unsupported argument '-mno-warn-deprecated' to option 'Wa,'