File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1096,9 +1096,9 @@ template <class Emitter>
1096
1096
bool ByteCodeExprGen<Emitter>::VisitUnaryExprOrTypeTraitExpr(
1097
1097
const UnaryExprOrTypeTraitExpr *E) {
1098
1098
UnaryExprOrTypeTrait Kind = E->getKind ();
1099
- ASTContext &ASTCtx = Ctx.getASTContext ();
1099
+ const ASTContext &ASTCtx = Ctx.getASTContext ();
1100
1100
1101
- if (Kind == UETT_SizeOf) {
1101
+ if (Kind == UETT_SizeOf || Kind == UETT_DataSizeOf ) {
1102
1102
QualType ArgType = E->getTypeOfArgument ();
1103
1103
1104
1104
// C++ [expr.sizeof]p2: "When applied to a reference or a reference type,
@@ -1113,7 +1113,10 @@ bool ByteCodeExprGen<Emitter>::VisitUnaryExprOrTypeTraitExpr(
1113
1113
if (ArgType->isDependentType () || !ArgType->isConstantSizeType ())
1114
1114
return false ;
1115
1115
1116
- Size = ASTCtx.getTypeSizeInChars (ArgType);
1116
+ if (Kind == UETT_SizeOf)
1117
+ Size = ASTCtx.getTypeSizeInChars (ArgType);
1118
+ else
1119
+ Size = ASTCtx.getTypeInfoDataSizeInChars (ArgType).Width ;
1117
1120
}
1118
1121
1119
1122
if (DiscardResult)
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-linux-gnu -verify %s
2
+ // RUN: %clang_cc1 -fsyntax-only -triple x86_64-linux-gnu -verify %s -fexperimental-new-constant-interpreter
2
3
3
4
#if !__has_extension(datasizeof)
4
5
# error "Expected datasizeof extension"
You can’t perform that action at this time.
0 commit comments