[clang] [ObjC] Emit number, array, and dictionary literals as constants (PR #185130)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 6 16:55:11 PST 2026
================
@@ -128,9 +137,21 @@ llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E,
if (!ALE)
DLE = cast<ObjCDictionaryLiteral>(E);
- // Optimize empty collections by referencing constants, when available.
- uint64_t NumElements =
- ALE ? ALE->getNumElements() : DLE->getNumElements();
+ // Decided in Sema if constant initializers are supported by the runtime and
+ // not disabled and the contents can be emitted as a constant NSNumber
+ // subclass; if so emit as a constant collection type
+ bool const CanBeExpressedAsConstant =
----------------
ojhunt wrote:
nit: `const bool` seems to be the ordering everywhere, so we should maintain that
https://github.com/llvm/llvm-project/pull/185130
More information about the cfe-commits
mailing list