modimo created this revision.
Herald added subscribers: jeroen.dobbelaere, hoy, wenlei, lxfind, dang.
modimo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114130

Files:
  clang/include/clang/Driver/Options.td
  clang/test/CodeGenCXX/constructor-alias.cpp


Index: clang/test/CodeGenCXX/constructor-alias.cpp
===================================================================
--- clang/test/CodeGenCXX/constructor-alias.cpp
+++ clang/test/CodeGenCXX/constructor-alias.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm -triple mipsel--linux-gnu -mconstructor-aliases 
-o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple mipsel--linux-gnu 
-mno-constructor-aliases -mconstructor-aliases -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple mipsel--linux-gnu -mconstructor-aliases 
-mno-constructor-aliases -o - %s | FileCheck %s --check-prefix=NO-ALIAS
 
 // The target attribute code used to get confused with aliases. Make sure
 // we don't crash when an alias is used.
@@ -10,3 +11,4 @@
 }
 
 // CHECK: @_ZN1BC1Ev ={{.*}} unnamed_addr alias void (%struct.B*), void 
(%struct.B*)* @_ZN1BC2Ev
+// NO-ALIAS-NOT: @_ZN1BC1Ev ={{.*}} unnamed_addr alias void (%struct.B*), void 
(%struct.B*)* @_ZN1BC2Ev
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5054,9 +5054,12 @@
 def funwind_tables_EQ : Joined<["-"], "funwind-tables=">,
   HelpText<"Generate unwinding tables for all functions">,
   MarshallingInfoInt<CodeGenOpts<"UnwindTables">>;
-def mconstructor_aliases : Flag<["-"], "mconstructor-aliases">,
-  HelpText<"Emit complete constructors and destructors as aliases when 
possible">,
-  MarshallingInfoFlag<CodeGenOpts<"CXXCtorDtorAliases">>;
+defm constructor_aliases : BoolOption<"m", "constructor-aliases",
+  CodeGenOpts<"CXXCtorDtorAliases">,
+  DefaultFalse,
+  PosFlag<SetTrue, [], "Enable">,
+  NegFlag<SetFalse, [], "Disable">,
+  BothFlags<[CC1Option], " emitting complete constructors and destructors as 
aliases when possible">>;
 def mlink_bitcode_file : Separate<["-"], "mlink-bitcode-file">,
   HelpText<"Link the given bitcode file before performing optimizations.">;
 def mlink_builtin_bitcode : Separate<["-"], "mlink-builtin-bitcode">,


Index: clang/test/CodeGenCXX/constructor-alias.cpp
===================================================================
--- clang/test/CodeGenCXX/constructor-alias.cpp
+++ clang/test/CodeGenCXX/constructor-alias.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm -triple mipsel--linux-gnu -mconstructor-aliases -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple mipsel--linux-gnu -mno-constructor-aliases -mconstructor-aliases -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -triple mipsel--linux-gnu -mconstructor-aliases -mno-constructor-aliases -o - %s | FileCheck %s --check-prefix=NO-ALIAS
 
 // The target attribute code used to get confused with aliases. Make sure
 // we don't crash when an alias is used.
@@ -10,3 +11,4 @@
 }
 
 // CHECK: @_ZN1BC1Ev ={{.*}} unnamed_addr alias void (%struct.B*), void (%struct.B*)* @_ZN1BC2Ev
+// NO-ALIAS-NOT: @_ZN1BC1Ev ={{.*}} unnamed_addr alias void (%struct.B*), void (%struct.B*)* @_ZN1BC2Ev
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5054,9 +5054,12 @@
 def funwind_tables_EQ : Joined<["-"], "funwind-tables=">,
   HelpText<"Generate unwinding tables for all functions">,
   MarshallingInfoInt<CodeGenOpts<"UnwindTables">>;
-def mconstructor_aliases : Flag<["-"], "mconstructor-aliases">,
-  HelpText<"Emit complete constructors and destructors as aliases when possible">,
-  MarshallingInfoFlag<CodeGenOpts<"CXXCtorDtorAliases">>;
+defm constructor_aliases : BoolOption<"m", "constructor-aliases",
+  CodeGenOpts<"CXXCtorDtorAliases">,
+  DefaultFalse,
+  PosFlag<SetTrue, [], "Enable">,
+  NegFlag<SetFalse, [], "Disable">,
+  BothFlags<[CC1Option], " emitting complete constructors and destructors as aliases when possible">>;
 def mlink_bitcode_file : Separate<["-"], "mlink-bitcode-file">,
   HelpText<"Link the given bitcode file before performing optimizations.">;
 def mlink_builtin_bitcode : Separate<["-"], "mlink-builtin-bitcode">,
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to