History log of /system/tools/hidl/Type.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/Type.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/Type.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/Type.h
8e61c5af41226b0e1e88aa439c1360836f71795b 18-Nov-2017 Steven Moreland <smoreland@google.com> Add emitGlobalTypeDeclarations.

This allows HIDL objects to add things to libhidl namespaces
like "android::hardware".

Bug: 68715899
Test: hidl_test
Change-Id: Idd9cb6261e843e1bc4ecb8b261dea6335384e9b2
/system/tools/hidl/Type.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/Type.h
bf71421a737c2b4f518bc3b21d0e21c6b2e00fdb 28-Oct-2017 Steven Moreland <smoreland@google.com> Build toString + operator== in client libraries.

This is Phase I 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: hidl_test
Bug: 65200821
Change-Id: I4f2b10c088b1c1663a7a10d479e2607311dc462c
/system/tools/hidl/Type.h
458ca365d99ae9f98bd59c0c2ea8b4fa54e2d535 13-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Put type definitions in reversed topological order

Puts a warning comment if the order is changed.
Doesn't change the order if that is not necessary.

Fixes: 65636464
Bug: 31827278

Test: mma
Test: ~/android/aosp/out/soong/.intermediates/hardware/interfaces is
changed only for trie

Change-Id: I91ec448859fcdd94228acfaa1f67de7bb54f777c
/system/tools/hidl/Type.h
ff5e64ae0c65b80e2baa4a95b9ae9ee894b60080 11-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Fix strong references

Makes strong references to deal with interface corner case explicitly.
Makes hidl-gen to detect a cycle through typedef.

Cycle example:
typedef S A;
struct S {
A foo;
};

Fixes: 65559985

Test: mma
Test: error test in follow up CL
Change-Id: I132037995c3fc99edfe3e57a1fe84d3c36ca6993
/system/tools/hidl/Type.h
78821ed2f17fbf7d0397cb21e1bb872aa06ea92a 10-Sep-2017 Timur Iskhakov <iskhakovt@google.com> C++ forward declaration restriction on incomplete types

C++ doesn't support forward reference of an incomplete type:
struct B;
struct A {
B foo; // error
};
struct B {};

We could allow such references in HIDL by rearranging the defined
types in topological order.

Bug: 31827278

Test: mma
Test: error test in follow up CL
Change-Id: Idecd42d6e3a7b6c45a12e01d45eb29d949daf001
/system/tools/hidl/Type.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/Type.h
041fdfe5995b6c88b4aa1b40d668d2c891ab7e91 07-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Add C++ forward declaration check

C++ prohibits forward declaration of an inner type.
At this point we take it over and prohibit such forward references.

The formal rule is that if type A references in its declaration type B
then B is parent of A or B’s parent is parent of A
(stack from global scope to A contains the exact parent of A).

Bug: 31827278

Test: mma
Test: test in follow-up CL moving lookups
Change-Id: Ia163fb76bce243c826b992202849108acd53f2c1
/system/tools/hidl/Type.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/Type.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/Type.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/Type.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/Type.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/Type.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/Type.h
40731afa5f0e4e0e9bc36bd9c37e24b9bdaa3413 24-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Add acyclic check pass to hidl-gen

Adds recursive tree pass that checks that directed graph of
definitions and references is acyclic.
It prints nice error message, which shows the whole found cycle.

To be really tested, it requires lookups to be moved outside of parsing.

Test: hidl_test
Bug: 31827278

Change-Id: I9e96fa8206cfb84a56298991c526f71befae1478
/system/tools/hidl/Type.h
35930c43ef3ccc79ae5ad07ca8dab5e94902d30e 29-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Proceess post parse passes once for each type and expression

Type::recursivePass is called separately for different packages, and that
leads to processing passes multiply times for the same type.

Change adds an option to "lock" type or constant expression
after processing post parse passes once.

Fixes: 65126148

Test: mma
Test: manually check using completion flag for each pass

