diff options
author | Jooyung Han <jooyung@google.com> | 2021-12-06 10:24:28 +0900 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-12-15 00:03:49 +0000 |
commit | dd0d78f0ead984881caee291751226001f92587e (patch) | |
tree | 29a08c6dd02a91f2f92381a1cf9799cf5144436b /aidl_language_y.yy | |
parent | da7f6052bfd5d9d8778ad28ae923a8317f114a97 (diff) | |
download | aidl-dd0d78f0ead984881caee291751226001f92587e.tar.gz |
Revert "Revert "Add automatic default value for char-type field""
This reverts commit ac1cb3eb26525c868fd7dfeba90b6ee85161c9d8.
Original commit message:
Add automatic default value for char-type field
char type fields are auto-initialized with '\0' when not specified.
Ignore-AOSP-First: security fix
Bug: 206718630
Test: aidl_unittests
Reason for re-submit:
Conflicts resolved in the downstream branches.
Merged-In: I0001331785c0f11e6a1ebab7fef10e690392d417
Merged-In: I69d049f38a71a2c052fc8a7b098dc8525c940505
Change-Id: Ib0ce80da13419192ec8aada05445f2fb2ba5d6ea
(cherry picked from commit 6466daabe5cadd58674ea2c96b7f92255834dc42)
Merged-In:Ib0ce80da13419192ec8aada05445f2fb2ba5d6ea
Diffstat (limited to 'aidl_language_y.yy')
-rw-r--r-- | aidl_language_y.yy | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/aidl_language_y.yy b/aidl_language_y.yy index ab3e4799..079bda67 100644 --- a/aidl_language_y.yy +++ b/aidl_language_y.yy @@ -96,7 +96,6 @@ AidlLocation loc(const yy::parser::location_type& l) { std::vector<std::unique_ptr<AidlDefinedType>>* declarations; } -%destructor { } <character> %destructor { } <direction> %destructor { delete ($$); } <*> @@ -112,7 +111,7 @@ AidlLocation loc(const yy::parser::location_type& l) { %token<token> UNION "union" %token<token> CONST "const" -%token<character> CHARVALUE "char literal" +%token<token> CHARVALUE "char literal" %token<token> FLOATVALUE "float literal" %token<token> HEXVALUE "hex literal" %token<token> INTVALUE "int literal" @@ -395,7 +394,10 @@ interface_members const_expr : TRUE_LITERAL { $$ = AidlConstantValue::Boolean(loc(@1), true); } | FALSE_LITERAL { $$ = AidlConstantValue::Boolean(loc(@1), false); } - | CHARVALUE { $$ = AidlConstantValue::Character(loc(@1), $1); } + | CHARVALUE { + $$ = AidlConstantValue::Character(loc(@1), $1->GetText()); + delete $1; + } | INTVALUE { $$ = AidlConstantValue::Integral(loc(@1), $1->GetText()); if ($$ == nullptr) { |