LanguageSpecificCheckValid for imports.
Full CheckValid requires too much information, but
LanguageSpecificCheckValid appears not to, and it can cause some better
error messages (specifically, before, aidl was aborting if cpp_header
wasn't specified on a parcelable that was depended on by an interface
being compiled).
Bug: 194846019
Test: TH
Change-Id: I09c4291bf44bb86ac34f7bd74655c7409da597d5
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index 5e887e2..e63df71 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -1061,8 +1061,7 @@
}
TEST_P(AidlTest, ParseCompoundParcelableFromPreprocess) {
- io_delegate_.SetFileContents("preprocessed",
- "parcelable p.Outer.Inner;");
+ io_delegate_.SetFileContents("preprocessed", "parcelable p.Outer.Inner cpp_header \"inner.h\";");
preprocessed_files_.push_back("preprocessed");
auto parse_result = Parse("p/IFoo.aidl", "package p; interface IFoo { void f(in Inner c); }",
typenames_, GetLanguage());
@@ -1123,7 +1122,8 @@
const string expected_stderr =
"ERROR: o/WhoKnowsWhat.aidl:1.22-35: o.WhoKnowsWhat is not structured, but this is a "
"structured interface.\n";
- io_delegate_.SetFileContents("o/WhoKnowsWhat.aidl", "package o; parcelable WhoKnowsWhat;");
+ io_delegate_.SetFileContents("o/WhoKnowsWhat.aidl",
+ "package o; parcelable WhoKnowsWhat cpp_header \"who_knows.h\";");
import_paths_.emplace("");
AidlError error;
CaptureStderr();