Change-Id: I6b3d75150cc0a4eb65c5972b87c650af4e55b7d5
/system/tools/hidl/Type.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/Type.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/Type.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/Type.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/Type.h
e9ccfa2e9c177ead2b6ccb36dd20de294666abcd 15-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Move annotations from Type to Scope

Test: hidl_test
Change-Id: I0b570096c38e27cb818930bd508d31aa47fe5d4d
/system/tools/hidl/Type.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/Type.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/Type.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/Type.h
0ecc7b8aca24a5618512610bb6371bdb91b5fdc2 19-Jul-2017 Steven Moreland <smoreland@google.com> Add typeName() to all types.

Fixes some possible empty error messages (from
vec<unsupported type> at least). Also, will be useful
in the future to describe types.

Bug: 34807779
Test: manual
Change-Id: I52898f854e5747a65a4ca0c7a6ada0277feca761
/system/tools/hidl/Type.h
397b5e1957cc1a1ad3365e294437324d5c088039 08-Jun-2017 Steven Moreland <smoreland@google.com> Support vec<memory> in HIDL.

Test: hidl interfaces compile with vec<memory>
Test: hidl_test

Bug: 36727951
Bug: 63899698

Merged-In: I68092eda26a6ead11bd09ea6c9bb64655207cb5f
Change-Id: I68092eda26a6ead11bd09ea6c9bb64655207cb5f
/system/tools/hidl/Type.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/Type.h
60d3b22101e911242d2d41c8dc8309e8706f1fe1 30-Mar-2017 Andreas Huber <andih@google.com> More stringently verify expected alignment of fields in hidl compound types.

Change-Id: I222d78163ac5d7cc5af405b0c3d0586ed7528213
Bug: 33846034
Test: make
/system/tools/hidl/Type.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/Type.h
e9667849dd310995d1e4d12f31942f68bf992d1c 19-Jan-2017 Zhuoyao Zhang <zhuoyao@google.com> Support vts generation for fmq type in hidl-gen.

* Also did a few cleanup for Templated type.

Bug: 34385794
Test: make hidl-gen
Change-Id: I539bf8fe5a1bb65c36f6041417b34ddaf99840d7
/system/tools/hidl/Type.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/Type.h
6a082c63904f274c45d5eede313e0ef77ec70f86 11-Jan-2017 Martijn Coenen <maco@google.com> Use new read(Embedded)Buffer API.

Bug: 34134129
Test: hidl_test
Change-Id: Iad3f9d4dd30b4b8b92295816fbed25c56e52fb0a
/system/tools/hidl/Type.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/Type.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/Type.h
abf73eef7f23f0b0ba0fe85694dcd511f4e69962 06-Dec-2016 Yifan Hong <elsk@google.com> Add is*() functions for more types.

Test: compiles
Change-Id: Ibeba6c814ac17192481935a067b7c835c4008dc7
/system/tools/hidl/Type.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/Type.h
99e6bebc96d75d1c9b9b8130cd9b880dacb95b01 01-Dec-2016 Martijn Coenen <maco@google.com> memory -> hidl_memory and pointer -> hidl_pointer

Test: hidl_test
Change-Id: Id71c742867be01e80cd48f689c0c619f6b647aac
/system/tools/hidl/Type.h
2f69a5b157e9c5c41847e55bf3e7dbb01b7de99d 18-Nov-2016 Martijn Coenen <maco@google.com> Map handle to hidl_handle in all cases.

Instead of having inconsistent types for HIDLs 'handle' type
dependent on where the handle is used (eg native_handle_t*
in function parameters, but hidl_pointer<native_handle_t>
in compound structures), make it consistent by always using
hidl_handle. Copy constructors and conversion operators will
still make it easy to use for clients/servers.

Bug: 32089785
Test: builds, hidl_test32/64 passes
Change-Id: I2eb60cb56c4c62ad9479fd57f801349ce0f4b7ef
/system/tools/hidl/Type.h
ac5878945afde379e41d9c93de44c32537f868b1 17-Nov-2016 Martijn Coenen <maco@google.com> Wrap compound native_handle_t* in hidl_pointer.

