[clang] [clang][Sema] Move computing enum width and type to a separate function (PR #120965)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 13 10:16:16 PST 2025


================
@@ -20008,6 +20008,90 @@ bool Sema::IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
   return !(FlagMask & Val) || (AllowMask && !(FlagMask & ~Val));
 }
 
+bool Sema::ComputeBestEnumProperties(ASTContext &Context, bool isPacked,
+                                     unsigned NumNegativeBits,
+                                     unsigned NumPositiveBits,
+                                     QualType &BestType,
+                                     QualType &BestPromotionType) {
+  unsigned IntWidth = Context.getTargetInfo().getIntWidth();
----------------
Sirraide wrote:

Also, if we’re moving this into `ASTContext`, we should do a small cleanup pass while we’re at it and replace `Context.getTargetInfo().` w/ `Target->` in this function since we can just access it directly at that point.

https://github.com/llvm/llvm-project/pull/120965


More information about the cfe-commits mailing list