]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: add operator| for WMB_Flags
authorJason Merrill <jason@redhat.com>
Sat, 24 May 2025 18:41:43 +0000 (14:41 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 3 Jun 2025 14:18:18 +0000 (10:18 -0400)
There are a lot of uses of | on WMB_Flags, that currently need to then be
cast back to WMB_Flags.  Let's avoid the need for that.

gcc/cp/ChangeLog:

* name-lookup.h (operator|, operator|=): Define for WMB_Flags.

gcc/cp/name-lookup.h

index 4216a515afad6d4f74db62f5c1e91d518be465ac..2fa736bd04695b900b9bf8ec220418da774877a8 100644 (file)
@@ -501,6 +501,10 @@ enum WMB_Flags
   WMB_Hidden = 1 << 3,
   WMB_Purview = 1 << 4,
 };
+inline WMB_Flags operator|(WMB_Flags x, WMB_Flags y)
+{ return WMB_Flags(+x|y); }
+inline WMB_Flags& operator|=(WMB_Flags& x, WMB_Flags y)
+{ return x = x|y; }
 
 extern unsigned walk_module_binding (tree binding, bitmap partitions,
                                     bool (*)(tree decl, WMB_Flags, void *data),