aboutsummaryrefslogtreecommitdiff
path: root/Coordinator.cpp
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2017-08-25 16:56:39 -0700
committerSteven Moreland <smoreland@google.com>2017-08-25 17:16:19 -0700
commita407b7d4ce6cfa8385e30b8a7e7e06e92a1a3681 (patch)
treebb2037296251247b66ad40102d1f9823dd9646a3 /Coordinator.cpp
parent42f64b0654f0d734bc29d7b8bc5e7d3c26a91368 (diff)
downloadhidl-a407b7d4ce6cfa8385e30b8a7e7e06e92a1a3681.tar.gz
Fix 'no transitive imports' HIDL guarantee.
hidl-gen previously accidentally allowed for transitive imports in certain cases. This caused a bug where this compiled: a). hidl-gen -Lcheck android.hardware.cas.native@1.0 android.hardware.cas@1.0 and this failed: b). hidl-gen -Lcheck android.hardware.cas@1.0 android.hardware.cas.native@1.0 This is because when b) is run, Coordinator's mCache already contains the AST for android.hardware.cas@1.0, so parsedASTs doesn't get passed recursively down as it does in a) when mCache doesn't contain the parsed AST. Bug: 65055216 Test: hidl-gen detects bad transitive even when importing only one package Change-Id: I754c27836b76035a9fd1c9a6d537fed36d90220d
Diffstat (limited to 'Coordinator.cpp')
-rw-r--r--Coordinator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Coordinator.cpp b/Coordinator.cpp
index 1f764106..8c89d5ee 100644
--- a/Coordinator.cpp
+++ b/Coordinator.cpp
@@ -86,8 +86,8 @@ AST* Coordinator::parse(const FQName& fqName, std::set<AST*>* parsedASTs,
if (fqName.name() != "types") {
// Any interface file implicitly imports its package's types.hal.
FQName typesName = fqName.getTypesForPackage();
- // Do not enforce on imports.
- typesAST = parse(typesName, parsedASTs, Enforce::NONE);
+ // Do not enforce on imports. Do not add imports' imports to this AST.
+ typesAST = parse(typesName, nullptr, Enforce::NONE);
// fall through.
}