[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:20:06 PDT 2020


steven_wu updated this revision to Diff 277975.
steven_wu added a comment.

Use `Option::match` instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83813/new/

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
@@ -1086,8 +1086,7 @@
           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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83813.277975.patch
Type: text/x-patch
Size: 1488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200714/a9e91835/attachment-0001.bin>


More information about the cfe-commits mailing list