[PATCH] D140001: [Driver] [C++20] [Modules] Don't emit unused-argument warning for ` -fmodule-output=` and `-fmodule-output`

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 15 22:09:15 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfcb6afb508c4: [Driver] [C++20] [Modules] Don't emit unused-argument warning for '-fmodule… (authored by ChuanqiXu).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D140001?vs=482763&id=489428#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140001

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/module-output.cppm


Index: clang/test/Driver/module-output.cppm
===================================================================
--- clang/test/Driver/module-output.cppm
+++ clang/test/Driver/module-output.cppm
@@ -27,6 +27,9 @@
 // in the comamnd line.
 // RUN: %clang -std=c++20 %t/Hello.cppm -fmodule-output=%t/pcm/Hello.pcm -o %t/Hello.o \
 // RUN:   -c -### 2>&1 | FileCheck %t/Hello.cppm --check-prefix=CHECK-SPECIFIED
+//
+// RUN: %clang -std=c++20 %t/Hello.cppm -fmodule-output=%t/Hello.pcm -fmodule-output -c -fsyntax-only \
+// RUN:   -### 2>&1 | FileCheck %t/Hello.cppm --check-prefix=CHECK-NOT-USED
 
 //--- Hello.cppm
 export module Hello;
@@ -39,6 +42,11 @@
 // CHECK-SPECIFIED: "-emit-module-interface" {{.*}}"-main-file-name" "Hello.cppm" {{.*}}"-o" "{{.*}}/pcm/Hello.pcm" "-x" "c++" "{{.*}}/Hello.cppm"
 // CHECK-SPECIFIED: "-emit-obj" {{.*}}"-main-file-name" "Hello.cppm" {{.*}}"-o" "{{.*}}/Hello.o" "-x" "pcm" "{{.*}}/pcm/Hello.pcm"
 
+// CHECK-NOT-USED-NOT: warning: argument unused during compilation: '-fmodule-output'
+// CHECK-NOT-USED-NOT: warning: argument unused during compilation: '-fmodule-output=Hello.pcm'
+// CHECK-NOT-USED-NOT: "-fmodule-output"
+// CHECK-NOT-USED-NOT: "-fmodule-output="
+
 //--- AnotherModule.cppm
 export module AnotherModule;
 // CHECK: "-emit-module-interface" {{.*}}"-main-file-name" "Hello.cppm" {{.*}}"-o" "{{.*}}/Hello.pcm" "-x" "c++" "{{.*}}/Hello.cppm"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3798,6 +3798,10 @@
     Args.ClaimAllArgs(options::OPT_fmodules_disable_diagnostic_validation);
   }
 
+  // Claim `-fmodule-output` and `-fmodule-output=` to avoid unused warnings.
+  Args.ClaimAllArgs(options::OPT_fmodule_output);
+  Args.ClaimAllArgs(options::OPT_fmodule_output_EQ);
+
   return HaveModules;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140001.489428.patch
Type: text/x-patch
Size: 1916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230116/b6480437/attachment-0001.bin>


More information about the cfe-commits mailing list