When transferring a handle in a compound type,
we need to use hidl_pointer<> to ensure that we
allocate enough space for the pointer. But we want
to hide the hidl_pointer<> type from client/server
code as much as we can, so we only use this type
when necessary (eg when the handle is embedded in
a struct).

Bug: 32089785
Test: builds
Change-Id: I30c9aa9f1348fd5e72cd6d1e71d9ac3b4bd8ea8e
/system/tools/hidl/Type.h
244e82d34bf0ef5d8d5b0730a9dea3e3fc4de7c5 11-Nov-2016 Yifan Hong <elsk@google.com> move read/writeEmbedded[References]From/ToParcel out

from hidl_string, hidl_vec, and structs.

* Add a hwtypes.h in the autogenerated files, which
contains the read/writeEmbeddedFrom/ToParcel
methods for structs defined in types.h.

* Fixes the hack that remove the warnings when compiling
the generated code (useParentInEmitResolveReferencesEmbedded())
and add one more hack (useNameInEmitReaderWriterEmbedded())

* Some clean-up on Scope.cpp (add a forEachType function)

Test: mma
Test: hidl_test

Bug: 32756130

Change-Id: Icfd116b5d92fef78d257337c3f2ef02071f7600b
/system/tools/hidl/Type.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/Type.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/Type.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/Type.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/Type.h
bb5c80bdec4922aac973551b4f3cbd1008e57820 05-Oct-2016 Steven Moreland <smoreland@google.com> Removed useless function Type::ref.

Test: make hidl-gen, hidl_test
Change-Id: I9358a12d43b2a856e5150eb69fb8bc9ccfadf65b
/system/tools/hidl/Type.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/Type.h
be2a3737675b83dd61b52c11f0d7549fa1276739 05-Oct-2016 Yifan Hong <elsk@google.com> hidl-gen: add sanitizedName to emitReaderWriterEmbedded.

* Fix weird variable names in autogenerated code for vec<vec<T>>.

Bug: 31955917

Test: hidl_test
Change-Id: I83363a6d12babae1aba8e118451e1ec80492012c
/system/tools/hidl/Type.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/Type.h
00f471711684903fd747e7871edf437ca54ed397 30-Sep-2016 Yifan Hong <elsk@google.com> hidl-gen: Fix warnings for unused parameters.

Test: `mma` does not have warnings on unused paramters
on GraphAll.cpp.

Change-Id: Ib4ddd38c34f1de5aef1cdefdfa0539840fb44a8e
/system/tools/hidl/Type.h
bf459bcedc2ab1a22a9cc290fbcc0a5462e63690 24-Aug-2016 Yifan Hong <elsk@google.com> Pointer support and embedded types in HIDL.

* Pointers work per transaction. Don't work
across transactions.
* ref<T> in HIDL translates to T const* in C++.
* No Java support.
* Embedded types like ref<vec<vec<int32_t>>>
or vec<ref<T>> is supported. Pointers to
pointers like ref<ref<ref<T>>> is supported.
* Array of pointers and pointer to array supported.
* Pointer inside a union is NOT supported.

Test: `mma`
Test: `make hidl_test && adb sync && adb shell hidl_test`
Note that this only works with a kernel patch.

Bug: 31300815
Bug: 31349114

Change-Id: I15b74ca74a801009cc8bdc7132bd53d0185dbcbf
/system/tools/hidl/Type.h
7c5ddfb41a806a7bf71581952d06b637a7670cf7 29-Sep-2016 Andreas Huber <andih@google.com> Allow struct, union and enum type declarations to be annotated.

