History log of /system/tools/hidl/EnumType.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e45b5303e072043679483a70606f6c00dde17382 22-Feb-2017 Yifan Hong <elsk@google.com> Add toString to Java code

* toString is mainly for debugging purposes.
* For structs and interfaces, add Object.toString.
* For enums, add MyEnum.toString(int) and MyEnum.dumpBitfield(int).

Use them as follows:
* For enums, use the static method E.toString(int).
* For bitfields, use the static method E.dumpBitfield(int).
* For all arrays, use java.utils.Arrays.deepToString(o)
* For everything else, use one of the following:
* o.toString(), if o is not null
* Object.toString(o)
* String.valueOf(o)
* Note that for array / vec of enums / bitfields, the raw integer
value is dumped.

Bug: 33459772
Test: hidl_test_java

Change-Id: Ifb1ed519770b907e0a4e345b2c3109dc322a23b2
/system/tools/hidl/EnumType.h
7d1839fe75d3ddc13321ee176ba73b610d884bee 22-Feb-2017 Yifan Hong <elsk@google.com> Fix Java .equals has a wrong signature for generated HIDL types.

Bug: 32834072
Test: hidl_test_java
Change-Id: I1a41c1d9d9daa3ac7f993fbf01c99a013de42b3f
/system/tools/hidl/EnumType.h
132362395dbc1ec52a70a5a4587ce1dd7616a8da 24-Jan-2017 Zhuoyao Zhang <zhuoyao@google.com> Fix hidl-gen for generating bitfield type in vts file.

* bitfield is resolved to scalar type in generated c++ code, generate
the corresponding scalar type in vts file so vtsc could generate
driver with the correct type.
* bitfield is a not a UDT, no need to generate the vts type declaration.

Test: make hidl-gen
make vts

Change-Id: I5cd3d6cd3b7c26011108bbfa8a9cf39279964ee8
/system/tools/hidl/EnumType.h
f5cc2f74e86504f7904a0a24e7fcc00fa19cd579 05-Jan-2017 Yifan Hong <elsk@google.com> Emit toString functions for all types.

* toString() is mainly for debugging purposes only.

* For HIDL internal types (hidl_string, hidl_vec, etc.)
toString() is found in ::android::hardware::details.

* For a user defined type
android.hardware.foo@1.0::IFoo.Type,
toString() is found in ::android::hardware::foo::V1_0.

* For bitfield<::anroid::hardware::foo::V1_0::T>
that gets translated to the underlying
numeric type of T, it doesn't make sense to override toString().
A templated toString() function for each user-defined HIDL enum \
is introduced into the same namespace; call it with
using namespace ::android::hardware::foo::V1_0;
toString<IFoo::MyEnumType>(value);

Test: hidl_test and look at the output of logcat

Bug: 33459772

Change-Id: I70eee018e31d700bf1376334276dbd343af5615f
/system/tools/hidl/EnumType.h
c6752dcea3b5dae1e99960b5beb6af394280b393 20-Dec-2016 Yifan Hong <elsk@google.com> Add operator== and != for some structs.

operator== and != are defined for type T where T is
one of the following:
* scalars
* strings
* enums
* U[] where U is in this list
* vec<U> where U is in this list
* structs that contain only types in this list.

If a struct contains a handle, an MQDescriptor,
or a union, for example, then == and != is not generated.

Bug: 32834072

Test: hidl_test
Change-Id: Icac73a14f81274ee6592e2b8fadf26d629151d9f
/system/tools/hidl/EnumType.h
8c56cbe4b107934da1bea14475b5cc41280a4f01 13-Dec-2016 Yifan Hong <elsk@google.com> Allow bitfield types to be elidable.

Test: mma

Bug: 33298401
Change-Id: I3066d8f0773c135b181cea497f971d9624a77bd6
/system/tools/hidl/EnumType.h
9df5244c1dd4508cc2e25f8a04d363903912d19c 12-Dec-2016 Steven Moreland <smoreland@google.com> Cleanup way elidable types are determined.

After adding the pointer type, it didn't make sense for elidable types
to be specified in canElideCallback. Now the decision as to whether a
specific type is elidable has been moved into 'isElidableType' on the
Type class.

