Age | Commit message (Collapse) | Author |
|
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
Merged-In: I8988e1fdf16e15b925c0a613122c41e6a41bd4dd
Change-Id: I8988e1fdf16e15b925c0a613122c41e6a41bd4dd
|
|
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
|
|
Parent is needed for lookups:
scope = isScope() ? this : parent()
for ref : getReferences() {
AST->lookup...(ref, scope)
}
Bug: 31827278
Test: mma
Change-Id: I1bde29de43d224634d80949d719adc8de9cc8896
|
|
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
|
|
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
|
|
Test: compiles
Change-Id: Ibeba6c814ac17192481935a067b7c835c4008dc7
|
|
Bug:33114453
Test: make hidl-gen
Change-Id: Ia05d79e2d5f4233a58978c0e6fd0402a6f28c6a6
|
|
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
|
|
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
|
|
* Fix weird variable names in autogenerated code for vec<vec<T>>.
Bug: 31955917
Test: hidl_test
Change-Id: I83363a6d12babae1aba8e118451e1ec80492012c
|
|
as method arguments).
Bug: 31438033
Change-Id: I8e29ae8eca2a9ef8a320e37ca0bb79dcfa8a9b9a
|
|
Bug: 31438033
Change-Id: I254e8bfeb8fbf665dd3836825aa271603be6d14c
|
|
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
|
|
Change-Id: I453af702f80aa4159ef6c3d29d9514b4897adc0a
|
|
files.
Bug: 30575790
Change-Id: I6461235a1c469ce1bdb279bfa3d531113c5788f9
|
|
emit diagnostics if it is not. Also cleans up all other error messages to
clearly indicate an error condition.
Bug: 30876839
Change-Id: I18bcd723107ab93abcad38c976f3c38dda60a743
|
|
Change-Id: I38b62637df74d3e5daf702a8996502d0d5726033
|
|
|
|
|
|
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
|