Change-Id: Idce594b47c324d8420638e2e8853da3c99150672
Bug: 31800672
Test: hidl_test, hidl_test_java
/system/tools/hidl/Type.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/Type.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/Type.h
f9d49f1468bd65595f6f0ae5f4d7300f4e95edf8 12-Sep-2016 Andreas Huber <andih@google.com> [C++ hidl-gen] Fix multi-dimensional arrays, vectors of arrays.

Bug: 31438033
Change-Id: I254e8bfeb8fbf665dd3836825aa271603be6d14c
/system/tools/hidl/Type.h
f630bc8736003dcf4aac3dfe47167beb6beb6c6a 09-Sep-2016 Andreas Huber <andih@google.com> Java support for passing vec<STRUCT-TYPE> and STRUCT-TYPE[] to and from methods.

Bug: 31380705
Change-Id: I7374538d0bc2b3562c997710bfa4ed1f95950589
/system/tools/hidl/Type.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/Type.h
1aec397b1fdea7db4120dbe55b6995bb2a9d9138 26-Aug-2016 Andreas Huber <andih@google.com> Adds (C)opyright headers everywhere.

Change-Id: I453af702f80aa4159ef6c3d29d9514b4897adc0a
/system/tools/hidl/Type.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/Type.h
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/Type.h
39fa71827738f6c1340e4523946fe9bf704eef3a 19-Aug-2016 Andreas Huber <andih@google.com> Improved name lookup in order to allow partial names to refer to external

(imported) packages.

Bug: 30977424
Change-Id: I0a3757d6c3b10229627e2c1d6bc6176f88e13151
/system/tools/hidl/Type.h
295ad30bf6212c16accc5095601b2a71d44b4c8b 16-Aug-2016 Andreas Huber <andih@google.com> Support for a generic "binder" type (reflected as "interface" in hidl)

marshaled as a sp<hwbinder::IBinder>.

Bug: 30884691
Change-Id: I157d78fbbe839637805359441925aec597c52383
/system/tools/hidl/Type.h
70a59e1dc3dcf32f791d2dd7966111d4adf32eca 16-Aug-2016 Andreas Huber <andih@google.com> Validate upfront that an interface is compatible with our Java backend,

emit diagnostics if it is not. Also cleans up all other error messages to
clearly indicate an error condition.

Bug: 30876839
Change-Id: I18bcd723107ab93abcad38c976f3c38dda60a743
/system/tools/hidl/Type.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/Type.h
2831d5145675ead9f2fb767bf5fe4ae56b88349f 15-Aug-2016 Andreas Huber <andih@google.com> Initial commit of Java backend to hidl-gen.

Change-Id: I38b62637df74d3e5daf702a8996502d0d5726033
/system/tools/hidl/Type.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/Type.h
fd4afabde8fb9bbdd0021addeb9fbb62428f2c17 03-Aug-2016 Andreas Huber <andih@google.com> RefType is no more, 1) simplify, 2) repeat
/system/tools/hidl/Type.h
867fcb63af8c3ac96ed1b3f3950525aa70393bdf 03-Aug-2016 Andreas Huber <andih@google.com> bye bye, dump(), RefType no longer gets a name.
/system/tools/hidl/Type.h
737080baf85882c45bb322ee2191ae5fd9e1283a 03-Aug-2016 Andreas Huber <andih@google.com> Keeping track of imported names, resolve enum storage types, some finetuning.
/system/tools/hidl/Type.h
881227d860c59471eee31d39946e96ce2daa35d6 02-Aug-2016 Andreas Huber <andih@google.com> generate C++ interface header, proxy and stub headers and sources.
/system/tools/hidl/Type.h
a2723d26427f7db19777dfed330047253e7a4e1b 30-Jul-2016 Andreas Huber <andih@google.com> Enforce naming conventions and allow empty (except for the header) types.hal files.
/system/tools/hidl/Type.h
5345ec2b1b7e4126b77aa2131b231a9eb5ee811d 29-Jul-2016 Andreas Huber <andih@google.com> Recursively parse imported .hal files and perform global type lookup.
/system/tools/hidl/Type.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/Type.h