Bug: 33298401
Test: mma in hardware/interfaces
Change-Id: I66cbaed4c533013a52e59fc8e7edcdabc9ab9f20
/system/tools/hidl/EnumType.h
abf73eef7f23f0b0ba0fe85694dcd511f4e69962 06-Dec-2016 Yifan Hong <elsk@google.com> Add is*() functions for more types.

Test: compiles
Change-Id: Ibeba6c814ac17192481935a067b7c835c4008dc7
/system/tools/hidl/EnumType.h
c57c8bb9f368faca636bdb6b39773e72255e8b08 01-Dec-2016 Yifan Hong <elsk@google.com> Add a bitfield type.

It is possible to say
enum MyEnum : int8_t {...};
...
bitfield<MyEnum>
in HIDL. In the above example, bitfield<MyEnum>
simply translates to int8_t.

Change mutating |= and &= to allow only (e.g.)
int8_t s = 0;
s |= MyEnum::VAL1;

Bug: 31702236
Test: hidl_test
Change-Id: I8d79975bb48e1ffd3af4726a52ef3678dac60115
/system/tools/hidl/EnumType.h
30bb6a869be0f3f82497b7b11c71ec9d47652ed0 30-Nov-2016 Steven Moreland <smoreland@google.com> Add a typeName() method to each type for error printing purposes.

Test: compiles with mma
Change-Id: I1283c395440282fde1106ad47aa185bdeda75880
/system/tools/hidl/EnumType.h
1c71fd5ab3381d1c59671adf2b8ca5c9a3f74401 29-Nov-2016 Steven Moreland <smoreland@google.com> Require storage type on enum.

Test: hidl_test
Bug: 33197891
Change-Id: I055fa058f4a9fc0daa0a87af4ae8b0b229665a61
/system/tools/hidl/EnumType.h
2820f8a2b8f1d525e7ea5eaed50ba600c0186ccf 10-Nov-2016 Jayant Chowdhary <jchowdhary@google.com> emitEnumBitwiseOperator takes operator parameter.

We now generate a bitwise and operator in addition
to the bitwise or operator for enums.

Test: make hardware/interfaces/tests/foo/1.0 and
inspect output header.

Bug: 32800038

Change-Id: I6b0018317dc2bc6e20b28f5909b7091b4f57f9b7
/system/tools/hidl/EnumType.h
c07b202bc91024356c50ded5a65d69f03b92e557 08-Nov-2016 Yifan Hong <elsk@google.com> Unsigned value for -Lvts is emitted correctly.

Bug: 32741002

Test: manually inspect hidl-gen -Lvts android.hardware.tests.expression@1.0 -o ~/temp
Change-Id: I5fe2da5e91cb8eddc631cf9506255eb0b6bfefa2
/system/tools/hidl/EnumType.h
4ed1347cd29e6e07acad368891bb03078c798aba 02-Nov-2016 Yifan Hong <elsk@google.com> Remove extra from getJavaType.

Bug: 32559427
Test: hidl_test_java

Change-Id: I1a96630eed1b61ab4ff2959ced2e83f94e8fb36d
/system/tools/hidl/EnumType.h
3b320f8a60e4343bf06319bca3fc949c95eaf326 01-Nov-2016 Yifan Hong <elsk@google.com> Remove extra from getCppType.

The argument is used for array type originally. We
now use hidl_array instead of T[], so there is no
need to use extra.

Renamed the convenience getCppType to getCppStackType
to avoid casting to (Type *) before using this
method (which makes it inconvenient)

Also fixes:
* RefType::getCppType ignores specifyNamespaces
* ConstantExpression.cpp emits a C-style cast instead
of static_cast

Bug: 32559427

Test: mma passes
Test: hidl_test

Change-Id: I7e2e31c34c1ca1aa83c4a5a4dbdf7fd6b9aff30c
/system/tools/hidl/EnumType.h
a4b53d0da8c1c6889c361fd30b913adc364163bc 01-Nov-2016 Yifan Hong <elsk@google.com> Add location info to named types.

Bug: 31827278

Test: hidl_test
Change-Id: I1922d5c309c9706cef37ab34d28e1193d1e247cd
/system/tools/hidl/EnumType.h
1c507273be6a1beefbe7ef6ec63992a7cf66c4f8 05-Oct-2016 Andreas Huber <andih@google.com> And one more backend for hidl-gen to create a simple static java library

exporting all annotated constants.

