History log of /system/tools/aidl/aidl.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
8decf95ffeffcc8aa14aa743ae398bc38d54b0ac 03-Jun-2016 Christopher Wiley <wiley@google.com> Always build absolute paths the same way

Fix a bug where output paths like:

C:\foo\bar

triggered bad logic to detect relative paths and turned the path into

.\C:\foo\bar

Fix this by moving absolute path detection logic into a common helper
function and calling it consistently.

Bug: 29091703
Test: unittests, angler-eng builds with this change, manual testing on
windows demonstrates issue is fixed

Change-Id: I8bc83a3e3943931d95db3e4147d4f8b1b07e907a
/system/tools/aidl/aidl.cpp
303b43ca5a93ce89f438ad4dd200c0ca317832de 21-Apr-2016 Christopher Wiley <wiley@google.com> Generate a trivial dep file for parcelables

It turns out that the SDK tools request this.

This is a cherry-pick of b1bbdf80cb9fcd8181aa2cb326317929cfac890c.

Bug: 28091660
Change-Id: Iba08f116086953d01c0383f4e26049b2ddfe9b29
Test: unittests pass, added another
/system/tools/aidl/aidl.cpp
8f314b0d4c3f195c98c6dd7e671fc2b9d4bfa76f 12-Apr-2016 Christopher Wiley <wiley@google.com> Output correct dependency file with only output dir

This is a cherry-pick of f813619816eb56fd852b6e567bf8b1e79442e3e1.

There are three ways aidl can decide on the path to write
generated java:
- A literal output path
- Writing output next to the input (no output directory given)
- Writing output to an output directory

Fix a bug where we were writing an incorrect dependency file in the
last case, where we are given an output directory, but no output path.

Bug: 28091660
Change-Id: I7fa743c6f32292e44439b7dc3ce7e49421b93d05
Test: added a unittest
/system/tools/aidl/aidl.cpp
934a82d1b045a5944d115dece4cf01f539103c11 27-Jan-2016 Christopher Wiley <wiley@google.com> Make TypeNamespace take AidlNode subclass arguments

Because annotations are attached to AidlType, we need to know the
complete AidlType of arguments and return values in order to decide
which generated type to use. Make it an invariant that a TypeNamespace
takes only subclasses of AidlNode from aidl.cpp to make this easier to
reason about.

For now, leave most of the existing implementation in place, but push it
down into LanguageTypeNamespace.

Bug: 26729450
Test: unittests still pass

Change-Id: I6684564995c734def96daeccc03dfd5d264469ee
/system/tools/aidl/aidl.cpp
e22b41a8ecf20704050ef6dd4abdd0a39adb2320 25-Jan-2016 Christopher Wiley <wiley@google.com> Consolidate logic to retreive language specific type

In preparation for adding some special casing to the "String" AIDL type,
consolidate the logic to pick a language specific type from the aidl
type into a single helper function GetTypeImpl().

Rename GetValidatableType to GetTypeByName to avoid confusion and
better describe the semantics of that method.

Bug: 26729450
Test: unittests continue to pass

Change-Id: Ie9391ea90a31da77657353a87031492849b58409
/system/tools/aidl/aidl.cpp
3a9911cc8fd881effadbdf51e8f4cf721a1d9601 19-Jan-2016 Christopher Wiley <wiley@google.com> Write C++ and Java specific dependency files

The dependency file for C++ encodes that generated .cpp and .h files
depend on the source aidl and imported aidl files. This is unlike
Java which only has a single .java file.

Bug: 26409006
Test: Unittests continue to pass

Change-Id: I97f3646cd28803a6dadc7bd0bd35632218dae559
/system/tools/aidl/aidl.cpp
57dbe24bcb8f4509a876e8445c78d9504d7e616a 04-Dec-2015 Casey Dahlin <sadmac@google.com> Add support for @nullable annotation

Using this annotation will now cause C++ types to be wrapped in
unique_ptr, and by extension be capable of handling null values.

Support extends to all arrays, Strings, Lists, and Parcelables.

Change-Id: I148a3666279c2badcba097b8925e55f8fcecb9c2
Test: Unit tests pass
Bug: 25969194
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
a2f77c40fb6287895e2030055c0104eac0a1f73a 02-Dec-2015 Casey Dahlin <sadmac@google.com> Make array types their own type object

We now offer much simpler functionality from type objects. In addition,
we attach type objects to the appropriate AST nodes, so generators can
just read and trust the model.

Test: Unit tests pass
Bug: 25939691
Change-Id: Id274a933c7bd4f1e5d6daf2b89a64b3553a37069
/system/tools/aidl/aidl.cpp
0a62067f35e957493bc37c4b42dfdcfc16353831 04-Dec-2015 Elliott Hughes <enh@google.com> Track base/ -> android-base/ change.

Change-Id: I02b64b42c17d248c5fb2c4de4b0778a441e018e3
/system/tools/aidl/aidl.cpp
d40e2fed2c19850d53f1620322ac5cbca2c0e245 24-Nov-2015 Casey Dahlin <sadmac@google.com> Introduce integer constants

We can now declare a "const int" variable in an AIDL interface, in
addition to methods. These constants will become static members of the
interface/base class in the generated code.

Change-Id: I6b690ecbbe2acae37abb106510e42283f0753f26
Test: Unit and integration tests updated and pass
Bug: 23600061
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
c1f39b4ea30e7313eeb7f3d3fd5ec66ba00f2bb5 24-Nov-2015 Casey Dahlin <sadmac@google.com> Refactor top-level AST nodes v2

The previous version of this patch was tainted by parts of another
change to remove a memory leak, and ended up trying to treat a bare
pointer like a unique_ptr in a few places. This combines both changes in
to one.

Previous patch was b696437d842d59c0cc26411fa3d71cb91897c572:

