Author: Timm Bäder Date: 2024-05-26T10:50:45+02:00 New Revision: d0bb91739022e1f15b1ec9a6fd7fc92cd0f95444
URL: https://github.com/llvm/llvm-project/commit/d0bb91739022e1f15b1ec9a6fd7fc92cd0f95444 DIFF: https://github.com/llvm/llvm-project/commit/d0bb91739022e1f15b1ec9a6fd7fc92cd0f95444.diff LOG: [clang][Interp] Handle ObjCBoxedExprs Added: Modified: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/test/AST/Interp/objc.mm Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index f00421d0c2ea9..7aa2105942ecb 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -2649,6 +2649,14 @@ bool ByteCodeExprGen<Emitter>::VisitShuffleVectorExpr( return true; } +template <class Emitter> +bool ByteCodeExprGen<Emitter>::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) { + if (!E->isExpressibleAsConstantInitializer()) + return this->emitInvalid(E); + + return this->delegate(E->getSubExpr()); +} + template <class Emitter> bool ByteCodeExprGen<Emitter>::discard(const Expr *E) { OptionScope<Emitter> Scope(this, /*NewDiscardResult=*/true, /*NewInitializing=*/false); diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h index c648b0e4be704..44c495240289f 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.h +++ b/clang/lib/AST/Interp/ByteCodeExprGen.h @@ -127,6 +127,7 @@ class ByteCodeExprGen : public ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>, bool VisitAddrLabelExpr(const AddrLabelExpr *E); bool VisitConvertVectorExpr(const ConvertVectorExpr *E); bool VisitShuffleVectorExpr(const ShuffleVectorExpr *E); + bool VisitObjCBoxedExpr(const ObjCBoxedExpr *E); protected: bool visitExpr(const Expr *E) override; diff --git a/clang/test/AST/Interp/objc.mm b/clang/test/AST/Interp/objc.mm index e48fa3c0ac709..6402c8ae098fd 100644 --- a/clang/test/AST/Interp/objc.mm +++ b/clang/test/AST/Interp/objc.mm @@ -10,3 +10,4 @@ @interface A { @interface NSString @end constexpr NSString *t0 = @"abc"; +constexpr NSString *t1 = @("abc"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits