|
10 | 10 | #ifndef LLDB_lldb_enumerations_h_
|
11 | 11 | #define LLDB_lldb_enumerations_h_
|
12 | 12 |
|
| 13 | +#include <type_traits> |
| 14 | + |
| 15 | +// Macro to enable bitmask operations on an enum. Without this, Enum | Enum |
| 16 | +// gets promoted to an int, so you have to say Enum a = Enum(eFoo | eBar). If |
| 17 | +// you mark Enum with LLDB_MARK_AS_BITMASK_ENUM(Enum), however, you can simply |
| 18 | +// write Enum a = eFoo | eBar. |
| 19 | +#define LLDB_MARK_AS_BITMASK_ENUM(Enum) \ |
| 20 | + inline Enum operator|(Enum a, Enum b) { \ |
| 21 | + return static_cast<Enum>( \ |
| 22 | + static_cast<std::underlying_type<Enum>::type>(a) | \ |
| 23 | + static_cast<std::underlying_type<Enum>::type>(b)); \ |
| 24 | + } \ |
| 25 | + inline Enum operator&(Enum a, Enum b) { \ |
| 26 | + return static_cast<Enum>( \ |
| 27 | + static_cast<std::underlying_type<Enum>::type>(a) & \ |
| 28 | + static_cast<std::underlying_type<Enum>::type>(b)); \ |
| 29 | + } \ |
| 30 | + inline Enum operator~(Enum a) { \ |
| 31 | + return static_cast<Enum>( \ |
| 32 | + ~static_cast<std::underlying_type<Enum>::type>(a)); \ |
| 33 | + } \ |
| 34 | + inline Enum &operator|=(Enum &a, Enum b) { \ |
| 35 | + a = a | b; \ |
| 36 | + return a; \ |
| 37 | + } \ |
| 38 | + inline Enum &operator&=(Enum &a, Enum b) { \ |
| 39 | + a = a & b; \ |
| 40 | + return a; \ |
| 41 | + } |
| 42 | + |
13 | 43 | #ifndef SWIG
|
14 | 44 | // With MSVC, the default type of an enum is always signed, even if one of the
|
15 | 45 | // enumerator values is too large to fit into a signed integer but would
|
@@ -327,39 +357,40 @@ enum InputReaderGranularity {
|
327 | 357 | //------------------------------------------------------------------
|
328 | 358 | FLAGS_ENUM(SymbolContextItem){
|
329 | 359 | eSymbolContextTarget = (1u << 0), ///< Set when \a target is requested from
|
330 |
| - ///a query, or was located in query |
331 |
| - ///results |
| 360 | + /// a query, or was located in query |
| 361 | + /// results |
332 | 362 | eSymbolContextModule = (1u << 1), ///< Set when \a module is requested from
|
333 |
| - ///a query, or was located in query |
334 |
| - ///results |
| 363 | + /// a query, or was located in query |
| 364 | + /// results |
335 | 365 | eSymbolContextCompUnit = (1u << 2), ///< Set when \a comp_unit is requested
|
336 |
| - ///from a query, or was located in query |
337 |
| - ///results |
| 366 | + /// from a query, or was located in |
| 367 | + /// query results |
338 | 368 | eSymbolContextFunction = (1u << 3), ///< Set when \a function is requested
|
339 |
| - ///from a query, or was located in query |
340 |
| - ///results |
| 369 | + /// from a query, or was located in |
| 370 | + /// query results |
341 | 371 | eSymbolContextBlock = (1u << 4), ///< Set when the deepest \a block is
|
342 |
| - ///requested from a query, or was located |
343 |
| - ///in query results |
| 372 | + /// requested from a query, or was located |
| 373 | + /// in query results |
344 | 374 | eSymbolContextLineEntry = (1u << 5), ///< Set when \a line_entry is
|
345 |
| - ///requested from a query, or was |
346 |
| - ///located in query results |
| 375 | + /// requested from a query, or was |
| 376 | + /// located in query results |
347 | 377 | eSymbolContextSymbol = (1u << 6), ///< Set when \a symbol is requested from
|
348 |
| - ///a query, or was located in query |
349 |
| - ///results |
| 378 | + /// a query, or was located in query |
| 379 | + /// results |
350 | 380 | eSymbolContextEverything = ((eSymbolContextSymbol << 1) -
|
351 | 381 | 1u), ///< Indicates to try and lookup everything
|
352 |
| - ///up during a routine symbol context |
353 |
| - ///query. |
354 |
| - eSymbolContextVariable = (1u << 7) ///< Set when \a global or static |
355 |
| - ///variable is requested from a query, or |
356 |
| - ///was located in query results. |
| 382 | + /// up during a routine symbol context |
| 383 | + /// query. |
| 384 | + eSymbolContextVariable = (1u << 7), ///< Set when \a global or static |
| 385 | + /// variable is requested from a query, |
| 386 | + /// or was located in query results. |
357 | 387 | ///< eSymbolContextVariable is potentially expensive to lookup so it isn't
|
358 |
| - ///included in |
| 388 | + /// included in |
359 | 389 | ///< eSymbolContextEverything which stops it from being used during frame PC
|
360 |
| - ///lookups and |
| 390 | + /// lookups and |
361 | 391 | ///< many other potential address to symbol context lookups.
|
362 | 392 | };
|
| 393 | +LLDB_MARK_AS_BITMASK_ENUM(SymbolContextItem) |
363 | 394 |
|
364 | 395 | FLAGS_ENUM(Permissions){ePermissionsWritable = (1u << 0),
|
365 | 396 | ePermissionsReadable = (1u << 1),
|
@@ -1086,7 +1117,6 @@ enum TypeSummaryCapping {
|
1086 | 1117 | eTypeSummaryCapped = true,
|
1087 | 1118 | eTypeSummaryUncapped = false
|
1088 | 1119 | };
|
1089 |
| - |
1090 | 1120 | } // namespace lldb
|
1091 | 1121 |
|
1092 | 1122 | #endif // LLDB_lldb_enumerations_h_
|
0 commit comments