History log of /system/tools/hidl/Method.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/Method.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/Method.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/Method.h
532654e3558209e3e6701bf06e338a2475bac5a6 07-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Fix Method location

Test: mma
Change-Id: Ib98fad29f356e0846e3e205ed40b4707e83ef84a
/system/tools/hidl/Method.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/Method.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/Method.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/Method.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/Method.h
7fa79f6ab1ded82691094bc6337bb8be39fae58d 09-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Merge structures with duplication features

TypedVar (function argument) and CompoundField (struct/union field)
have exactly same features: they store Reference<Type> type and string name,
so they are merged into one "Named Reference" type.

Test: compiles, hidl_test

Change-Id: I6135075e5a4e2d19589af16581ceac8ab430ecc9
/system/tools/hidl/Method.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/Method.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/Method.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/Method.h
d8b10ee0d559e764b5fd38aafedb2de455c8b935 01-Aug-2017 Steven Moreland <smoreland@google.com> Clean up CPP Method class.

Now emitCppArgSignature includes all arguments.

Test: hidl-gen host tests
Bug: 64066141
Change-Id: Ifa0cfe8cbc81fb5ab2b77ae4c3443f657f226907
/system/tools/hidl/Method.h
932464e77e181a98a55e65c046db7a63372b39f6 31-Mar-2017 Yifan Hong <elsk@google.com> Add Formatter::join

Test: pass
Test: hidl_test
Bug: 32559427
Change-Id: I44e27ba9b2e0fef605c340ba0f70f40ef0e6f390
/system/tools/hidl/Method.h
937408abc412733f46ba59e2342496b465e8c312 20-Mar-2017 Steven Moreland <smoreland@google.com> s/IMPL_HEADER/IMPL_INTERFACE/g

More appropriate name for this enum constant now that they are defined
in the interface source files.

Test: hidl_test
Change-Id: Ice531adb797c3213a2da18421b7e97fcfc888da3
/system/tools/hidl/Method.h
37065d636ffcb246da079837c1659dfab4d02438 07-Feb-2017 Andreas Huber <andih@google.com> Adds a debug(...) method to IBase, the base class for all Treble interfaces

The default implementation does nothing but this allows implementations to
emit diagnostics to a given file handle in a unified fashion.

Bug: 33961528
Test: hidl_test, hidl_test_java
Change-Id: Id7e8417275934c73032c9832c41e041d2d5d2fb7
/system/tools/hidl/Method.h
cd2ae45f51a5ad7089e2ec2fa922e2d4a0f7d136 31-Jan-2017 Yifan Hong <elsk@google.com> Add getReferenceInfo to IBase.

Also added a IMPL_STUB_IMPL for HIDL reserved methods that:
* add a method with the same name and signature
to BnHwFoo
* BnHwFoo::onTransact will call BnHwFoo::method instead of
_hidl_mImpl->method
* Content of IMPL_STUB_IMPL will go to BnHwFoo::method.

Test: make and tested NFC / light / audio
Test: hidl_test

Change-Id: I85f6314450178c02c7bcba91c8a9fffbce822c76
/system/tools/hidl/Method.h
ffa913993fb527b44053c11f139689d3267748ec 31-Jan-2017 Yifan Hong <elsk@google.com> Get method signatures from IBase.hal

instead of hardcoding them in hidl-gen.

Test: hidl_test

Bug: 32559427

Change-Id: Ib0d3beca695fca47eb5f82d5d54c651da9af3687
/system/tools/hidl/Method.h
dd85c5c9cc6ff58737809668d993c5e6eab673d7 04-Jan-2017 Zhuoyao Zhang <zhuoyao@google.com> Support to enable profiling dynamically.

* Add an additonal reserved method setHALInstrumentation to
enable/disable instrumentation during the hal execution.

Test: make hidl-gen
Change-Id: Iaf20e3f798a51b111bffd2e7294973bce0cabf9e
/system/tools/hidl/Method.h
115d428f9c38c078d679a98942c47ce4a17bd599 19-Dec-2016 Martijn Coenen <maco@google.com> Add (un)linkToDeath to generated interfaces.

(un)linkToDeath is now a part of IBase, and can be
called on any generated HIDL interface. The implementation
is a no-op, except in proxy objects, which are by
definition a different process than the interface they point
to.

Since clients are not aware of the transport implementation, we must
wrap the transport-independent callback in a transport-specific
callback object. In case of binder, that object is a
hidl_binder_death_recipient.

The binder proxy object contains a list of registered death
recipients, as well as a mutex to protect access to the list.
The list is required to allow us to map back transport-independent
callbacks to transport-dependent callbacks in unlinkToDeath().

Bug: 31632518
Test: mma, hidl_test
Change-Id: I5083a8789dd706a886a8a09f8c733031a351a36a
/system/tools/hidl/Method.h
7763ab3046cb998ac8a32b8d2312981631886813 14-Dec-2016 Yifan Hong <elsk@google.com> Disallow duplicated argument name or result name.

Test: compiles
Test: hidl-gen -Lc++ -r tests:system/tools/hidl/test \
-r android.hidl:system/libhidl/transport -o ~/temp \
tests.errors.syntax@1.0

Bug: 33277700
Change-Id: I67c0f8df1a23b1155664aa448d8422953a8a77c5
/system/tools/hidl/Method.h
068c5526a42abd22e5046fa6455f04e836aec96a 31-Oct-2016 Yifan Hong <elsk@google.com> hidl-gen: clean up generateCpp.cpp and generateCppImpl.cpp

