[Lldb-commits] [lldb] r349153 - Fix build with older (<3.0) swigs

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 14 06:25:21 PST 2018


Author: labath
Date: Fri Dec 14 06:25:20 2018
New Revision: 349153

URL: http://llvm.org/viewvc/llvm-project?rev=349153&view=rev
Log:
Fix build with older (<3.0) swigs

It turns out it wasn't the compilers, but swig who had issues with my
previous patch -- older versions do not recognise the "constexpr"
keyword.

Fortunately, that can be fixed the same way we fix all other swig
incompatibilities: #ifndef SWIG.

Modified:
    lldb/trunk/include/lldb/lldb-enumerations.h

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=349153&r1=349152&r2=349153&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Fri Dec 14 06:25:20 2018
@@ -12,10 +12,13 @@
 
 #include <type_traits>
 
+#ifndef SWIG
 // Macro to enable bitmask operations on an enum.  Without this, Enum | Enum
 // gets promoted to an int, so you have to say Enum a = Enum(eFoo | eBar).  If
 // you mark Enum with LLDB_MARK_AS_BITMASK_ENUM(Enum), however, you can simply
 // write Enum a = eFoo | eBar.
+// Unfortunately, swig<3.0 doesn't recognise the constexpr keyword, so remove
+// this entire block, as it is not necessary for swig processing.
 #define LLDB_MARK_AS_BITMASK_ENUM(Enum)                                        \
   constexpr Enum operator|(Enum a, Enum b) {                                   \
     return static_cast<Enum>(                                                  \
@@ -39,6 +42,9 @@
     a = a & b;                                                                 \
     return a;                                                                  \
   }
+#else
+#define LLDB_MARK_AS_BITMASK_ENUM(Enum)
+#endif
 
 #ifndef SWIG
 // With MSVC, the default type of an enum is always signed, even if one of the




More information about the lldb-commits mailing list