We now return an AidlDocument from parsing. This type is non-polymorphic
and contains either a vector of parcelables or an interface. This gets
rid of all of our reinterpret_cast calls and the public item_type field.

Change-Id: I77fbb1d8448343bd02484d896289a514d636df25
Test: Unit tests pass
Bug: none
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
eedb29f028af472b90fa528c84d0d89100346e5c 24-Nov-2015 Bart Sears <bsears@google.com> Revert "Refactor top-level AST nodes"

This reverts commit b696437d842d59c0cc26411fa3d71cb91897c572.

Change-Id: Id5c716536299cfad4d13c5891d9be8b1fa2aceae
/system/tools/aidl/aidl.cpp
b696437d842d59c0cc26411fa3d71cb91897c572 17-Nov-2015 Casey Dahlin <sadmac@google.com> Refactor top-level AST nodes

We now return an AidlDocument from parsing. This type is non-polymorphic
and contains either a vector of parcelables or an interface. This gets
rid of all of our reinterpret_cast calls and the public item_type field.

Change-Id: Ia15ace677f79a153f8ebfad84ed43b08f4a3685f
Test: unit and integration tests pass
Bug: 25479378
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
8aa4d9f32dcfb37011d41417814c01bd2d7a473b 17-Nov-2015 Christopher Wiley <wiley@google.com> Add C++ header to AidlParcelable

In situations where a parcelable declaration includes a C++ header,
propagate that information to the AidlParcelable object. While here:

- remove support for the C++ type alias (the is keyword)
- consolidate AidlParcelable constructors to always use
AidlQualifiedName

Bug: 23600712
Test: unittests pass, integration tests pass

Change-Id: I058d8c2012bb0e5e07bbb6599ac5108f7866ad6e
/system/tools/aidl/aidl.cpp
e60d99ca384141694bca8095eebb47640b6fe12a 06-Nov-2015 Christopher Wiley <wiley@google.com> Fix up logging on parcelable in .aidl file

Bug: None
Test: None

Change-Id: I65d328f3264027e12cac5828bd987b0b3ae338ae
/system/tools/aidl/aidl.cpp
632801d891bd269badc780ab5f0f08e56e6df10a 05-Nov-2015 Christopher Wiley <wiley@google.com> Respect aidl's -b flag again

This flag indicates that we should (or not) report errors on
encountering a parcelable in an input .aidl file. In the platform
build we always break on parcelables, since we only get called with
interface definitions.

We need to obey this in order to not break Android studio's usage.
There, developers expect to put *all* .aidl files into aidl and have it
only generate code where appropriate.

Bug: 25501507
Test: unit tests

Change-Id: I91df9b0ef65d4d063a7a898a5948d0429af3e255
/system/tools/aidl/aidl.cpp
19059cb70c5330787ba88f3860444e6da3ef3ca0 06-Nov-2015 Christopher Wiley <wiley@google.com> Generate a dependency file for C++ output

Bug: 23600457
Test: unittests, added another

Change-Id: Ic1834badc396d444057a58f3868bcf343dcc933d
/system/tools/aidl/aidl.cpp
ef4132c27c313d9c84faf77a84a4ac97f69445b3 06-Nov-2015 Christopher Wiley <wiley@google.com> Remove Java dependencies of dep file generation

Bug: 23600457
Test: unittests continue to pass

Change-Id: Ifd4ce4f4141f7c2a3b5c9c8223230008bc7f5bb7
/system/tools/aidl/aidl.cpp
ef1409302aa97b1807e55c63588ac0a428f41a06 03-Nov-2015 Christopher Wiley <wiley@google.com> Allow mocking of preprocessed file read

Bug: 17415692
Test: Clean build of AOSP succeeds.

Change-Id: I723031e9847b589909825736f1094e6bba039f7a
/system/tools/aidl/aidl.cpp
5679952c38925a54b75b087068887002e57f3174 31-Oct-2015 Christopher Wiley <wiley@google.com> Don't call virtual methods in TypeNamespace constructors

While probably safe in this particular context because of this specific
class structure, it is bad practice to call virtual methods in constructors.

Bug: None
Test: unittests continue to pass

Change-Id: I3c9a435efd89a2c2bd7ce576aed585b8ab766bda
/system/tools/aidl/aidl.cpp
6453351b3ee9ce9b91650a8175464a6e339130c7 24-Oct-2015 Casey Dahlin <sadmac@google.com> Use IO delegates to create path in compile_aidl_to_java

Change-Id: I654e97d4149b0eb247fb683f9fefc2a7121f3507
Test: Unit tests pass
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
cd8e89795c331e3e5c75e92d7c7804f389804e08 26-Oct-2015 Christopher Wiley <wiley@google.com> Consolidate container canonicalization logic

We need this same logic while piecing together C++ types because
we still have to reason about the type names used in AIDL.

Bug: 24470786
Test: unittests pass, integration tests pass

Change-Id: Ief2d531e1dace5e5e299f3aa246a870eb9c932c6
/system/tools/aidl/aidl.cpp
45db9eec8a0bb71ba1afb5b8c9da72fd0f60028f 27-Oct-2015 Christopher Wiley <wiley@google.com> Clean up reporting of bad oneway return/out params

Change the messages on detecting a bad parameter direction from:

a/IFoo.aidl:1oneway method cannot have out parameters: f

to the more readable:

a/IBar.aidl:1 oneway method 'f' cannot have out parameters

Bug: None
Test: unit test output is prettier

Change-Id: I1b8da80edf4d04c0fae110c941300afa2080deb7
/system/tools/aidl/aidl.cpp
90be4e3fe6d16ea8e8263b80989ef2ab4e6ef9c6 20-Oct-2015 Christopher Wiley <wiley@google.com> Fix segfault on missing package declaration

Add unittests to enforce this doesn't happen again. While here
add unittests for out params in oneway methods and make
ownership of AidlInterface pointers more explicit.

