History log of /system/tools/hidl/EnumType.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
49bad8df77e1fe1ca3c06fe49790a6e3304e7249 18-May-2018 Steven Moreland <smoreland@google.com> hidl-gen: understand doc comments

Doc comments were used by hidl-doc in order to
generate documentation. However, because hidl-doc
tokenizes the entire file including the comments
some of the information is lost. Rather than refactor
hidl-doc, we are going to use 3rd party doc generation
tools in order to generate docs from the output of
hidl-gen.

This has a couple of benefits:
- people automatically get the documentation if they are using
an IDE which pulls the documentation
- hidl-doc/hidl-gen won't get out of sync
- documentation will be closer to actual usage

This will require ABI-safe changes to some HAL interfaces.

Bug: 78135149
Test: manually inspect hidl-gen output.
Test: (sanity) run_all_host_tests.sh
Test: (sanity) run_all_device_tests.sh

Change-Id: I9a09ed48e2e3834fab7e032e29c48f466510e51f
/system/tools/hidl/EnumType.h
d8c7a29c5561ff72d0fba4e6b3610f9321c2642c 28-Oct-2017 Steven Moreland <smoreland@google.com> Remove toString + operator== from server libraries.

This is Phase III of a three phase plan to remove toString + operator==
from sources since the VNDK is currently not in place.

Phase I: functions in client and source libraries
Phase II: rebuild prebuilts with the functions in the clients
across all targets and vendors.
Phase III: remove functions from the source libraries

Test: manually inspecting binaries and sources, hidl_test
Test: 2016 pixel device boots and works
Test: 2017 pixel device boots and works
Test: 'some other device' boots and works
Test: boot bat
Test: boot owl
Bug: 65200821

Merged-In: Ib71614e43e7db9f83cbd42847e846324fd12fbde
Change-Id: Ib71614e43e7db9f83cbd42847e846324fd12fbde
/system/tools/hidl/EnumType.h
368e46077eb9fbe52242e037a5b9de91693fe70f 16-Feb-2018 Steven Moreland <smoreland@google.com> Do all validation during validation phase.

When hidl-gen was originally written, validation occured
at two different times: parsing and generation.

Since then, hidl-gen was re-written to be a multi-pass compiler.
The basic phases are now (see main + AST::postParse):
parse, process, validate, generate

However, some validation still exists during the generation phase.
This validation code has been gradually cleaned up, but, here, I am
cleaning up all the rest.

By moving the code to validation, we are fixing several classes
of problems:
1. generate functions almost exclusively (except for the few exceptions
that this CL cleans up) always return status OK. We have a bunch of
data flow logic which exists solely to propagate "return OK". This
is just plain silly.
2. a large number of the returns from emit/generate functions are not
actually checked. We've had a several bugs from this and also many
CLs just to fix this when they've been discovered. This causes problems
where hidl-gen fails but nothing notices.
3. sometimes files are written before things are validated. This is
extremely frustrating and also the cause of other bugs. One common
case of this (while developing) is when updating makefiles, the hidl-gen
compiler complains something is wrong with an interface, but it has
already partially written new but invalid makefiles. This means that
they have to be manually fixed before another build can begin.
4. having status_t returns from generate functions indicates to someone
working on hidl-gen that they can return an error here, but they
should always return an error from the correct validation function.
Removing the ability to return ERROR makes sure that new errors are
caught/validated in the correct place. One instance in this CL of
this happening is that annotations are also checked on isHidlReserved
methods whereas before, these were incorrectly only checked on regular
methods.

(note, breaking text to avoid pinging these)
B ug: 65636464 (forward declarations, made this possible)
B ug: 34807779 (better tools for java compatibility, closer to being solved)
B ug: 32573681 (instance of 2 above).

Test: hidl's run_all_host_tests.sh
Change-Id: I8988e1fdf16e15b925c0a613122c41e6a41bd4dd
/system/tools/hidl/EnumType.h
6961d3f487ba89ff73d89ec78f148cd130d27fa5 17-Nov-2017 Steven Moreland <smoreland@google.com> Add enum iteration to HIDL.

e.x.:
for (const auto v : hidl_enum_iterator<Foo>) {
...
}

Going with exposing an iterator interface completely
in the header because:
- this should only increase code size if it is used
- we want to be able to change this interface/implementation
to be more efficient or to add new features without having
to update all prebuilts

Bug: 68715899
Test: hidl_test
Change-Id: I613d5c71ebf3f58c5c92338888ad90172896178d
/system/tools/hidl/EnumType.h
4b8f7a11f794d9b4899af92a856b4a03b80b31e8 18-Nov-2017 Steven Moreland <smoreland@google.com> Rename global..Decls to package...Decls

