History log of /system/tools/aidl/type_namespace.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f05cc26630828c848e46ea0e584dbdd2541ea723 27-Jul-2016 Chih-Hung Hsieh <chh@google.com> Fix clang-tidy performance warnings.

* Use const reference type for parameters, local variables,
and for-loop index variables to avoid unnecessary copy.

Bug: 30407689
Bug: 30413223
Bug: 30413862
Change-Id: Ia09c58becfa3980faed24aa7eddeb520207ca259
Test: build with WITH_TIDY=1
/system/tools/aidl/type_namespace.h
c5afb404a8e71475993f70239df09209fa428d25 01-Mar-2016 Casey Dahlin <sadmac@google.com> Propagate interface annotations to methods

Change-Id: I85f9686e4b5df7df0d9fb77e6a1b50a93ff3e2d7
Test: Unit tests pass
Bug: 26911508
/system/tools/aidl/type_namespace.h
5d9bc936e45b5ffe487b1807b4a028dc3dc4df9f 01-Feb-2016 Christopher Wiley <wiley@google.com> Support @utf8InCpp List<String>

Bug: 26729450
Change-Id: I2ac61aadef4c3ff0527fe68b3a104f72821dd2c4
Test: unit, integration tests pass
/system/tools/aidl/type_namespace.h
9f40372e71c5e2fdf840eeabb5531f12665e9a91 28-Jan-2016 Christopher Wiley <wiley@google.com> Remap String to alternate types when @utf8 or @utf8InCpp

Now, it is no longer sufficient to identify an AIDL type by its
package and class name, since the list of annotations is also
needed to uniquely identify the type.

Express this by mapping "@utf8InCpp String" to aidl-internal.Utf8InCppString
and then re-using existing mechanism to ask for a language specific
type given the canonical AIDL type string.
- Adding another type variant and corresponding pointer (i.e. the way
nullable and array work) would cause that type hierarchy to expand
the number of ways we have to connect the types.
- Passing a set of annotations through the type namespace adds
syntactic cruft we can avoid by mapping annotations to special
packages.
- Adding special getters for "utf8 string type" expands the contract
between the generic type namespace and the language specific type
name spaces. Currently the only mechanism to get a type is to
provide its canonical AIDL type.

Support @utf8InCpp in Java generation for the sake of unittests passing.
This type is identical to a normal string type (UTF16 on the wire).

Bug: 26729450
Test: unittests continue to pass

Change-Id: Ib017ce40ea01a50b50a157c0ef8b483a892b99b9
/system/tools/aidl/type_namespace.h
d21bfee0d45a5eb8ffb09eaae3c6d81f3dd292f7 30-Jan-2016 Christopher Wiley <wiley@google.com> Fully separate AIDL and Java type namespaces

For android::aidl::ValidatableType, rename:
- QualifiedName() -> CanonicalName()
- Name() -> ShortName()

For android::aidl::java::Type, add a new JavaType() method.
Use that method exclusively when generating Java.

Bug: 26875320
Test: unit and integration tests pass

Change-Id: Ib1d09f4f84d3270634e611f0911f60a2e685cefc
/system/tools/aidl/type_namespace.h
9ab06237fd51e625286a62fdd4fe5f948e698131 27-Jan-2016 Christopher Wiley <wiley@google.com> Make string matching the last resort way to look up types

That is, Find(const AidlType&) will call FindByName(const std::string&)
rather than the other way around. Later we'll use annotations in the
AidlType to pick one of several different type name strings.

Bug: 26729450
Test: unittests continue to pass

Change-Id: I10fcb88eabda30b88d5457ecfc8931755a0aa872
/system/tools/aidl/type_namespace.h
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/type_namespace.h
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/type_namespace.h
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/type_namespace.h
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/type_namespace.h
0a62067f35e957493bc37c4b42dfdcfc16353831 04-Dec-2015 Elliott Hughes <enh@google.com> Track base/ -> android-base/ change.

Change-Id: I02b64b42c17d248c5fb2c4de4b0778a441e018e3
/system/tools/aidl/type_namespace.h
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/type_namespace.h
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/type_namespace.h
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/type_namespace.h
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/type_namespace.h
09af469476ea6d187b52f22113d3b168a887100c 30-Oct-2015 Christopher Wiley <wiley@google.com> Consolidate type checking logic

Move logic used to check types used in AIDL into a common superclass
of the language specific type namespaces. Add a templated
LanguageTypeNamespace class to allow language specific type reasoning
while sharing an implementation.

Move functionality important to the the AIDL type checking into
ValidatableType and out of the Java and C++ subclasses.

Removed GenericType from the Java type system because it messed around
with the canonical name for a type post construction, while adding
absolutely no value of its own.

Bug: 24470786
Test: unittests continue to pass, full build of android succeeds.

Change-Id: Ic03eb5d770c7f51abbde87c20a9b7287ce6a277e
/system/tools/aidl/type_namespace.h
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/type_namespace.h
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/type_namespace.h
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/type_namespace.h
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/type_namespace.h
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/type_namespace.h
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/type_namespace.h
4582ecb1e8799b062265915282edd567295d2ee6 25-Sep-2015 Christopher Wiley <wiley@google.com> Make creating container types more explicit

Calling TypeNamespace::Search() has the side effect of actually
creating an instance of a container type (e.g. List<Bar>) if
the conatiner type doesn't exist. Make this more explicit,
in preparation for just creating container types explicitly and
fixing these misleading semantics.

Bug: 24303749
Test: unittests, clean build of Android passes

Change-Id: Ic7f6e42167fda5d4d462570c8e1ec3a24fd153ec
/system/tools/aidl/type_namespace.h
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/type_namespace.h
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/type_namespace.h
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/type_namespace.h