Bug: 32200867
Test: make
Change-Id: Ifddf296fea7b31cbf7bf8d3a42159ad43004805c
/system/tools/hidl/EnumType.h
e3f769aa75dd6be6bb1ba83904def47d9e464769 10-Oct-2016 Andreas Huber <andih@google.com> Enum types now emit operator| and operator|= for easier bitset manipulation.

Bug: 31702236
Change-Id: I166da2fe0019493c81151914ebabf591b705a713
Test: visual check, mma
/system/tools/hidl/EnumType.h
c5ea9f589cc7cce0b5e97bd4ac6a8561eb313a02 07-Oct-2016 Zhuoyao Zhang <zhuoyao@google.com> Update hidl-gen support for vts.

* Support the new Enum type (based on scalar_data)
* Support sub_struct/sub_union defined within compound type.
* Code cleanup: use getVtsType() instead of hard code ones.

Test: make hidl-gen, locally run make hidl_gen_test.
Bug: 30762234
Change-Id: I9a21b5757e0a9fc6cd1bf829ab123565a7990ad5
/system/tools/hidl/EnumType.h
019d21db821ee4ae6dd3858174a0a5cee4d33c25 03-Oct-2016 Andreas Huber <andih@google.com> Yet another backend for hidl-gen, this one generates a C-compatible header file

containing those enum types annotated in the package like so:

@export
enum Foo {
...
};

Optionally, the name to be used for the type declaration in the header file
can be different from that used in the .hal interface description by specifying

@export(name="foo_t")
enum Foo {
...
};

Finally, overriding the name to be empty, i.e.

@export(name="")
enum Foo {
...
};

will cause the generator to emit an anonymous enum.

Bug: 31800672
Change-Id: Idffb2c1700af1c7fd312941d80c3373add8ae558
Test: make
/system/tools/hidl/EnumType.h
f24fa85b362d7eb66c7b880f48e1e2e9916bc8a9 23-Sep-2016 Yifan Hong <elsk@google.com> Resolve constant expressions for external constants.

* Allow constant expressions to be used as array sizes
and as annotation values.

Bug: 31592132 allow constant expressions to be used as array sizes.
Bug: 31628863 Autofill values for enum type

Test: `make android.hardware.tests.expression@1.0` compiles
and generates enum class Color with autofilled values.
Test: `make hidl_test_java` succeeds.
Test: `make hidl_test && adb sync && adb shell hidl_test` succeeds.
Test: `mma`

Change-Id: I57377ec608503d4741d305e98144264b07973055
/system/tools/hidl/EnumType.h
fc610cd36bb07244f46c9a9baed6634bbdc564e9 22-Sep-2016 Yifan Hong <elsk@google.com> Use std::string for ConstantExpression::*value() methods.

Bug: 31633795 memory leaks are partly fixed

Test: `mma`

Change-Id: Ia9275b86ca6d7445f4832994b5a70a2e93993eb1
/system/tools/hidl/EnumType.h
709b62dbda6184770bb34470ff550e02c1643e67 19-Sep-2016 Andreas Huber <andih@google.com> Arrays of arrays are now coalesced into a single multi-dimensional array type.

This is natively stored as a flat array of the element type.

Change-Id: I1b0eee51b496648a9c8445b835635deff1a90aab
Bug: 31438033
Test: run updated "hidl_test" and "hidl_test_java"
/system/tools/hidl/EnumType.h
4c865b72b320a46f326a335cfd326b66b0e10f67 15-Sep-2016 Andreas Huber <andih@google.com> [Java hidl-gen] Fix multi-dimensional arrays (used within structures, not

as method arguments).

Bug: 31438033
Change-Id: I8e29ae8eca2a9ef8a320e37ca0bb79dcfa8a9b9a
/system/tools/hidl/EnumType.h
a3558b3b273695b31fbe1025339956966cde39c4 14-Sep-2016 Andreas Huber <andih@google.com> Enum types now properly use the Java wrapper of their underlying storage type.

Bug: 31484274
Change-Id: I8465b13888bfeb4aac29c087e1dc34e65ba9a02f
/system/tools/hidl/EnumType.h
979e099f1163ff75beed5776cd01fb409b90a0cd 07-Sep-2016 Steven Moreland <smoreland@google.com> Added knowledge of namespacing into generation.