For something like android.hidl.foo@V1_0::IFoo.SomeStruct.SomeEnum
emitGlobalType/HwDeclarations puts relevant functions in
"android::hidl::foo::V1_0".

Since this isn't the global namespace and we are actually going
to put other things relative to the global namespace, renaming.

Bug: 68715899
Test: hidl_test
Change-Id: Ibc465dc69d028b13d96f123a42a1f5bf391c32b3
/system/tools/hidl/EnumType.h
0a9cc8627f85104721f7b32c7ced2c8b1062004b 07-Oct-2017 Yifan Hong <elsk@google.com> Enum toString functions also check parent values.

Difference in size of libraries:
Before:
139436032 $OUT/system/lib/
220307456 $OUT/system/lib64/
147308544 $OUT/vendor/lib/
160686080 $OUT/vendor/lib64/
667738112 Total

After:
139448320 $OUT/system/lib
220319744 $OUT/system/lib64
147308544 $OUT/vendor/lib
160686080 $OUT/vendor/lib64
667762688 Total

Diff: 24576 bytes

Test: manual
Fixes: 67463967

Change-Id: I8a259a731493de5c7199e1c63e7a86be4b1ba264
/system/tools/hidl/EnumType.h
c14dd6e8452b43d2ced67c891070d09890374377 15-Sep-2017 Yifan Hong <elsk@google.com> EnumType does not own BitFieldType.

Test: hidl_test
Change-Id: If28ec0703c2bfe1426ab225cfe64fbe6c4dbbf7c
Fixes: 64272670
/system/tools/hidl/EnumType.h
5dc72fe4f6f1d2c03c75307a9bd80f055f752ed3 08-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Make recursive methods in Type work with cyclic AST

Fixes Type::canCheckEquality, Type::needsResolveReferences,
Type::isJavaCompatible, Type:containsPointer.

Adds set of visited Types to these functions to prevent
infinite recursion.

deep versions of these functions *do not* guarantee the correct
return value, but non-deep versions do:
We need to find al least one path from requested vertex
to "bad" vertex (ie. which is not java compatible).

Fixes a bug with containsPointer (containsPointer returned true
if inner type contained a pointer), so more structures get
__attribute__ aligned and static_assert generated for
struct fields.

This change is required for forward reference, as current
implementations assume that the graph is acyclic.

Potential future work: to reduce theoretical complexity of
described actions (square to linear).

Bug: 31827278

Test: mma
Test: output not changed in
out/soong/.intermediates/hardware/interfaces

Change-Id: I3dbdd1605f9317637241057b12de6031125abf7b
/system/tools/hidl/EnumType.h
565b0137b2ad0e8e239d38e92c025f096de62f2d 07-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Refactor AST::addScopedType.

Makes NamedType receive full name in constructor.
Adds test that defined type names are unique within one scope.

Test: mma
Test: hidl_error_test
Change-Id: If218e1febc2af9f44c5908408f67e772efdda18e
/system/tools/hidl/EnumType.h
fd3f250dfb0f1a990c29a76de184830e6dd9e883 06-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Emit forward declaration

Outputs forward declarations of scopes (except interfaces)
and outputs typedefs declarations before type complete
declarations.

Bug: 31827278

Test: mma
Change-Id: I2d034fa62f4fae5dd2d6f64fa832da341b006ad2
/system/tools/hidl/EnumType.h
dbaed3317411232962d25666de60799b4dcfce98 01-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Do not unwrap typedefs on lookups

TypeDefs were replaced with actual types in lookups, so package
containing typedef could be not included.

This change keeps typedef declarations and imports package with
typedef declaration.

Bug: 65266511

Test: mma
Test: manual check that include became correct
Test: /hardware/interfaces output is unchanged, however
CL changes the behavior

Change-Id: Iee78228c9acfa4dbd16c3ca4ec0d9568a927d0f6
/system/tools/hidl/EnumType.h
3f1d26ed2a4843498c187126f95bed67838e08a4 31-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Refactor templated type type name

Delete duplicated templated of element structure.

Test: mma
Change-Id: I72e344a648e44a2804d8d3a776cda0c143bcd140
/system/tools/hidl/EnumType.h
24e605b5194d969a1558d94896d69cc554881e46 30-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Make Reference::get follow const rules

Instead of having T* Reference::get() const, this change brings
const T* Reference::get() const and
T* Reference::get()

Test: mma
Change-Id: I1c8834467acffd426c25aa9c0661c290a05d7a52
/system/tools/hidl/EnumType.h
63f399021d053453704d41845d4ebcc06fe01738 30-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Add parent to every type

