Skip to content

Commit d0bb917

Browse files
committed
[clang][Interp] Handle ObjCBoxedExprs
1 parent 5220b7b commit d0bb917

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,6 +2649,14 @@ bool ByteCodeExprGen<Emitter>::VisitShuffleVectorExpr(
26492649
return true;
26502650
}
26512651

2652+
template <class Emitter>
2653+
bool ByteCodeExprGen<Emitter>::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
2654+
if (!E->isExpressibleAsConstantInitializer())
2655+
return this->emitInvalid(E);
2656+
2657+
return this->delegate(E->getSubExpr());
2658+
}
2659+
26522660
template <class Emitter> bool ByteCodeExprGen<Emitter>::discard(const Expr *E) {
26532661
OptionScope<Emitter> Scope(this, /*NewDiscardResult=*/true,
26542662
/*NewInitializing=*/false);

clang/lib/AST/Interp/ByteCodeExprGen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class ByteCodeExprGen : public ConstStmtVisitor<ByteCodeExprGen<Emitter>, bool>,
127127
bool VisitAddrLabelExpr(const AddrLabelExpr *E);
128128
bool VisitConvertVectorExpr(const ConvertVectorExpr *E);
129129
bool VisitShuffleVectorExpr(const ShuffleVectorExpr *E);
130+
bool VisitObjCBoxedExpr(const ObjCBoxedExpr *E);
130131

131132
protected:
132133
bool visitExpr(const Expr *E) override;

clang/test/AST/Interp/objc.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ @interface A {
1010
@interface NSString
1111
@end
1212
constexpr NSString *t0 = @"abc";
13+
constexpr NSString *t1 = @("abc");

0 commit comments

Comments
 (0)