This is the first step in making code aware of namespacing. Currently,
the solution to generate symbols which are properly namespaced is to
post-process text after it is being outputed by a Formatter. Ideally
objects will know what namespace they are in and be able to print
themselves out accordingly. This change specifically will allow
generated code to remove namespaces from symbols that don't need
to be qualified entirely without relying on post-processing to remove
the namespace.

Change-Id: Ie535d05a64eb3d6c7d3b5451abdaa289c574170f
/system/tools/hidl/EnumType.h
19ca75ae47df5cd9447b232c31c5df1d110e85d9 31-Aug-2016 Yifan Hong <elsk@google.com> Emit eval result of constant expressions for Java.

b/31223640

Change-Id: I3552e01ecaef8ac570f13c4357cd04c1c3c516bb
Signed-off-by: Iliyan Malchev <malchev@google.com>
/system/tools/hidl/EnumType.h
5788697381666844eeb23e04e5c6f83ec6ec8b44 17-Aug-2016 Yifan Hong <elsk@google.com> Evaluate constant expressions.

* The rules for evaluating constant expressions are very much
like that in C/C++, in which (u)int32_t are treated as
(unsigned) int and (u)int64_t are treated as (unsigned) long.

* Detailed rules can be found at the end of ConstantExpression.cpp.

* Only bool and integer types are evaluated. float, double
are not evaluated (not even parsed; so a syntax error will
be raised).

* Const-declared identifiers are parsed, but not evaluated.

* Only evaluate expressions for enum types. Array length and
annotation parameter values are not evaluated.

* Original expression is formatted and placed as a trailing comment
(only available in C++ format).

* Tests can be found at Icacba6b6262cc0026a94f64527b80e2c0e35e72e.

Change-Id: Ia33b68a053727747ec87b0e77c361ca19c9f41fd
/system/tools/hidl/EnumType.h
1aec397b1fdea7db4120dbe55b6995bb2a9d9138 26-Aug-2016 Andreas Huber <andih@google.com> Adds (C)opyright headers everywhere.

Change-Id: I453af702f80aa4159ef6c3d29d9514b4897adc0a
/system/tools/hidl/EnumType.h
85eabdbe56720dcdcf130e5ca83129d47b143768 25-Aug-2016 Andreas Huber <andih@google.com> The hidl-gen Java backend now supports structures (NOT unions) and types.hal

files.

Bug: 30575790
Change-Id: I6461235a1c469ce1bdb279bfa3d531113c5788f9
/system/tools/hidl/EnumType.h
80b217fa80694377cc0ad043e2385467dae2e179 24-Aug-2016 Andreas Huber <andih@google.com> Merge "Fix nested structure/union name handling."
864c771ca4ec8a01e31c7c243625b7a5f6316768 17-Aug-2016 Zhuoyao Zhang <zhuoyao@google.com> Enhanced hidl-gen support for generating vts files.

*Support callflow from mehtod annotations.
*Support inheritance for interfaces and types.
*Support Array and Union type.

b/30762234

Change-Id: I059b780d6362a557bb9cfd70d6c5ec0e73916ce3
/system/tools/hidl/EnumType.h
9ed827c8cd6e8eddb1ad9987ab9413c1de8a27df 22-Aug-2016 Andreas Huber <andih@google.com> Fix nested structure/union name handling.

Local names must be assigned before processing the body.

Change-Id: I9c3e3d4b7575c612148aea89bbd424e59e3c0604
/system/tools/hidl/EnumType.h
5158db484e5ab302368f191d75d5b1334c270e52 10-Aug-2016 Zhuoyao Zhang <zhuoyao@google.com> Extend hidl-gen to support generate vts file.

b/30762234

TODO: add regression test.

Change-Id: I1c31fd9a85805cd450ea03cc0ccc750a756d1009
/system/tools/hidl/EnumType.h
2831d5145675ead9f2fb767bf5fe4ae56b88349f 15-Aug-2016 Andreas Huber <andih@google.com> Initial commit of Java backend to hidl-gen.

Change-Id: I38b62637df74d3e5daf702a8996502d0d5726033
/system/tools/hidl/EnumType.h
8d3ac0c6112e02e3a705fd4f9d82e523f10b4287 04-Aug-2016 Andreas Huber <andih@google.com> Be a little smarter about dealing with TypeDefs, resolve to the typedef'd