Also fix a bug where we would disallow returning void from functions
in C++ generation.

Bug: 24862770
Test: Unittests pass

Change-Id: I4fa67489ad1fff0d4453d38689e54b9f5ad08c43
/system/tools/aidl/aidl.cpp
0c6fcecd6b74cf5f02c6fa0793be51e2f7fbf191 20-Oct-2015 Casey Dahlin <sadmac@google.com> Make AIDL forbid return values/out parameters for oneway methods

Change-Id: I1a648eea272c826cab45947b2f63c552fa787d6d
Test: Full android build
Bug: 25118670
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
a30a45e7b7cdd3c4b5b7c5dcc6ce005abfe7c90f 17-Oct-2015 Christopher Wiley <wiley@google.com> Mock IO in all unit tests

Bug: 24816077
Test: unittests pass

Change-Id: I3e269106727370173a45a3443602a33eb4d7e9f8
/system/tools/aidl/aidl.cpp
b656a3b1954bbe4b548a3c11274c833bbca35935 16-Oct-2015 Christopher Wiley <wiley@google.com> Generate C++ in namespaces based on package

Bug: 24862770
Test: unittests

Change-Id: Iaa3b4716ca340ade745208a2f2efc057205d0f1d
/system/tools/aidl/aidl.cpp
d76067c52b6bc0587aa26ecae34a49e6cbdae404 20-Oct-2015 Christopher Wiley <wiley@google.com> Introduce GetSplitPackage() for AidlInterface and AidlParcelable

Bug: 24862770
Test: unittests

Change-Id: I9ef8279f03fd914e40d80939d242071c469a1864
/system/tools/aidl/aidl.cpp
054afbd3037addb4f2e245ecbc36f31d3040f877 17-Oct-2015 Christopher Wiley <wiley@google.com> Change C++ output to match make expectations

- generate a single C++ output file
- put headers into an output directory
- create the output directory structure using an IoDelegate

Bug: 23599697
Test: Unittests pass

Change-Id: I0f7b821678cd5adc00b2fdba06b52b235c724467
/system/tools/aidl/aidl.cpp
98a544b567e20f6c8492e1d4eb8869e759ae74d9 14-Oct-2015 Casey Dahlin <sadmac@google.com> Remove parse_helpers.cpp/h/unit tests

This test was very silly, and the contents of this file are better off
elsewhere.

Bug: 24948220
Change-Id: I800c9035806ba42038dab8a681755d0ce581a530
Test: Unit tests
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
624358c0681569748611c9d02186ab402e175798 13-Oct-2015 Casey Dahlin <sadmac@google.com> Revert "Revert "Remove AidlImport::GetDocument""

This reverts commit c819f23804c191174c8d3f70b3e592ebd210a876.

The original commit only needed to be reverted in order to revert a
dependency.

Change-Id: I7a7d08e8bfeaa97dac1122a202544884b10254b8
/system/tools/aidl/aidl.cpp
42727f851672ff8f3099db81fa21c969e553e150 13-Oct-2015 Casey Dahlin <sadmac@google.com> Parse only one interface, only Parcelables are lists

This is a fixup of the change that was reverted in:
2d0179a123a3d212fdd9d1baa02ce473b688b360

We're encoding the restriction of only one interface per file directly in
to the grammar/type system now. This simplifies much.

Change-Id: Icaac11cb6121327066acd01952b8dec0cfbe9376
Test: Full android build
Bug: 24874768
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
2d0179a123a3d212fdd9d1baa02ce473b688b360 13-Oct-2015 Christopher Wiley <wiley@google.com> Revert "Parse only one interface, only Parcelables are lists"

This reverts commit e6af22640312894664b4443aba909b6fe49f17f5.

I suspect this change broke the build. It broke our unittests.

Change-Id: I124b92d0a5b6e91fe21536b738c34e776bcf2c32
/system/tools/aidl/aidl.cpp
e6af22640312894664b4443aba909b6fe49f17f5 13-Oct-2015 Casey Dahlin <sadmac@google.com> Parse only one interface, only Parcelables are lists

We're encoding the restriction of only one interface per file directly in
to the grammar/type system now. This simplifies much.

Test: Full android build
Bug: 24874768
Change-Id: I342344b6f7b2e59f334756027ed5e72228d1d102
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
59401da7787cbc224785c0a03c30f6392445c1ec 10-Oct-2015 Casey Dahlin <sadmac@google.com> Put parcelable members behind getters

Bug: 24410295
Change-Id: I28b70254c8e1846eaeab8523da5975843e86e0de
Test: Full android build
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
5ac90207bcdd1fbaee5ed12c50481d6f2a51a44a 10-Oct-2015 Casey Dahlin <sadmac@google.com> Use reinterpret_cast where appropriate

Change-Id: Id9b35f569a4245114d3868981ecd100f0f8b277a
Test: Unit tests
Bug: 24812236
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
fb7da2e62fe66b0a57ffbb0304f5884024a68f1c 09-Oct-2015 Casey Dahlin <sadmac@google.com> Put AidlInterface members behind methods

Change-Id: Ib367a9183e734a008acecf90c5f3f25e51e16b37
Test: Full android build
Bug: 24410295
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
1ae2bc56d20fe0e19262f2721abc338662fa6e30 08-Oct-2015 Casey Dahlin <sadmac@google.com> Convert document item structs to classes

This is the least-complete first run for any of these structs, but this
shift is going to be particularly gnarly, so we need to be
extra-incremental about it.

Change-Id: I7295add8b9a1291f229743f8c36d941569a16ab6
Test: unit tests
Bug: 24410295
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
0edf34239909bbc16e884ea2517e5f3398185d0f 07-Oct-2015 Casey Dahlin <sadmac@google.com> Replace import_info struct with AidlInfo class

