[PATCH] D70839: [clang][IFS] Claiming -emit-merged-ifs in clang driver when -c is used.

Puyan Lotfi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 28 23:58:55 PST 2019


plotfi created this revision.
plotfi added a reviewer: compnerd.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Sometimes it is difficult to tell when you want your compile flags to be invoked with -emit-interface-stubs -c or with -emit-interface-stubs -emit-merged-ifs. On -Werror builds -emit-interface-stubs -emit-merged-ifs -c causes build errors. I think for now we can claim -emit-merged-ifs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70839

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/InterfaceStubs/warnings.c


Index: clang/test/InterfaceStubs/warnings.c
===================================================================
--- /dev/null
+++ clang/test/InterfaceStubs/warnings.c
@@ -0,0 +1,3 @@
+// RUN: %clang -emit-interface-stubs -emit-merged-ifs -c %s -o - 2>&1 | FileCheck %s
+// CHECK-NOT: warning: argument unused during compilation: '-emit-merged-ifs'
+int main() {}
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -3501,6 +3501,11 @@
   if (Args.hasArg(options::OPT_emit_interface_stubs)) {
     llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> PhaseList;
     if (Args.hasArg(options::OPT_c)) {
+      // Claim -emit-merged-ifs if we aren't going to invoke llvm-ifs.
+      // The intention of -emit-merged-ifs is to force llvm-ifs to generate text
+      // instead of a ifso. Perhaps this should be inverted.
+      if (Args.hasArg(options::OPT_emit_merged_ifs))
+        Args.ClaimAllArgs(options::OPT_emit_merged_ifs);
       llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases> CompilePhaseList;
       types::getCompilationPhases(types::TY_IFS_CPP, CompilePhaseList);
       llvm::copy_if(CompilePhaseList, std::back_inserter(PhaseList),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70839.231481.patch
Type: text/x-patch
Size: 1276 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191129/87e56942/attachment.bin>


More information about the cfe-commits mailing list