Commit 4b7f6029 authored by Seth Brenith's avatar Seth Brenith Committed by Commit Bot

[torque] Don't emit accessors for indexed fields

I noticed that SeqOneByteString and SeqTwoByteString have generated
functions to get and set their "chars" field which just get or set the
first character in the array. That's unhelpful and potentially
dangerous, so we shouldn't emit these functions.

Change-Id: Iff328fc744e5bd3e70536619d5928df6d959f12f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1890540Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#64693}
parent 05569df6
......@@ -3166,7 +3166,7 @@ void CppClassGenerator::GenerateClassConstructors() {
// TODO(sigurds): Keep in sync with DECL_ACCESSORS and ACCESSORS macro.
void CppClassGenerator::GenerateFieldAccessor(const Field& f) {
const Type* field_type = f.name_and_type.type;
if (field_type == TypeOracle::GetVoidType()) return;
if (field_type == TypeOracle::GetVoidType() || f.index.has_value()) return;
if (!f.name_and_type.type->IsSubtypeOf(TypeOracle::GetTaggedType())) {
return GenerateFieldAccessorForUntagged(f);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment