[PATCH] D83813: [clang] Teach -fembed-bitcode option not to embed W_value Group
Steven Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 14 14:04:04 PDT 2020
steven_wu created this revision.
steven_wu added reviewers: zixuw, arphaman.
Herald added subscribers: ributzka, dexonsmith, jkorous.
Herald added a project: clang.
-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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83813
Files:
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Frontend/embed-bitcode.ll
Index: clang/test/Frontend/embed-bitcode.ll
===================================================================
--- clang/test/Frontend/embed-bitcode.ll
+++ clang/test/Frontend/embed-bitcode.ll
@@ -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
}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1087,7 +1087,9 @@
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().getGroup().getID() == options::OPT_W_Group) ||
+ (A->getOption().getGroup().isValid() &&
+ A->getOption().getGroup().getID() == options::OPT_W_value_Group))
continue;
ArgStringList ASL;
A->render(Args, ASL);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83813.277968.patch
Type: text/x-patch
Size: 1575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200714/a0c32161/attachment-0001.bin>
More information about the cfe-commits
mailing list