[clang][Interp] Support ObjCEncodeExprs

This commit is contained in:
Timm Bäder
2024-06-11 13:25:02 +02:00
parent 32add2435f
commit e805b77107
3 changed files with 13 additions and 0 deletions

View File

@@ -1688,6 +1688,17 @@ bool ByteCodeExprGen<Emitter>::VisitObjCStringLiteral(
return this->delegate(E->getString());
}
template <class Emitter>
bool ByteCodeExprGen<Emitter>::VisitObjCEncodeExpr(const ObjCEncodeExpr *E) {
auto &A = Ctx.getASTContext();
std::string Str;
A.getObjCEncodingForType(E->getEncodedType(), Str);
StringLiteral *SL =
StringLiteral::Create(A, Str, StringLiteralKind::Ordinary,
/*Pascal=*/false, E->getType(), E->getAtLoc());
return this->delegate(SL);
}
template <class Emitter>
bool ByteCodeExprGen<Emitter>::VisitSYCLUniqueStableNameExpr(
const SYCLUniqueStableNameExpr *E) {

View File

@@ -91,6 +91,7 @@ public:
bool VisitAbstractConditionalOperator(const AbstractConditionalOperator *E);
bool VisitStringLiteral(const StringLiteral *E);
bool VisitObjCStringLiteral(const ObjCStringLiteral *E);
bool VisitObjCEncodeExpr(const ObjCEncodeExpr *E);
bool VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *E);
bool VisitCharacterLiteral(const CharacterLiteral *E);
bool VisitCompoundAssignOperator(const CompoundAssignOperator *E);

View File

@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o - %s -fexperimental-new-constant-interpreter | FileCheck %s
int main(void) {
int n;