We extend this from AidlNode because we hope to make it part of the tree
someday instead of a second item of global state to register with the
parser.

Test: Unit tests
Bug: 24195596
Change-Id: I678a002855808469b08e726258b4daf13e3f6f00
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
72877acd3b57462fcd452bff4a9d7ff936936a8e 06-Oct-2015 Christopher Wiley <wiley@google.com> Add ImportResolver class

This class delegates to an IoDelegate for file I/O.
This replaces the search_path.* files.

Bug: 24703046
Test: Unittests pass

Change-Id: I261f6066cef514926b45174988863b745a37e87c
/system/tools/aidl/aidl.cpp
4a2884b0e9414ed9dfee4e141e8bd462c07b442b 07-Oct-2015 Christopher Wiley <wiley@google.com> Read all files through IoDelegate

This allows us to easily fake out file IO in tests.

Bug: 24703046
Change-Id: I33a59c8e43489b03f27f99fb2949e58cc0311eb1
Test: unittests still pass, clean build of android passes
/system/tools/aidl/aidl.cpp
3c6df36e1b5b1b14a7f8863d05e67dfd6caa51f7 07-Oct-2015 Casey Dahlin <sadmac@google.com> Parse package names in parser not lexer

We also take this opportunity to neaten up the lexer code.

Change-Id: I0220f827144be768bcf771e240125e805c93d670
Test: Full android build
Bug: 24680682
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
f4a9311fa018c78a7b30a73bd8ebbaa33c701ae4 06-Oct-2015 Casey Dahlin <sadmac@google.com> Put data in AidlMethod behind getters and setters

Change-Id: I453ab9bcbbc610df4109d691283e7b872e0078a4
Test: Unit tests
Bug: 24410295
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
f2d23f7f05252fa1a06a8f95bd9475fa9d414c0c 03-Oct-2015 Casey Dahlin <sadmac@google.com> Kill comments token in AidlMethod

Change-Id: I3df6629eaa5b56093d2453269d4b138987bee7ce
Test: unit tests
Bug: 24410295
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
2cc93169679e222dda71c73814f28a9fb0832166 03-Oct-2015 Casey Dahlin <sadmac@google.com> Introduce load_aidl_for_test in C++ tests

We have to relax some of the errors about unsupported functionality in the C++
type checker to do this, but hopefully this is less brittle.

Change-Id: I53af52b83e6becfe13c3bb3a00f3b70e0691cf85
Test: unit tests
Bug: 24618841
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
5c69deb2a90d487d7b57618eb07a34c85c8112e7 01-Oct-2015 Casey Dahlin <sadmac@google.com> Replace method_type with AidlMethod

As usual, we're leaving most of the same members in place and public. However,
we have removed the linked list pointer and switched to std::vector for lists
of methods.

Change-Id: Id0aa55340e2c56bfa1001c6c8a8343bb4815d38e
Test: unit tests
Bug: 24410295
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
0ee3758e1f452a8bf99a5975b4f585035369d8fb 01-Oct-2015 Casey Dahlin <sadmac@google.com> Replace type_type struct with AidlType class

Change-Id: I642f55dba89681cd7dbf61880b4092c8d27050a6
Test: unit tests
Bug: 24410295
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
e3550c6679939d2bf5f35c540cd83198ab156fb7 29-Sep-2015 Christopher Wiley <wiley@google.com> Use C++ TypeNamespace when generating code

Bug: 24472672
Test: unittests pass

Change-Id: I815af3cd3172621255dd8d041bb02d7013ed4cfe
/system/tools/aidl/aidl.cpp
dff80e51334ba15850f21189f47665d2fc846b68 29-Sep-2015 Casey Dahlin <sadmac@google.com> Remove interface_item_type

This was a polymorphic struct with only one sub-type. Why not cut down a
bit?

Change-Id: I6030d3b4e40ae5e3d4b5cd688b59c8839b12acd4
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
030977aecb0b253ec1a1d55cdc18930069cb6390 29-Sep-2015 Casey Dahlin <sadmac@google.com> Remove usage of malloc in favor of new

This reverts commit b2116869ba878222d607807be594366b6e9392f7.

Test: unittests
Bug: 24469748
Change-Id: I82de5a12cf851ffdacc2c7969a2429746ba7a772
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
f944e79bdaf92fffe9ea78314d3636e7e4de8c51 29-Sep-2015 Christopher Wiley <wiley@google.com> Move C++ generation code into C++ namespace

Use this namespace to shorten the class names now that we
needn't distinguish them as C++ specific.

Test: unittests pass

Change-Id: Idace1e87be1e9fd5129550941532d05be83ec985
/system/tools/aidl/aidl.cpp
db154a5f543ff697248df649a14f2ac4a70cbf0e 29-Sep-2015 Christopher Wiley <wiley@google.com> Move Java related code into a java namespace

This lets us use names like Type instead of CppType for generated
code specific to C++. C++ code will similarly go in its own namespace.

Bug: 24472672
Test: Compiles, unittests pass

Change-Id: I10fc8ce6436e297eb36c7b63e0c6d78a45bf2a19
/system/tools/aidl/aidl.cpp
bc7a50a9bb4b97affc05f872d0cce02e54861e23 29-Sep-2015 Casey Dahlin <sadmac@google.com> Turn arg_type into a class called AIDLArgument

We also get rid of its linked list property and use std::vector to store lists
of arguments in method_type.

We still expose most of the same data publicly, but there's going to be a lot
of high-touch changes coming with this transition so it's better to break the
change set here.

Change-Id: I71a3dfe1e0fb9cd9437ec81de681b72137fc02cf
Test: unit tests
Bug: 24410295
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
b2116869ba878222d607807be594366b6e9392f7 29-Sep-2015 Christopher Wiley <wiley@google.com> Revert "Remove usage of malloc in favor of new"

