Skip to content

Commit eb882a4

Browse files
committed
Clarify comment
1 parent c79f5a6 commit eb882a4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,17 +1331,18 @@ CodeGenFunction::emitCountedByMemberSize(const Expr *E, llvm::Value *EmittedE,
13311331
// From option (4):
13321332
// size_t field_base_size = sizeof (*ptr->field_array);
13331333
if (!FieldTy->isArrayType())
1334-
// The field isn't an array. For example:
1334+
// The field isn't an array. It could be a pointer, for example:
13351335
//
13361336
// struct {
13371337
// int count;
13381338
// char *string;
13391339
// int array[] __counted_by(count);
13401340
// } x;
13411341
//
1342-
// __builtin_dynamic_object_size(x.string[42], 0);
1342+
// __builtin_dynamic_object_size(&x.string[42], 0);
13431343
//
1344-
// If built with '-Wno-int-conversion', FieldTy won't be an array here.
1344+
// This __bdos isn't wanting the size of the struct, but the size of
1345+
// 'string's allocation, which __bdos isn't currently able to provide.
13451346
return nullptr;
13461347

13471348
const ArrayType *ArrayTy = Ctx.getAsArrayType(FieldTy);

0 commit comments

Comments
 (0)