[clang] Teach -fembed-bitcode option not to embed W_value Group

Summary:
-fembed-bitcode options doesn't embed warning options since they are
useless to code generation. Make sure it handles the W_value group and
not embed those options in the output.

Reviewers: zixuw, arphaman

Reviewed By: zixuw

Subscribers: jkorous, dexonsmith, ributzka, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D83813
This commit is contained in:
Steven Wu 2020-07-14 14:39:51 -07:00
parent 226866e115
commit 2b42080b51
2 changed files with 9 additions and 2 deletions

View file

@ -1086,8 +1086,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
A->getOption().getID() == options::OPT_INPUT ||
A->getOption().getID() == options::OPT_x ||
A->getOption().getID() == options::OPT_fembed_bitcode ||
(A->getOption().getGroup().isValid() &&
A->getOption().getGroup().getID() == options::OPT_W_Group))
A->getOption().matches(options::OPT_W_Group))
continue;
ArgStringList ASL;
A->render(Args, ASL);

View file

@ -37,6 +37,11 @@
; CHECK: @llvm.cmdline = private constant
; CHECK: section "__LLVM,__cmdline"
; check warning options are not embedded
; RUN: %clang_cc1 -triple thumbv7-apple-ios8.0.0 -emit-llvm \
; RUN: -fembed-bitcode=all -x ir %s -o - -Wall -Wundef-prefix=TEST \
; RUN: | FileCheck %s -check-prefix=CHECK-WARNING
; CHECK-ELF: @llvm.embedded.module
; CHECK-ELF: section ".llvmbc"
; CHECK-ELF: @llvm.cmdline
@ -54,6 +59,9 @@
; CHECK-MARKER: @llvm.cmdline
; CHECK-MARKER: section "__LLVM,__cmdline"
; CHECK-WARNING-NOT: Wall
; CHECK-WARNING-NOT: Wundef-prefix
define i32 @f0() {
ret i32 0
}