Test: hidl_test
Change-Id: I18a9e0b27d40d607dc8b277d9e04eaa6f529f225
/system/tools/hidl/Method.h
10fe0b55e774903fe37b658458053527da8b5a53 19-Oct-2016 Yifan Hong <elsk@google.com> IHidlInterfaceBase for all autogenerated interfaces.

Add an interfaceChain() method to each interface
to facilitate casting between interfaces.

Add ::descriptor for each interface (so that
IFoo::descriptor won't fall back to
IHidlInterfaceBase::descriptor.

Test: hidl_test
Test: cd system/tools/hidl && mma
Test: cd hardware/interfaces/test && mma

Bug: 32337854
Change-Id: I317b7905750db0bfefc4c5fd608a07080923c719
/system/tools/hidl/Method.h
ef1a9feda3f09f87f0673cc978b36e1d4a8b4223 07-Oct-2016 Steven Moreland <smoreland@google.com> Get rid of call enum.

Bug: 31758541
Test: hidl_test, hardware/interfaces mma, manual inspection of output
files

Change-Id: I16c076dbff9b0b8688e2492b0b9c97e9f6d48943
/system/tools/hidl/Method.h
d537ab02e1707597d70665fd8c75ca1ec9f57326 12-Sep-2016 Steven Moreland <smoreland@google.com> Remove dependency on libutils.

As part of this, TypeDef has also been converted to a NamedType. This is
because originally, Scope contained just a KeyedVector<localname, idx> of
types which it contained, and an std::vector<type> which idx indexes into
(KeyedVector<localname, type> alone would have also worked). However, now
it contains a std::map<localname, idx> instead. Because of this, we have lost
the ability to iterate over the keys (localnames) in O(n). By converting
TypeDef to a NamedType, name => idx => type such that name == type->name.
This also means that in function hierarchy calling Scope::addType, we no
longer have to pass around the tuple (name, type) since type->name == name,
and we can pass around only type.

Change-Id: I8f85afe0e389979a2fd98ff5eeccf47e3fcc8307
/system/tools/hidl/Method.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/Method.h
a7a421a87c3721d3efa9b611cd5cd76cd566606b 07-Sep-2016 Steven Moreland <smoreland@google.com> Generalized cpp method generation.

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

Change-Id: I453af702f80aa4159ef6c3d29d9514b4897adc0a
/system/tools/hidl/Method.h
40d474a15ea87fb80b7344fba7602fbb2da2a449 16-Aug-2016 Iliyan Malchev <malchev@google.com> hidl-gen: callback elision for scalar returns

Suppose a HIDL method has a generates clause with a single scalar
(including an enum), for example as follows:

add(uint32_t a, uint32_t b) generates(uint32_t sum);

In this case, hidl-gen will emit the following method signature:

SimpleReturn<uint32_t> add(uint32_t a, uint32_t b);

SimpleReturn is a standard HIDL struct implementing a tuple of the
return value (in this case, uint32_t) and a HWBinder Status object. The
tuple can be used as a uint32_t, ignoring the Status value inside it, or
the status value can be extracted from it:

uint32_t tmol = ifc->add(41, 1);

or:

if (ifc->add(41, 1)) {
...

or

auto ret = ifc->add(41, 1);
if (ret.status.isOk()) {
...

With this, these methods that return a single scalar value do not have
to use the awkward synchronous-callback syntax.

b/30518487 Optimize out lamdas from HIDL C++ auto-generated code in
common cases

Change-Id: I83312e0b49d084c641c007df4a09e04a326b5245
Signed-off-by: Iliyan Malchev <malchev@google.com>
/system/tools/hidl/Method.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/Method.h
639bff877ed39a7605dab30055f7322b9c3df962 13-Aug-2016 Iliyan Malchev <malchev@google.com> hidl-gen: accept oneway methods

b/30843534: oneway methods seem broken

Change-Id: I122fc26b4054eb0952d209e6b8c18d3a2ea446df
Signed-off-by: Iliyan Malchev <malchev@google.com>
/system/tools/hidl/Method.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/Method.h
2831d5145675ead9f2fb767bf5fe4ae56b88349f 15-Aug-2016 Andreas Huber <andih@google.com> Initial commit of Java backend to hidl-gen.

Change-Id: I38b62637df74d3e5daf702a8996502d0d5726033
/system/tools/hidl/Method.h
3599d928cbed73ba3e3872c095c2d1f65796c733 09-Aug-2016 Andreas Huber <andih@google.com> Interface methods can now be annotated.

The syntax is a strict subset of what Java supports. The following are valid
annotations:

@Fragile
@LotsOfStuff(single="yes", many={"a", "b", "c"})

An annotation either has no parameters (in which case the name is NOT followed
by parentheses) or is does and what follows the name is a parenthesized list
of name=value pairs, where each value is either a single quoted string literal
or a list of quoted string literals surrounded by curly braces.

Change-Id: I3c51d771b7d55c8d16531286d011f61be700a21c
/system/tools/hidl/Method.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/Method.h
867fcb63af8c3ac96ed1b3f3950525aa70393bdf 03-Aug-2016 Andreas Huber <andih@google.com> bye bye, dump(), RefType no longer gets a name.
/system/tools/hidl/Method.h
881227d860c59471eee31d39946e96ce2daa35d6 02-Aug-2016 Andreas Huber <andih@google.com> generate C++ interface header, proxy and stub headers and sources.
/system/tools/hidl/Method.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/Method.h