This reverts commit b992b450093546d275d2da4b544a611700536e29.

The build's address sanitizer is complaining that we're calling delete[] on a 3 byte region allocated with malloc().

Change-Id: I03e667e1b64a9b298607d0709747c02c8f7d0da6
/system/tools/aidl/aidl.cpp
fb4b22dfbe0f87aaad492dc8a25201179c235bae 26-Sep-2015 Christopher Wiley <wiley@google.com> Explicitly create container types

Now we explicitly give ourselves a change to create each
container type before attempting to resolve a type name
to an instance of Type. In the process we finally remove
all knowledge of specific types from aidl.cpp by moving
logic into the TypeNamespace itself.

Bug: 24303749
Test: Compiles, unittests, clean build of aosp_arm passes.

Change-Id: Ie5e1b29020618863dac9417e0a60730ddb0dfc02
/system/tools/aidl/aidl.cpp
b992b450093546d275d2da4b544a611700536e29 28-Sep-2015 Casey Dahlin <sadmac@google.com> Remove usage of malloc in favor of new

Change-Id: Iee22541081caf78e295f7a05e248bfdee0bc8770
Test: unittests
Bug: 24469748
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
8b2d3ee344b982b0ea387c08e596fd639e22309a 24-Sep-2015 Christopher Wiley <wiley@google.com> Remove NAMES global type namespace

We now pass around an instance of JavaTypeNamespace to
resolve types.

Add a const pointer to this namespace to java Type objects.
This enables a lot of cases where we need to refer to the
type namespace as we dynamically resolve types.

Prototype a method to remove INT_TYPE global constant by looking
up the appropriate type in an instance of JavaTypeNamespace.

Bug: 24303749
Test: Compiles, unittests pass

Change-Id: I3bb25ffb875e1e55f0548b6cd0e84e3e8bbf817e
/system/tools/aidl/aidl.cpp
a2f516d6e44622a7affcb8ebef78fbf3a453f2b9 24-Sep-2015 Christopher Wiley <wiley@google.com> Exit immediately when input is not an interface

Change-Id: I2ebe07755fe2cf50283e1bc82856eed47836aefd
Test: compiles, unittests still pass
/system/tools/aidl/aidl.cpp
84c1eacc7f09377d7724f0783187b0477fe7c2ba 23-Sep-2015 Christopher Wiley <wiley@google.com> Use TypeNamespace instances in aidl.cpp

Refactor much of the logic around types into an instance of
TypeNamespace. This class defines an interface to type reasoning
logic that aidl.cpp can use to register binder and parcelable types
it loads during parsing. Code generation can use a language specific
subclass of the type namespace to reason about types more specifically.

For now, leave NAMES and the global type constants intact. We'll
refactor those in a separate change if necessary.

Bug: 24303749
Test: Compiles, unittests pass

Change-Id: Ie56a89159c956c587a1ff3e45d38d1850b04a9f2
/system/tools/aidl/aidl.cpp
281d6f0c80058e6899cc5a43f4a010d60a7ccec5 24-Sep-2015 Casey Dahlin <sadmac@google.com> Forbid arguments from starting with _aidl

Change-Id: I784dca693acfdf0fe9cd0c4ac3d6acb1b0a201a8
Test: unit tests
Bug: 24342609
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
214c916028246ac6ede992877adfd8def175c8dd 24-Sep-2015 Christopher Wiley <wiley@google.com> Revert "Use TypeNamespace instances in aidl.cpp"

This fixes a build break while we investigate.

This reverts commit d03b54f61d1a0fb1a2791ee96d476180a5d38c85.

Change-Id: I200e7a6c84274e71ea661f8d952807e8266c5e54
/system/tools/aidl/aidl.cpp
d03b54f61d1a0fb1a2791ee96d476180a5d38c85 23-Sep-2015 Christopher Wiley <wiley@google.com> Use TypeNamespace instances in aidl.cpp

Refactor much of the logic around types into an instance of
TypeNamespace. This class defines an interface to type reasoning
logic that aidl.cpp can use to register binder and parcelable types
it loads during parsing. Code generation can use a language specific
subclass of the type namespace to reason about types more specifically.

For now, leave NAMES and the global type constants intact. We'll
refactor those in a separate change if necessary.

Bug: 24303749
Test: Compiles, unittests pass

Change-Id: Ie961dcef4f10bc23932ce45c39a1b190d272ab72
/system/tools/aidl/aidl.cpp
8f6816ea1fb532cff9ce0ecc1449926553b4e1da 23-Sep-2015 Christopher Wiley <wiley@google.com> Don't allow non-const pointers to Type instances

This makes the namespace into a read only datastructure of types
with a few methods to load types during parsing.

Bug: 24303749
Test: compiles, unittests

Change-Id: I0873e520d771b348a1a8ec9515b6e7b9a8a29298
/system/tools/aidl/aidl.cpp
775fa1f7db4626b85e5185149b054821fc605c2b 23-Sep-2015 Christopher Wiley <wiley@google.com> Rename Type.* to type_java.*

We'll soon have type_cpp variations on these files, and a more
generic type.h

Bug: 24303749
Test: Compiles, unittests

Change-Id: I64f45efa3553f1a46d2d16d6652eedd6b324b2e4
/system/tools/aidl/aidl.cpp
9a8e1d9ad667faff9272e0e99b37a6aeba2d8d20 19-Sep-2015 Christopher Wiley <wiley@google.com> Generate .cpp/.h files with aidl-cpp

These files contain only stubs for now but we can now create them
with a command like:

./out/host/linux-x86/bin/aidl-cpp \
external/easybinder/IPingResponder.aidl \
out/demo/

Test: Above command generates code, unittests
Bug: 24220933

