================
@@ -2367,11 +2369,36 @@ size_t DWARFASTParserClang::ParseChildEnumerators(
     }
 
     if (name && name[0] && got_value) {
-      m_ast.AddEnumerationValueToEnumerationType(
+      auto ECD = m_ast.AddEnumerationValueToEnumerationType(
----------------
Michael137 wrote:

I do think you can move the iteration into a helper function on clang 
ASTContext. It would look something like this:
```
// In ASTContext class
template<typename RangeT>                                                  
bool computeEnumBits(unsigned &NumNegativeBits, unsigned &NumPositiveBits, 
                     RangeT Elements);
```
Then in `SemaDecl.cpp` you would call it as follows:
```
unsigned NumNegativeBits;                                                       
                     
unsigned NumPositiveBits;                                                       
                     
bool MembersRepresentableByInt =
    Context.computeEnumBits(NumNegativeBits, NumPositiveBits, Elements);
```
And in LLDB in `CompleteTagDeclarationDefinition`, you would call it like so:
```
ast.computeEnumBits(NumNegativeBits, NumPositiveBits, enum_decl->enumerators());
                                                                                
enum_decl->completeDefinition(enum_decl->getIntegerType(),                      
                              promotion_qual_type, NumPositiveBits,             
                              NumNegativeBits);                                 
```

Wdyt? And please do the Clang-side changes in a separate NFC PR

https://github.com/llvm/llvm-project/pull/115005
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to