Parent is needed for lookups:
scope = isScope() ? this : parent()
for ref : getReferences() {
AST->lookup...(ref, scope)
}

Bug: 31827278
Test: mma
Change-Id: I1bde29de43d224634d80949d719adc8de9cc8896
/system/tools/hidl/EnumType.h
b58f4185934a93fc511c03a8a970b31c5ea0dfca 30-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Make Type::getReferences return pointer

This change makes it able to add lookups as one more tree pass,
as it requires to change Type inside of references.

This change require getReferences to become non-const, so from now
we maintain const and non-const versions of recursive pass and getting
dependencies.

Bug: 31827278
Test: mma
Change-Id: I201533db5ca0bd30fbad34ef71ed2bd210c607e4
/system/tools/hidl/EnumType.h
891a866402345777c7e746cf8d0e4ffd0bd28ca2 26-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Constant Expressions have same tree structure as Type

Makes constant expressions tree structures and type signatures
be similar to AST (type declarations and references).

This change is useful for making same structure for calling
constant expressions evaluation and lookup (they depend on local
identifiers).

Bug: 31827278

Test: mma

Change-Id: I901284009d8b845358788b8c9e3de083a2f63f3f
/system/tools/hidl/EnumType.h
33431e6cd425c6cd179080442a8616e2baa20aae 22-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Build AST graph explicitly for simpler post-parsing passes

Puts all of AST parent-child dependencies into a graph.
This change also makes it able to not care about such case:
Type -> (non Type) -> Type (ex. Interface -> Method -> Type)
and to store only Type -> Type relations.

Test: hidl_test
Change-Id: Ic67d9833d9519d7bd6cbae603c556c5bd905167a
/system/tools/hidl/EnumType.h
cec46c48853a8c1246656d0095a9faa3fad5c4f9 09-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Move type-related stuff ouside of parsing

3 new passes: resolving inheritance, evaluating constant expressions and
validation.

`resolveInheritance` completes type fields definition which depends on
type base class (so it needs to be looked up before this pass). That
includes interface method serial autofill and enum value autofill.

`evaluate` evaluates constant expressions. This pass depends on the
previous one as enum autofill creates new expressions (+1s).

`validate` proceedes all type-related checks.

`callForReference` is a special way of calling passes for types:
it is used for types that are defined in reference.
Currently that is only array type (size is defined in reference only)
and template type as it could contain an array.
We need such special way to avoid cyclic evaluate call:
struct S { S[42] arr; };

Test: full build, device boot
Test: hidl_test
Test: full build on mac
Test: generated files differ only in constant expression comments

Change-Id: I499e62ae41c52cc86b13d0014eed790454137af6
/system/tools/hidl/EnumType.h
8c90cc59bf93bd0c08970b4488067a33015d4a1c 03-Aug-2017 Chih-Hung Hsieh <chh@google.com> Fix clang-tidy performance warnings in system/tools/hidl.

* Use const reference parameter type to avoid unnecessary copy.
* Use more efficient overloaded string methods.

Bug: 30407689
Bug: 30411878
Test: build with WITH_TIDY=1
Change-Id: Ib90a35106eb59d05878b75504b87ef324211cc6b
/system/tools/hidl/EnumType.h
f1b902d10bd2d71ad7f4769620678101821fd5d1 14-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Refactor interface and enum type- and parent-related methods

Make EnumType typeChain has the same syntax
(same name and same return way instead of result by pointer).

Add EnumType::superTypeChain by analogy with Interface::superTypeChain.
Add Interface::allSuperMethodsFromRoot as a mixture of
Interface::allSuperMethodsFromRoot and Interface::superTypeChain.

Test: build hidl-gen, hidl_test
Change-Id: I0af678eab7a563b471f041599ff83bc2b4b9764a
/system/tools/hidl/EnumType.h
7296af19687b1c90dfd238398cd2c8ccb6bcd232 09-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Revert "Revert "ConstantExpression lazy evaluation""

This reverts commit a549b71629b6bc28ac1d99d34a0f3b3005c90aad.

Reason for revert: mac build issue fixed by adding virtual destructor

Test: builds, hidl_test
Test: builds on mac

Bug: 64532323

Change-Id: I10a142649bc1eb304b267372129e850235004f6e
/system/tools/hidl/EnumType.h
a549b71629b6bc28ac1d99d34a0f3b3005c90aad 09-Aug-2017 Colin Cross <ccross@android.com> Revert "ConstantExpression lazy evaluation"

This reverts commit 1313a127416ed91a80ab4f282c6ecc042e54bc15.

Causes SIGILL when running hidl-gen in mac builds.

