[clang] [clang][Sema] Move computing enum width and type to a separate function (PR #120965)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 23 09:38:12 PST 2024
================
@@ -20008,6 +20008,87 @@ bool Sema::IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
return !(FlagMask & Val) || (AllowMask && !(FlagMask & ~Val));
}
+bool Sema::ComputeBestEnumProperties(ASTContext &Context, EnumDecl *Enum,
+ bool is_cpp, bool isPacked,
----------------
Fznamznon wrote:
Unless I'm missing something, `Enum` parameter is actually unused.
Also, `is_cpp` can be queried from `ASTContext`, via `Context.getLangOpts().CPlusPlus`.
`Context` parameter is not required, since it can be queried from `Sema` itself via simply using `Context`.
I would expect that `BestWidth` is width of the `BestType`, right? It probably can be simply queried via `ASTContext::getIntWidth(BestType)` instead of passing to/from a function.
https://github.com/llvm/llvm-project/pull/120965
More information about the cfe-commits
mailing list