Commit 2b42080b authored by Steven Wu's avatar Steven Wu
Browse files

[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
parent 226866e1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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);
+8 −0
Original line number Diff line number Diff line
@@ -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
}