[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
================
@@ -188,26 +209,26 @@ class ObjCBoxedExpr : public Expr {
/// ObjCArrayLiteral - used for objective-c array containers; as in:
/// @[@"Hello", NSApp, [NSNumber numberWithInt:42]];
class ObjCArrayLiteral final
- : public Expr,
+ : public ObjCObjectLiteral,
private llvm::TrailingObjects<ObjCArrayLiteral, Expr *> {
unsigned NumElements;
SourceRange Range;
ObjCMethodDecl *ArrayWithObjectsMethod;
- ObjCArrayLiteral(ArrayRef<Expr *> Elements,
- QualType T, ObjCMethodDecl * Method,
- SourceRange SR);
+ ObjCArrayLiteral(ArrayRef<Expr *> Elements, QualType T,
+ ObjCMethodDecl *Method, bool ECI, SourceRange SR);
explicit ObjCArrayLiteral(EmptyShell Empty, unsigned NumElements)
- : Expr(ObjCArrayLiteralClass, Empty), NumElements(NumElements) {}
+ : ObjCObjectLiteral(ObjCArrayLiteralClass, Empty),
+ NumElements(NumElements) {}
public:
friend class ASTStmtReader;
friend TrailingObjects;
static ObjCArrayLiteral *Create(const ASTContext &C,
- ArrayRef<Expr *> Elements,
- QualType T, ObjCMethodDecl * Method,
+ ArrayRef<Expr *> Elements, QualType T,
+ ObjCMethodDecl *Method, bool ECI,
----------------
ojhunt wrote:
I'm wondering whether maintaining ECI in the constructors is reasonable if they're spelled out in the Create methods? I think I'd be ok with that.
https://github.com/llvm/llvm-project/pull/185130
More information about the cfe-commits
mailing list