Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/docs/UsersManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5146,6 +5146,7 @@ Execute ``clang-cl /?`` to see a list of supported options:
-v Show commands to run and use verbose output
-W<warning> Enable the specified warning
-Xclang <arg> Pass <arg> to the clang compiler
-Xclangas <arg> Pass <arg> to the clang assembler

The /clang: Option
^^^^^^^^^^^^^^^^^^
Expand Down
8 changes: 8 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -958,10 +958,18 @@ def Xclang : Separate<["-"], "Xclang">,
HelpText<"Pass <arg> to clang -cc1">, MetaVarName<"<arg>">,
Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption]>,
Group<CompileOnly_Group>;
def Xclangas : Separate<["-"], "Xclangas">,
HelpText<"Pass <arg> to clang -cc1as">, MetaVarName<"<arg>">,
Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption]>,
Group<CompileOnly_Group>;
def : Joined<["-"], "Xclang=">, Group<CompileOnly_Group>,
Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption]>,
Alias<Xclang>,
HelpText<"Alias for -Xclang">, MetaVarName<"<arg>">;
def : Joined<["-"], "Xclangas=">, Group<CompileOnly_Group>,
Flags<[NoXarchOption]>, Visibility<[ClangOption, CLOption, DXCOption]>,
Alias<Xclangas>,
HelpText<"Alias for -Xclangas">, MetaVarName<"<arg>">;
def Xcuda_fatbinary : Separate<["-"], "Xcuda-fatbinary">,
HelpText<"Pass <arg> to fatbinary invocation">, MetaVarName<"<arg>">;
def Xcuda_ptxas : Separate<["-"], "Xcuda-ptxas">,
Expand Down
6 changes: 6 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8895,6 +8895,12 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
CollectArgsForIntegratedAssembler(C, Args, CmdArgs,
getToolChain().getDriver());

// Forward -Xclangas arguments to -cc1as
for (auto Arg : Args.filtered(options::OPT_Xclangas)) {
Arg->claim();
CmdArgs.push_back(Arg->getValue());
}

Args.AddAllArgs(CmdArgs, options::OPT_mllvm);

if (DebugInfoKind > llvm::codegenoptions::NoDebugInfo && Output.isFilename())
Expand Down
4 changes: 4 additions & 0 deletions clang/test/Driver/Xclangas.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/// Check that -Xclangas/-Xclangas= are passed to -cc1as.
// RUN: %clang -### -Werror -Xclangas -target-feature -Xclangas=+v5t %s 2>&1 | FileCheck %s
// CHECK: -cc1as
// CHECK-SAME: "-target-feature" "+v5t"
Loading