diff options
author | Jooyung Han <jooyung@google.com> | 2021-11-17 01:41:11 +0900 |
---|---|---|
committer | Jooyung Han <jooyung@google.com> | 2021-11-17 23:59:28 +0000 |
commit | 97be5845253b8a16d3448bd8cad2dd23b156732c (patch) | |
tree | 633478897d5b5955ee255f30cbe7587a50127fea /aidl_language.cpp | |
parent | 87c92e71f5edacb6c4424141d361f8d96e4ad440 (diff) | |
download | aidl-97be5845253b8a16d3448bd8cad2dd23b156732c.tar.gz |
Add @FixedSize union
@FixedSize union uses a custom implementation rather than std::variant
so that its value can have a stable/fixed layout and be passed via FMQ.
A custom implementation relies on the fact that @FixedSize
union/parcelable should have "trivially copyable" fields. So we can't
use it for union in general.
It would be nice if we could replace std::variant with it and have the
same implementation for union types. Maybe in the future.
Bug: 206496560
Test: golden_test.sh check
Test: aidl_integration_test (no regression)
atest fmq_test fmq_unit_test
Change-Id: I86351ecb1990818d0fe2faaad7c4b8c2c33881b5
Diffstat (limited to 'aidl_language.cpp')
-rw-r--r-- | aidl_language.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/aidl_language.cpp b/aidl_language.cpp index b56e7ac5..e92086ae 100644 --- a/aidl_language.cpp +++ b/aidl_language.cpp @@ -160,7 +160,10 @@ const std::vector<AidlAnnotation::Schema>& AidlAnnotation::AllSchemas() { CONTEXT_TYPE_STRUCTURED_PARCELABLE | CONTEXT_TYPE_UNION | CONTEXT_TYPE_UNSTRUCTURED_PARCELABLE, {}}, - {AidlAnnotation::Type::FIXED_SIZE, "FixedSize", CONTEXT_TYPE_STRUCTURED_PARCELABLE, {}}, + {AidlAnnotation::Type::FIXED_SIZE, + "FixedSize", + CONTEXT_TYPE_STRUCTURED_PARCELABLE | CONTEXT_TYPE_UNION, + {}}, {AidlAnnotation::Type::DESCRIPTOR, "Descriptor", CONTEXT_TYPE_INTERFACE, |