Change-Id: I283971dda61d05949ff74057e6e7d3f276380601
/system/tools/aidl/aidl.cpp
eb1acc1cf7dbf578d8ab2e596982c4c635aa9865 16-Sep-2015 Christopher Wiley <wiley@google.com> Refactor compile_aidl flow to support compiling C++

Bug: 23599760
Test: unittests

Change-Id: Id6cbe6ea8161be6ebf449e47b3934993e6b6ad13
/system/tools/aidl/aidl.cpp
c16e5e70c0d570839f41c49a900035c5c82ecd95 16-Sep-2015 Christopher Wiley <wiley@google.com> Simplify the logic in compile_aidl_to_java()

1) Explicitly check that the input .aidl file has exactly one
declared item, and that it is an interface.
2) Use a few C++isms to simplify some loop structure.
3) Reduce levels of nesting in loops by continueing on errors.

The code may have at some point supported declaring parcelables next to
intefaces, but later assertions (file names match declared classes) make
this impossible in practice. Since it simplifies the code to do so,
make the check explicit.

The build system always passes -b (for break on parcelable) when
compiling aidl to java (as opposed to preprocessing), so this is how the
tool is used in practice.

Test: unittests pass, clean build of aosp_arm works
Bug: 23599760

Change-Id: If291cdd9d02a25df0be08c04a45ba379be7d0969
/system/tools/aidl/aidl.cpp
3a9d1581bd54255fbfcbc09b852b4b78d32d0a6d 16-Sep-2015 Christopher Wiley <wiley@google.com> Run clang-format against compile_aidl_to_java()

This change is purely a reformatting.

Test: unittests
Bug: 23599760

Change-Id: Ic9a65b7803edd8d62d136752f0a8c2fb56f65010
/system/tools/aidl/aidl.cpp
9980181fae4239b0161878de2947ff2ccc8d5f82 16-Sep-2015 Casey Dahlin <sadmac@google.com> Make RunParser return consistent/consistently used

Change-Id: I054e296fe9922c19d9c79adb1a11c8f138ad0191
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
f690be5044a56fdf75bb0bcae640074ec97023cd 15-Sep-2015 Christopher Wiley <wiley@google.com> Minor cleanup of aidl.cpp

1) Move some helper functions to parse_helpers.cpp
2) Refactor some helper functions to take advantage of C++ built ins
3) Add unittest coverage of refactored logic
4) clang-format -i -style=Google parse_helpers.cpp
5) Move remaining helper functions of aidl.cpp into anonymous namespace

Change-Id: I3a2cf7be113ac7f71a1a3502b12a8ed910509546
/system/tools/aidl/aidl.cpp
e25074935064cf06d30568ca61f2aaa0f75f0b9a 15-Sep-2015 Casey Dahlin <sadmac@google.com> Kill psGlobal and g_callbacks

No more callbacks. No more unsafe pointer cast (fixes Bug 23977313).

The best part is that the entire YACC/FLEX portion is now behind an object
from the rest of the program's POV.

Test: Ran unit tests
Change-Id: I9e38953bd0e65b8f1fad87ff2df049643ef6cc73
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
a590de8d148bb42aa5f1f32aec6faae18a28e720 16-Sep-2015 Christopher Wiley <wiley@google.com> Define aidl-cpp executable

This executable has a distinct usage which reflects that it generates
a very different sort of code.

Bug: 23599341
Test: unittests pass, added new Options unit test

Change-Id: I6750e7146949659a3af0246ad1bca0fa23afb2d5
/system/tools/aidl/aidl.cpp
89eaab56f3ff913c247397b858fac3c8d3d4a206 15-Sep-2015 Christopher Wiley <wiley@google.com> Rename Options to JavaOptions

The aidl command line interface exposes a lot of knobs that
are not used in practice and complicate the internal logic to support.
For C++ generation we have an opportunity to reduce the exposed surface.

Begin by renaming Options to a more specific JavaOptions.

Test: unittests pass
Bug: 23599341

Change-Id: I76478ab2fb12612bf7120a1af28c8db1da9ed22f
/system/tools/aidl/aidl.cpp
8f8cc9b91a8d0b4942a978e9d2edc5337503d583 14-Sep-2015 Christopher Wiley <wiley@google.com> Follow style guide for Options field naming

Bug: 23599341
Test: unittests

Change-Id: I113810186e67efe7ef657195664e683ab55e829f
/system/tools/aidl/aidl.cpp
4427d8654985209c1ebf2fb4705bb3e1a4262be2 14-Sep-2015 Christopher Wiley <wiley@google.com> Basic cleanup of parsed options

1) Turn it into a proper C++ object
2) Don't leak Options objects
3) Don't mutate Options objects
4) clang-format -style=Google -i options.cpp

Bug: 23599341
Test: unittests

Change-Id: I06597dd21e94ff391a08ea1bdb8f3a526123b3dc
/system/tools/aidl/aidl.cpp
fdeb0f4b96b6c39b1b9ed3358634f180f9e6df06 12-Sep-2015 Christopher Wiley <wiley@google.com> Abstract away file IO when writing generated code

This allows us to write unittests of Java/Cpp AST elements without
doing file I/O each time. Introduce a CodeWriter class which
may write to either a string or a file dependening on the contect.

While here, mark the write methods as const.

Test: Compiles, unittests pass, added new unittest demonstrating usage.
Bug: 23598995

Change-Id: I240ede41f0f9c04c0d14d1a3680ce5ab332babbc
/system/tools/aidl/aidl.cpp
dd69181114098550f84186442ef453754570075d 10-Sep-2015 Casey Dahlin <sadmac@google.com> First pass on reentrant C++-ish parser

We're flipping Flex/Bison in to reentrant mode, cutting down on global
variables, and exposing a more C++-like interface earlier. This is the first
phase. There's still a couple of weird hacks to deal with the previous code's
reckless disregard for scope sanity, but the outline of things to come is
starting to appear, and this CL really doesn't need to get any bigger.

