aboutsummaryrefslogtreecommitdiff
path: root/aidl_checkapi.cpp
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2020-09-11 01:29:45 +0000
committerTreehugger Robot <treehugger-gerrit@google.com>2020-09-16 19:56:14 +0000
commit2178081cd90ebcd77c867d52a8b0e15f0d4134cc (patch)
tree60121b57b0dfab00beb6ccd38826a05a0567daee /aidl_checkapi.cpp
parent40d398a0d28ad652afe1168d3abc7cd5231ae4de (diff)
downloadaidl-2178081cd90ebcd77c867d52a8b0e15f0d4134cc.tar.gz
Use AIDL_* errors over libbase logging.
This: - gives us line numbers in source AIDL files reflecting errors - makes it possible aidl_parser_fuzzer can detect when we return an error but don't provide any output logging Bug: N/A Test: aidl_unittest Change-Id: I0479fd8d87547c1f0b1be754f9b8f6865db3cbef
Diffstat (limited to 'aidl_checkapi.cpp')
-rw-r--r--aidl_checkapi.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/aidl_checkapi.cpp b/aidl_checkapi.cpp
index a0107e41..0f2f4b02 100644
--- a/aidl_checkapi.cpp
+++ b/aidl_checkapi.cpp
@@ -127,7 +127,7 @@ static bool are_compatible_interfaces(const AidlInterface& older, const AidlInte
const auto& old_args = old_m->GetArguments();
const auto& new_args = new_m->GetArguments();
// this is guaranteed because arguments are part of AidlMethod::Signature()
- CHECK(old_args.size() == new_args.size());
+ AIDL_FATAL_IF(old_args.size() != new_args.size(), old_m);
for (size_t i = 0; i < old_args.size(); i++) {
const AidlArgument& old_a = *(old_args.at(i));
const AidlArgument& new_a = *(new_args.at(i));
@@ -317,9 +317,10 @@ static Result<AidlTypenames> load_from_dir(const Options& options, const IoDeleg
}
bool check_api(const Options& options, const IoDelegate& io_delegate) {
- CHECK(options.IsStructured());
- CHECK(options.InputFiles().size() == 2) << "--checkapi requires two inputs "
- << "but got " << options.InputFiles().size();
+ AIDL_FATAL_IF(!options.IsStructured(), AIDL_LOCATION_HERE);
+ AIDL_FATAL_IF(options.InputFiles().size() != 2, AIDL_LOCATION_HERE)
+ << "--checkapi requires two inputs "
+ << "but got " << options.InputFiles().size();
auto old_tns = load_from_dir(options, io_delegate, options.InputFiles().at(0));
if (!old_tns.ok()) {
return false;