Skip to content

Commit

Permalink
Add support to -Wa,--version in clang
Browse files Browse the repository at this point in the history
Clang currently only supports -Wa,--version when -no-integrated-as is
used. This adds support to -Wa,--version with -integrated-as.

Link:
ClangBuiltLinux/linux#1320

Reviewed By: nickdesaulniers, MaskRay

Differential Revision: https://reviews.llvm.org/D99556
  • Loading branch information
jcai19 committed Mar 31, 2021
1 parent 115a42a commit 3cc3c0f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2549,6 +2549,8 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
// -fdebug-compilation-dir (without '=') here.
CmdArgs.push_back("-fdebug-compilation-dir");
CmdArgs.push_back(Value.data());
} else if (Value == "--version") {
D.PrintVersion(C, llvm::outs());
} else {
D.Diag(diag::err_drv_unsupported_option_argument)
<< A->getOption().getName() << Value;
Expand Down
9 changes: 9 additions & 0 deletions clang/test/Driver/as-version.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Test version information.

// RUN: %clang -Wa,--version -c -fintegrated-as %s -o /dev/null \
// RUN: | FileCheck --check-prefix=IAS %s
// IAS: clang version

// RUN: %clang -Wa,--version -c -fno-integrated-as %s -o /dev/null \
// RUN: | FileCheck --check-prefix=GAS %s
// GAS-NOT: clang

0 comments on commit 3cc3c0f

Please sign in to comment.