From e2d3eb00ccd8bd789636464791f4acdd6e0c4583 Mon Sep 17 00:00:00 2001 From: Tatyana Krasnukha Date: Thu, 26 Dec 2019 15:48:50 +0300 Subject: [PATCH] [lldb] Specify unsigned underlying type for an enumeration explicitly The enumeration EntryType is used as a bit field of DebugMacroEntry: ``` EntryType m_type : 3 ``` Since underlying type of enumeration is implementation-dependent, a signed integer is converted to the 3-bit value by some compilers (MSVC). That's why a DebugMacroEntry instance that was created with EntryType value > 3 (END_FILE or INDIRECT) contains incorrect negative value in its m_type data-member. --- lldb/include/lldb/Symbol/DebugMacros.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/Symbol/DebugMacros.h b/lldb/include/lldb/Symbol/DebugMacros.h index d364299ef490..55e651961257 100644 --- a/lldb/include/lldb/Symbol/DebugMacros.h +++ b/lldb/include/lldb/Symbol/DebugMacros.h @@ -23,7 +23,9 @@ typedef std::shared_ptr DebugMacrosSP; class DebugMacroEntry { public: - enum EntryType { INVALID, DEFINE, UNDEF, START_FILE, END_FILE, INDIRECT }; + enum EntryType : uint32_t { + INVALID, DEFINE, UNDEF, START_FILE, END_FILE, INDIRECT + }; public: static DebugMacroEntry CreateDefineEntry(uint32_t line, const char *str);