target at lookup time, so all code ever sees is anything _but_ TypeDefs.
Also verify that the optional Enum storage type is valid (i.e. an enum
or an integer type) and re-emit enum values for derived enum types.
/system/tools/hidl/EnumType.h
31629bcd51ab30bc0aadc69f3fc8ce4893eca900 03-Aug-2016 Andreas Huber <andih@google.com> Saner determination of a declared type's name (now short + full name)

at the time the type is introduced to a scope.
/system/tools/hidl/EnumType.h
867fcb63af8c3ac96ed1b3f3950525aa70393bdf 03-Aug-2016 Andreas Huber <andih@google.com> bye bye, dump(), RefType no longer gets a name.
/system/tools/hidl/EnumType.h
737080baf85882c45bb322ee2191ae5fd9e1283a 03-Aug-2016 Andreas Huber <andih@google.com> Keeping track of imported names, resolve enum storage types, some finetuning.
/system/tools/hidl/EnumType.h
881227d860c59471eee31d39946e96ce2daa35d6 02-Aug-2016 Andreas Huber <andih@google.com> generate C++ interface header, proxy and stub headers and sources.
/system/tools/hidl/EnumType.h
c9410c7e62a33fd7599b2f3e025093a2d171577e 28-Jul-2016 Andreas Huber <andih@google.com> initial commit of reimplementation of hidl-gen

commit 56da787631c17276bc987f19649c6c1ea92200c3
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 12:18:57 2016 -0700

ast.cpp => AST.cpp

commit 095552aba072152d9c87475895cd2e97c43b7b03
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 10:43:04 2016 -0700

TypeContainer => Scope, since it now also holds constants.

commit 89ec1c511e7806037a53e43333c37fdf1b7aa39e
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 10:41:05 2016 -0700

initial support for constants

commit b60b7ae588654b634bfdc5c283a25dd6378e1df7
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 10:01:46 2016 -0700

Support for typedef, maintain ordering inside TypeContainer

commit 8e83034a077ce2309deeb0e2094079cf6f11d8b4
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 09:36:29 2016 -0700

support for optional super interface

commit 9d44b022adb4a68dfca67ba2a6d845b7c8f27b88
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 09:28:18 2016 -0700

ast => AST

commit 48fd7f8a4e8ecf230cfc416aec6c8f6115e410af
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 09:26:44 2016 -0700

Each type in its own source/header file pair.

commit ca1285ecbcbbb1340eec476e3fd4d1334908d8c1
Author: Andreas Huber <andih@google.com>
Date: Thu Jul 28 08:52:24 2016 -0700

added scalar types "char", "bool" and "opaque"

commit fbb351e5f4392fcbbce77402dfe059a1c8d79fb2
Author: Andreas Huber <andih@google.com>
Date: Wed Jul 27 13:47:32 2016 -0700

some fixes to the parser and ast.

commit 78288216b101349e9364c2d4470ecb5b9a942f5c
Author: Andreas Huber <andih@google.com>
Date: Wed Jul 27 12:34:21 2016 -0700

Formatter, AST::dump(), NamedType

commit 4b8cc5d0a8ff5f70cb53e21b56138124259b8bcb
Author: Andreas Huber <andih@google.com>
Date: Wed Jul 27 11:45:10 2016 -0700

revamp of the parser, scoped type containers

commit 0193fbfa5c7ac3ac1ce306dfb9c55d879f8c02b5
Author: Andreas Huber <andih@google.com>
Date: Wed Jul 27 10:13:35 2016 -0700

store output in AST.

commit 7f53022123978cc7c2a05b0c4aba7a4c5deea93b
Author: Andreas Huber <andih@google.com>
Date: Wed Jul 27 10:06:54 2016 -0700

reentrant lexer/parser

commit 3d3e343d6cea2fb127b203071e8aff08a5715011
Author: Andreas Huber <andih@google.com>
Date: Tue Jul 26 15:27:02 2016 -0700

better typename lookup, comments.

commit 39f13ae860dbd9ffd163a5c99f150170525457ef
Author: Andreas Huber <andih@google.com>
Date: Tue Jul 26 14:29:33 2016 -0700

an actual AST.

commit b1f3f1d94a8d1257426da35ace5bc2af04c433b6
Author: Andreas Huber <andih@google.com>
Date: Tue Jul 26 12:51:34 2016 -0700

initial commit

Change-Id: I44d1d928a5f3dcb908e264d53af09bbe25d8c464
/system/tools/hidl/EnumType.h