Allows structs to be stored directly as member variables.

Introduce a "native_inline" attribute that can be applied on fields that are structs.
This results in NativeTable code generation that sets the struct "inline" rather than
storing it in a pointer.

From cl/140527470.

Change-Id: I208724f552b8b921b20923e0bf82f42cb3582416
This commit is contained in:
Wouter van Oortmerssen
2016-12-02 14:25:08 -08:00
parent d342918790
commit 641b397f8b
4 changed files with 34 additions and 9 deletions

View File

@@ -234,6 +234,8 @@ struct FieldDef : public Definition {
// written in new data nor accessed in new code.
bool required; // Field must always be present.
bool key; // Field functions as a key for creating sorted vectors.
bool native_inline; // Field will be defined inline (instead of as a pointer)
// for native tables if field is a struct.
size_t padding; // Bytes to always pad after this field.
};
@@ -454,6 +456,7 @@ class Parser : public ParserState {
known_attributes_["idempotent"] = true;
known_attributes_["cpp_type"] = true;
known_attributes_["cpp_ptr_type"] = true;
known_attributes_["native_inline"] = true;
}
~Parser() {