Change-Id: Ife2d70db026d7ab1319bdf6c586959315666d0bb
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
88868fc6566d371bf04180c429964bc699effb55 01-Sep-2015 Casey Dahlin <sadmac@google.com> Remove RPC interface Type

AIDL previously supported "rpc" and "flatten" types, which are not used
anywhere in the Android tree. This patch removes them, which significantly cuts
down code and complexity.

Bug: 23517584
Test: Rebuilt AOSP tree against new version
Change-Id: I6cf38d43c1ce109ffca987cc14520945aa22431f
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/tools/aidl/aidl.cpp
e0146cf3252d67881d417e8dee3d6eb6a1ab5304 25-Aug-2015 Christopher Wiley <wiley@google.com> Tighten up compiler flags for aidl

Turn all warnings to errors, with special cases for places where
yacc forces us to be lenient. Remove one variable with 0 references
elsewhere in the code.

These flags are confined to be clang only because the Windows SDK build
is using an older compiler that does not understand these flags.

Change-Id: I6407bd331c25b8845bde46e9a917bce1d6857bd8
/system/tools/aidl/aidl.cpp
c517b8dfc9c147d6c6c5c7414097e17f411dacbe 31-Aug-2015 Christopher Wiley <wiley@google.com> Merge "Revert "Tighten up compiler flags for aidl""
6886ea5917fafe9bf62297b7d970243b5370c047 31-Aug-2015 Christopher Wiley <wiley@google.com> Revert "Tighten up compiler flags for aidl"

This reverts commit eea2353a3427f7d157c46e24ab6aba1378e16c2e.

This seems to have broken the build because whatever compiler the builder is using doesn't understand the same "turn off this warning" flags as my local host's compiler.

Change-Id: Ic68b7065b161a5ae683b7082c67147835833e0fa
/system/tools/aidl/aidl.cpp
89e3586afa180230fa999d4287df90df9d066cef 30-Aug-2015 Christopher Wiley <wiley@google.com> aidl: Pull main() into dedicated file

This separates the main() entry point from the functionality we're
hoping to test. While here, redo the header guards to be consistent
accross the codebae.

Bug: 23516947
Change-Id: I61666126bdba0941f14bd0f031caaa30367b864a
Test: Compiles
/system/tools/aidl/aidl.cpp
c42ba466df7604199ab7177de98e18fd7287bd75 25-Aug-2015 Christopher Wiley <wiley@google.com> Tighten up compiler flags for aidl

Turn all warnings to errors, with special cases for places where
yacc forces us to be lenient. Remove one variable with 0 references
elsewhere in the code.

Change-Id: Ia7819795eb162e9c77d215088aee4c45bd87c1af
/system/tools/aidl/aidl.cpp
9f4c7ae970a27bcf081d838671b4f4d7505861b3 24-Aug-2015 Christopher Wiley <wiley@google.com> Do not merge namespaces

It is good practice to not include the whole std:: namespace into
the global namespace. This is doubly true in headers.

TEST=aidl compiles

Change-Id: I910ca8082f61cce4f23f8564b8a12c2828b75b3c
/system/tools/aidl/aidl.cpp
549b6e27c013ec44272be15b3da47da39721864d 17-Aug-2015 Elliott Hughes <enh@google.com> Replace HAVE_MS_C_RUNTIME with _WIN32 in frameworks/base/tools.

Change-Id: Ideef62acbf53a442167c9b8038021affffef9e8a
/system/tools/aidl/aidl.cpp
35c81eed1f0318a2faa2589cbd0652705e49bfb7 29-Jul-2015 Elliott Hughes <enh@google.com> Move frameworks/base/tools/ off AndroidConfig.h.

Change-Id: Ibc7abb67a56945a9618bc91ccdbebe4c806879a5
/system/tools/aidl/aidl.cpp
ce310dab0a33eff529e50a9de9ef59435b307e76 29-Jul-2015 Elliott Hughes <enh@google.com> Use _WIN32 rather than HAVE_WINDOWS_PATHS.

Change-Id: Ib1ae71dfbb20e3e5309ed737f48382cc42d2583f
/system/tools/aidl/aidl.cpp
0e4861a4a2abc9f41aab2d59944f2b6f52f3bfa2 23-Jul-2015 Ying Wang <wangying@google.com> Add phony source target in the generated dependency file of aidl.

This fixes make error when the source .aidl file is moved around but
its path relative to LOCAL_PATH doesn't change.

Bug: 22666539
Change-Id: Idf2492145e4927779d184932a09d61e4fe8ded0f
/system/tools/aidl/aidl.cpp
482eefbaf0c1b02ae45d8020fa839fce630ecee7 11-Nov-2014 Yabin Cui <yabinc@google.com> kill OS_CASE_SENSITIVE

Bug: 18314594
Change-Id: Ib11b45d2597b2576bc7df2d0167ce1bbd1449523
/system/tools/aidl/aidl.cpp
15ce994e02e841be0a2dca3005884fa5d7f81b58 07-May-2014 Andrew Hsieh <andrewhsieh@google.com> include direct.h for _mkdir

Bug: 14416410

The new mingw-w64 toolchain x86_64-w64-mingw32-4.8 no longer
declares _mkdir in io.h.

Change-Id: I624b52d2f35db54a7f28df09f997fc883b0f0557
/system/tools/aidl/aidl.cpp
5cd06072e8af1442c3f4676571086f7336c13526 29-Oct-2013 Elliott Hughes <enh@google.com> Re-apply several tools fixes lost by the directory rearrangement.

Leaks on error in tools/aapt/Images.cpp.
https://code.google.com/p/android/issues/detail?id=61552

Two missing fclose calls in tools/aapt/Resource.cpp.
https://code.google.com/p/android/issues/detail?id=61553

