History log of /system/tools/hidl/ConstantExpression.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d9d6dcbb14081aea0dd461346ed3cd5b74424d4b 21-Sep-2017 Steven Moreland <smoreland@google.com> Don't CHECK on too large literal.

If a literal is too large to parse, show correct user error.

Test: manual, run_all_host_tests.sh
Change-Id: Ic1b8f0cfcba8754050373e9846e51950ae284a57
Fixes: 64616572
/system/tools/hidl/ConstantExpression.h
82c048e98ad337a1771849a0b7c775c1d0d133e9 09-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Move lookup from parsing

Enables forward references!

Bug: 31827278

Test: mma
Test: tests in topic
Test: boots
Change-Id: I6c0599c3656db2a6c2246459330e4aed9fd2538b
/system/tools/hidl/ConstantExpression.h
a6d3388c2611bb04abeb87c53ce70967e6e246df 01-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Better constant expression acyclic check error messages

Makes constant expression acyclic check error messages look like
type acyclic check.

ex:
enum E {
A = D,
B,
C,
D
}

previous cycle print:
A at ...
B at ...
C at ...
D at ...

new cycle print:
D in A at ...
A in B at ...
B in C at ...
C in D at ...

Test: mma
Test: local test with moved lookups

Change-Id: I091792d4de049509708cb91331e8504e0edf14b9
/system/tools/hidl/ConstantExpression.h
77dd65c66019e219e8989327ae0c12b6527c2e2f 01-Sep-2017 Timur Iskhakov <iskhakovt@google.com> Pass that ensures that constant expressions are acyclic

Adds a check that constant expression definitions are acyclic.
Minor refactor of post parse passes order (with comments).
Refactor of constant expression passes (adds getReferences).

Bug: 31827278

Test: mma
Test: local test with moved lookups
Change-Id: Ic5764c6d5b403cfcefcf44f5c2015430633abb67
/system/tools/hidl/ConstantExpression.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/ConstantExpression.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/ConstantExpression.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/ConstantExpression.h
d27580c26d0832c052b139882141de8a3b36e586 10-Aug-2017 Timur Iskhakov <iskhakovt@google.com> Add `m` prefix to ConstantExpression child members

Variable `op` in existing macro
#define OPEQ(__y__) (std::string(op) == std::string(__y__))
is changed to `mOp` as well.

Test: compiles, hidl_test
Change-Id: I851a21b0e6821e82c0d858d22972d609f01892b2
/system/tools/hidl/ConstantExpression.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/ConstantExpression.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/ConstantExpression.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/ConstantExpression.h
30b5d1ffe964d0b82008bfc8f4b8e61ab3bac86f 03-Apr-2017 Yifan Hong <elsk@google.com> Add getHashChain() to IBase.

Each interface has a getHashChain() method that
returns the hash of all .hal files from the rtti
of the interface up to IBase.

Test: hidl_test

Bug: 36602587
Change-Id: I13f2e54bd45593c70064dff05fa934d5cd01996a
/system/tools/hidl/ConstantExpression.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/ConstantExpression.h
5706a43b2955b30f5611588dadfb9e33c7aa4c89 02-Nov-2016 Yifan Hong <elsk@google.com> Clean up ArrayType.cpp

mSizeComments are removed
mSizes are now a vector of ConstantExpression's

Bug: 32559427 clean up hidl-gen
Bug: 32592564 Remove extraneous comments from array type's sizes.

Test: hidl_test
Test: make hidl_test_java
Change-Id: I2a0dbf7e31a425ce851c9be3b413accdfcb79789
/system/tools/hidl/ConstantExpression.h
e77ca13d32e329fb1e516c27831b082082ef83c3 27-Sep-2016 Yifan Hong <elsk@google.com> Fix the bug that cast should not be public.

cast is a templated function and should
not be public.

Test: `mma`
Change-Id: I30193e022c210c78b16fdf3b5f331a0ef3cbbb27
/system/tools/hidl/ConstantExpression.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/ConstantExpression.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/ConstantExpression.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/ConstantExpression.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/ConstantExpression.h
1aec397b1fdea7db4120dbe55b6995bb2a9d9138 26-Aug-2016 Andreas Huber <andih@google.com> Adds (C)opyright headers everywhere.

Change-Id: I453af702f80aa4159ef6c3d29d9514b4897adc0a
/system/tools/hidl/ConstantExpression.h
521656973a277bd727a96fa812315daf416668f4 13-Aug-2016 Yifan Hong <elsk@google.com> parsing major operators.

Do not evaluate the expression, but rather only check
for syntatic errors and resolve for precedence.
* only enum_values are parsed.
* annotation parameter values, and array sizes are NOT parsed.
* Unary, binary, and ternary operators supported.
* Assignment operators are NOT considered.
* Cast is NOT supported.
* Pointers are NOT supported.
* Emitted expression doesn't work for Java.

See Ic1f524c604fc72b9d1b7b330b608ff38ce287921 for tests.

Along side with some code for handling float literals
for future use.

Change-Id: I67ff0767a67c66b62e5ddfe75954f94d45ac7793
/system/tools/hidl/ConstantExpression.h