Change-Id: I8b7797dc84c7fc2ea93e6c5c69aa653aa5185c64
/system/tools/hidl/EnumType.h
1313a127416ed91a80ab4f282c6ecc042e54bc15 01-Aug-2017 Timur Iskhakov <iskhakovt@google.com> ConstantExpression lazy evaluation

Makes comment "A constant expression is represented by a tree" true! :)

ConstantExpression is now stored as a tree with forcing lazy evaluation.
ConstantExpression suports Reference for future forward reference
support.

Test: compiles, boots, hidl_test
Test: hidl-gen output for android.hardware.tests.expression@1.0 is
unchanged

Change-Id: I26b10f27c00d869192fa3d52c188196f7e39392f
/system/tools/hidl/EnumType.h
505316c499a4dbb95f6567e8531fb6f1e74c3ded 05-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Revert "Revert "Add Reference type""

This reverts commit 6f2f2c026b0b6e372194794e171208a91d74f852.

Reason for revert: mac build problem could be easily fixed

Mac build failure was caused by not declaring template specialization
in header file. Unfortunately, it cannot be easily declared there,
as that would cause cyclic declaration.

The reason why Reference<T>(Reference<O>) constructor could get only
unresolved references is because there is no way to check that the
requested conversion is valid (without specialization or rtti).

However, the appeared messy solution is to be deleted with moving
lookup calls outside of the parser.

Test: builds, hidl_test
Test: builds on mac

Change-Id: Icb24e2ad52563f659e758a186d90e414ab7f1c59
/system/tools/hidl/EnumType.h
6f2f2c026b0b6e372194794e171208a91d74f852 05-Aug-2017 Steven Moreland <smoreland@google.com> Revert "Add Reference type"

This reverts commit 4b80bc4402ec88504265e6fdbcdb8a803d67eb64.

Reason for revert: breaking mac build

Change-Id: I38b4a6e67173d87d7d78ff191aa26d4a980d2e39
/system/tools/hidl/EnumType.h
4b80bc4402ec88504265e6fdbcdb8a803d67eb64 29-Jul-2017 Timur Iskhakov <iskhakovt@google.com> Add Reference type

Add Reference placeholder which keeps Type, FQName and Location.
This type is necessary for adding forward reference support:
it stores FQName until lookup happens, then stores resolved Type;
it stores Location, as all type-related checks are to be moved outside
of the parsing, so we need to keep Location for future error messages.

Reference type has overwritten operators to make it work as Type*,
providing additional checks that Type is resolved before being using.

Reference type is also useful for adding forward reference support as
it checks that every Type member call appears after lookup.

ConstantExpression is to support Reference (and to not be evaluated
during parsing) in future CL.

Test: links, compiles, hidl_test

Change-Id: I7a031b541e678032af1190209e9d2aaf4999bf1b
/system/tools/hidl/EnumType.h
cb0ba5213057de39aa164f2f9a3691370bcbfe6b 18-Jul-2017 Timur Iskhakov <iskhakovt@google.com> Moving hidl-gen parser stack outside of AST

Move compiler stack outside of AST members,
adding a parent member to NamedType to make AST
a real tree.

Add a check that interface must be declared in global scope,
that was not checked in hidl-gen.

Also move scanner outside of AST.

Test: compiles, links, boots, hidl_test
Change-Id: Ida0c192b258e40c8cfe033f00a842444df0130ad
/system/tools/hidl/EnumType.h
3d98bc4470d010121dd607d860d384065b6f97a9 23-Jun-2017 Steven Moreland <smoreland@google.com> Revert "Move all toString to be in users of HIDL libs."

This reverts commit 32bfbeb9ec923717eb4efaf03278ef2326b9325e.

Reason for revert: prebuilts have a problem with this.

Change-Id: I4ab5790b88ef137fdfbc4788121949c24bd0a307
/system/tools/hidl/EnumType.h
32bfbeb9ec923717eb4efaf03278ef2326b9325e 06-Jun-2017 Steven Moreland <smoreland@google.com> Move all toString to be in users of HIDL libs.

Only a small percentage of these functions are actually used
so this reduces the amount of memory that is used.

Test: boot fugu (which has prebuilts), no problems
Test: boot other device with prebuilts, no crashes
Test: hidl_test on other device

Change-Id: Ib10c3d82226b117001b61148502c6526555130da
/system/tools/hidl/EnumType.h
e30ee9b06ac578006161e84633db91289f889068 09-May-2017 Steven Moreland <smoreland@google.com> -Lc++-impl: better namespace handling

Intelligent namespace handling requires much more work
so using Formatter like the rest of hidl-gen.

Test: manual with -Lc++-impl
Fixes: 37294618
Change-Id: I9593ec31b8b8dd19b09750acf10c0330f5628a58
/system/tools/hidl/EnumType.h
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