Missing fclose in tools/aidl/aidl.cpp.
https://code.google.com/p/android/issues/detail?id=61554

Change-Id: I56ce144958296961b77354815efc1a245564594b
/system/tools/aidl/aidl.cpp
ffa1686a7a8964d1f6e08ee2ab3e5eb42eb5f0b3 24-Jan-2014 Adam Lesinski <adamlesinski@google.com> Revert "Move frameworks/base/tools/ to frameworks/tools/"

This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
/system/tools/aidl/aidl.cpp
be354814711cbbb3bcf7467fc69d53fcf9363093 28-Aug-2013 Mike Lockwood <lockwood@google.com> Move frameworks/base/tools/ to frameworks/tools/

Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
/system/tools/aidl/aidl.cpp
1a0040abe7655a626f86ef3d32e1146c12356cae 24-Aug-2013 Ying Wang <wangying@google.com> Better aidl generated dependency

Previously if an imported aidl file has been deleted or moved,
the generated dependency file still contains the stale file name,
and make will fail with "No rule to make target <the deleted/moved
file>".
This change uses technique described in section "Automatic Dependency
Generation", Chapter 8 of "Managing Projects with GNU Make (3d
Edition)".
The same technique is used by the Android platform build system to
generate C/C++ header dependencies.

Bug: 10459179
Change-Id: Ib0c01a4234ef1af994487fdc846cdf8d13a675f6
/system/tools/aidl/aidl.cpp
6013d2036021f16a854f409e378f0093e2356aeb 18-Oct-2012 Maurice Chu <mochu@google.com> Enhance AIDL to take an explicit id for methods

This adds an annotation to methods in AIDL of the form
"void myMethod() = 3;" to explicitly set the onTransact
id for the method. Either all methods must have explicitly
annotated id's or none of them should be explicitly annotated.
There is error checking in the AIDL compiler
for duplicate id's and id's outside of the valid range.

Bug: 7353910
Change-Id: I868045e3f112c9a279c573cea368a621116cbf77
/system/tools/aidl/aidl.cpp
2064ec76a391925e80f58be896e131a2a3080b7d 16-Aug-2012 Adam Powell <adamp@google.com> Allow multiple 'parcelable' declarations in aidl files

This solves a problem with declaring multiple Parcelable static inner
classes.

Change-Id: I5e42b412d6d937df19a388988be5aa58a8dbc3e4
/system/tools/aidl/aidl.cpp
2fe0fe2cc313c76a54557ee97d699c964cec7333 09-Nov-2011 Joe Onorato <joeo@google.com> For events, require that the parameters be marked in.

(because they won't work otherwise)
/system/tools/aidl/aidl.cpp
baaf9c83751aa8e53bdc881dc0d32a87d9114949 10-Oct-2011 Joe Onorato <joeo@google.com> aidl: All flattenable types now must also be parcelable.

This is more a limitation of the grammar than anything else triggering laziness on my part.
/system/tools/aidl/aidl.cpp
e20125d032b1c1d0de03530591bf2321a9f096b7 24-Sep-2011 Joe Onorato <joeo@google.com> add presenters to aidl.
/system/tools/aidl/aidl.cpp
4135a7dd119025aa06a02207831000af823f5722 16-Sep-2011 Joe Onorato <joeo@google.com> Support custom flattenable types for RPC.
/system/tools/aidl/aidl.cpp
c596cfe6ebccd8f0bcced0922fbc6029c3b750ef 31-Aug-2011 Joe Onorato <joeo@google.com> Checkpoint adding @home RPC support to aidl
/system/tools/aidl/aidl.cpp
e15d44a49717bad01050d6be4e0da95f34173332 25-Aug-2011 Xavier Ducrohet <xav@android.com> Add new dependency generation option to aidl.

The SDK build system does not provide an output file
and instead uses the -o<FOLDER> option and lets aidl figure
out the intermediary folders that represents the packages,
and the filename based on the input file (and its package).

Because of this the -d<FILE> option to generate a dependency
file is not convenient.

Instead the new option, -a (no parameters), automatically generate
a dependency files next to the output file.

Also, when compiling parcelable aidl files, without the -b option,
a dependency file is still generated. This is used by the SDK build
system since it cannot parse the file separately and instead tries
to compile every .aidl file.
The generation of this dependency file (which shows no output) allows
to know when any type of aidl file has been compiled.

Change-Id: If81dc7e1e0a780592c94d1850a1d1b094d6e7908
/system/tools/aidl/aidl.cpp
15f8da2280290d39291b12dc87165fce1806923e 13-Jul-2011 Elliott Hughes <enh@google.com> Fix aidl to cope with multiple collection types per method.

Bug: http://code.google.com/p/android/issues/detail?id=18497
Change-Id: I152416022524d2860cb16b46c4812c5be6bdcbad
/system/tools/aidl/aidl.cpp
2c3d74bd638e40bbd083687e6e79228aade725b0 15-Jan-2010 Scott Turner <scotty@l5computing.com> long modifier was on the wrong argument.
/system/tools/aidl/aidl.cpp
deec691c864b4fed7ae7f72ea2960b8470377cb6 13-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake_rel/...@138607
/system/tools/aidl/aidl.cpp
ed7bd9dec436eb64669c0628d6442686f0d2a569 05-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@136594
/system/tools/aidl/aidl.cpp
e42b5f5731dcaad89cf7883bd29e16bd74c96dd8 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/system/tools/aidl/aidl.cpp
3f063e539d2b8dc82a130c4322cdf93f2f1a9874 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/system/tools/aidl/aidl.cpp
bcaa86d9d95e6a3d1731b16116c2a848aa862080 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
/system/tools/aidl/aidl.cpp
46c012c3806a4b5c5c46539ea5070cc56e1bdb4b 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/system/tools/aidl/aidl.cpp