[Lldb-commits] [lldb] r374095 - Fix sign extension handling in DumpEnumValue

Frederic Riss via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 8 10:59:02 PDT 2019


Author: friss
Date: Tue Oct  8 10:59:02 2019
New Revision: 374095

URL: http://llvm.org/viewvc/llvm-project?rev=374095&view=rev
Log:
Fix sign extension handling in DumpEnumValue

When an enumerator has an unsigned type and its high bit set, the
code introduced in r374067 would fail to match it due to a sign
extension snafu. This commit fixes this aspec of the code and should
fix the bots.

I think it's not a complete fix though, I'll add more test coverage
and additional tweaks in a follow-up commit.

Modified:
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=374095&r1=374094&r2=374095&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Oct  8 10:59:02 2019
@@ -9374,6 +9374,7 @@ static bool DumpEnumValue(const clang::Q
   // flags.
   for (auto enumerator : enum_decl->enumerators()) {
     uint64_t val = enumerator->getInitVal().getSExtValue();
+    val = llvm::SignExtend64(val, 8*byte_size);
     if (llvm::countPopulation(val) != 1 && (val & ~covered_bits) != 0)
       can_be_bitfield = false;
     covered_bits |= val;




More information about the lldb-commits mailing list