summaryrefslogtreecommitdiffstats
path: root/vndk
diff options
context:
space:
mode:
authorLogan Chien <loganchien@google.com>2019-03-14 16:51:48 +0800
committerLogan Chien <loganchien@google.com>2019-03-20 17:06:14 +0800
commitbc69c3266ff56d43f30cc55fdd5cf74324e0584d (patch)
tree7f48bd2672b135cd08aef16b27d1161e98602a0c /vndk
parentba156afb1e6a99594529d4686be9a632c53c3635 (diff)
downloadandroid_development-bc69c3266ff56d43f30cc55fdd5cf74324e0584d.tar.gz
android_development-bc69c3266ff56d43f30cc55fdd5cf74324e0584d.tar.bz2
android_development-bc69c3266ff56d43f30cc55fdd5cf74324e0584d.zip
header-checker: Do not expose format-specific details
Test: ./tests/test.py Test: ${ANDROID_HOST_OUT}/nativetest64/\ header-checker-unittests/header-checker-unittests Change-Id: Ib55dc8bdd195d4072d875d0cbd495c7c9c550fec
Diffstat (limited to 'vndk')
-rw-r--r--vndk/tools/header-checker/src/repr/ir_diff_dumper.cpp4
-rw-r--r--vndk/tools/header-checker/src/repr/ir_dumper.cpp8
-rw-r--r--vndk/tools/header-checker/src/repr/ir_reader.cpp9
-rw-r--r--vndk/tools/header-checker/src/repr/json/api.h41
-rw-r--r--vndk/tools/header-checker/src/repr/json/ir_dumper.cpp5
-rw-r--r--vndk/tools/header-checker/src/repr/json/ir_reader.cpp6
-rw-r--r--vndk/tools/header-checker/src/repr/protobuf/api.h45
-rw-r--r--vndk/tools/header-checker/src/repr/protobuf/ir_diff_dumper.cpp9
-rw-r--r--vndk/tools/header-checker/src/repr/protobuf/ir_dumper.cpp6
-rw-r--r--vndk/tools/header-checker/src/repr/protobuf/ir_reader.cpp7
10 files changed, 128 insertions, 12 deletions
diff --git a/vndk/tools/header-checker/src/repr/ir_diff_dumper.cpp b/vndk/tools/header-checker/src/repr/ir_diff_dumper.cpp
index 0a40a312b..d0b0eab9a 100644
--- a/vndk/tools/header-checker/src/repr/ir_diff_dumper.cpp
+++ b/vndk/tools/header-checker/src/repr/ir_diff_dumper.cpp
@@ -15,7 +15,7 @@
#include "repr/ir_diff_dumper.h"
#include "repr/ir_representation.h"
-#include "repr/protobuf/ir_diff_dumper.h"
+#include "repr/protobuf/api.h"
#include <memory>
#include <string>
@@ -31,7 +31,7 @@ std::unique_ptr<IRDiffDumper> IRDiffDumper::CreateIRDiffDumper(
TextFormatIR text_format, const std::string &dump_path) {
switch (text_format) {
case TextFormatIR::ProtobufTextFormat:
- return std::make_unique<ProtobufIRDiffDumper>(dump_path);
+ return CreateProtobufIRDiffDumper(dump_path);
default:
// Nothing else is supported yet.
llvm::errs() << "Text format not supported yet\n";
diff --git a/vndk/tools/header-checker/src/repr/ir_dumper.cpp b/vndk/tools/header-checker/src/repr/ir_dumper.cpp
index 3466a8540..048359d85 100644
--- a/vndk/tools/header-checker/src/repr/ir_dumper.cpp
+++ b/vndk/tools/header-checker/src/repr/ir_dumper.cpp
@@ -14,8 +14,8 @@
#include "repr/ir_dumper.h"
-#include "repr/json/ir_dumper.h"
-#include "repr/protobuf/ir_dumper.h"
+#include "repr/json/api.h"
+#include "repr/protobuf/api.h"
#include <memory>
#include <string>
@@ -31,9 +31,9 @@ std::unique_ptr<IRDumper> IRDumper::CreateIRDumper(
TextFormatIR text_format, const std::string &dump_path) {
switch (text_format) {
case TextFormatIR::ProtobufTextFormat:
- return std::make_unique<ProtobufIRDumper>(dump_path);
+ return CreateProtobufIRDumper(dump_path);
case TextFormatIR::Json:
- return std::make_unique<JsonIRDumper>(dump_path);
+ return CreateJsonIRDumper(dump_path);
default:
llvm::errs() << "Text format not supported yet\n";
return nullptr;
diff --git a/vndk/tools/header-checker/src/repr/ir_reader.cpp b/vndk/tools/header-checker/src/repr/ir_reader.cpp
index 22594423a..ed4151a17 100644
--- a/vndk/tools/header-checker/src/repr/ir_reader.cpp
+++ b/vndk/tools/header-checker/src/repr/ir_reader.cpp
@@ -17,9 +17,8 @@
#include "repr/abi_diff_helpers.h"
#include "repr/ir_representation.h"
#include "repr/ir_representation_internal.h"
-#include "repr/ir_diff_representation.h"
-#include "repr/json/ir_reader.h"
-#include "repr/protobuf/ir_reader.h"
+#include "repr/json/api.h"
+#include "repr/protobuf/api.h"
#include <list>
#include <memory>
@@ -41,9 +40,9 @@ IRReader::CreateIRReader(
TextFormatIR text_format, const std::set<std::string> *exported_headers) {
switch (text_format) {
case TextFormatIR::ProtobufTextFormat:
- return std::make_unique<ProtobufIRReader>(exported_headers);
+ return CreateProtobufIRReader(exported_headers);
case TextFormatIR::Json:
- return std::make_unique<JsonIRReader>(exported_headers);
+ return CreateJsonIRReader(exported_headers);
default:
llvm::errs() << "Text format not supported yet\n";
return nullptr;
diff --git a/vndk/tools/header-checker/src/repr/json/api.h b/vndk/tools/header-checker/src/repr/json/api.h
new file mode 100644
index 000000000..95c1c37c1
--- /dev/null
+++ b/vndk/tools/header-checker/src/repr/json/api.h
@@ -0,0 +1,41 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef HEADER_CHECKER_REPR_JSON_API_H_
+#define HEADER_CHECKER_REPR_JSON_API_H_
+
+#include <memory>
+#include <set>
+#include <string>
+
+
+namespace header_checker {
+namespace repr {
+
+
+class IRDumper;
+class IRReader;
+
+
+std::unique_ptr<IRDumper> CreateJsonIRDumper(const std::string &dump_path);
+
+std::unique_ptr<IRReader> CreateJsonIRReader(
+ const std::set<std::string> *exported_headers);
+
+
+} // namespace repr
+} // namespace header_checker
+
+
+#endif // HEADER_CHECKER_REPR_JSON_API_H_
diff --git a/vndk/tools/header-checker/src/repr/json/ir_dumper.cpp b/vndk/tools/header-checker/src/repr/json/ir_dumper.cpp
index 8c4a7fc23..f9c56ec46 100644
--- a/vndk/tools/header-checker/src/repr/json/ir_dumper.cpp
+++ b/vndk/tools/header-checker/src/repr/json/ir_dumper.cpp
@@ -17,6 +17,7 @@
#include "repr/ir_dumper.h"
#include "repr/ir_reader.h"
#include "repr/ir_representation_internal.h"
+#include "repr/json/api.h"
#include "repr/json/converter.h"
#include <json/reader.h>
@@ -426,6 +427,10 @@ JsonIRDumper::JsonIRDumper(const std::string &dump_path)
}
}
+std::unique_ptr<IRDumper> CreateJsonIRDumper(const std::string &dump_path) {
+ return std::make_unique<JsonIRDumper>(dump_path);
+}
+
} // namespace repr
} // header_checker
diff --git a/vndk/tools/header-checker/src/repr/json/ir_reader.cpp b/vndk/tools/header-checker/src/repr/json/ir_reader.cpp
index bd79eb977..3c90bc193 100644
--- a/vndk/tools/header-checker/src/repr/json/ir_reader.cpp
+++ b/vndk/tools/header-checker/src/repr/json/ir_reader.cpp
@@ -17,6 +17,7 @@
#include "repr/ir_dumper.h"
#include "repr/ir_reader.h"
#include "repr/ir_representation_internal.h"
+#include "repr/json/api.h"
#include "repr/json/converter.h"
#include <json/reader.h>
@@ -478,6 +479,11 @@ void JsonIRReader::ReadElfObjects(const JsonObjectRef &tu) {
}
}
+std::unique_ptr<IRReader> CreateJsonIRReader(
+ const std::set<std::string> *exported_headers) {
+ return std::make_unique<JsonIRReader>(exported_headers);
+}
+
} // namespace repr
} // header_checker
diff --git a/vndk/tools/header-checker/src/repr/protobuf/api.h b/vndk/tools/header-checker/src/repr/protobuf/api.h
new file mode 100644
index 000000000..22a03ee50
--- /dev/null
+++ b/vndk/tools/header-checker/src/repr/protobuf/api.h
@@ -0,0 +1,45 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef HEADER_CHECKER_REPR_PROTOBUF_API_H_
+#define HEADER_CHECKER_REPR_PROTOBUF_API_H_
+
+#include <memory>
+#include <set>
+#include <string>
+
+
+namespace header_checker {
+namespace repr {
+
+
+class IRDiffDumper;
+class IRDumper;
+class IRReader;
+
+
+std::unique_ptr<IRDumper> CreateProtobufIRDumper(const std::string &dump_path);
+
+std::unique_ptr<IRReader> CreateProtobufIRReader(
+ const std::set<std::string> *exported_headers);
+
+std::unique_ptr<IRDiffDumper> CreateProtobufIRDiffDumper(
+ const std::string &dump_path);
+
+
+} // namespace repr
+} // namespace header_checker
+
+
+#endif // HEADER_CHECKER_REPR_PROTOBUF_API_H_
diff --git a/vndk/tools/header-checker/src/repr/protobuf/ir_diff_dumper.cpp b/vndk/tools/header-checker/src/repr/protobuf/ir_diff_dumper.cpp
index 4c4106ae5..12d7dedea 100644
--- a/vndk/tools/header-checker/src/repr/protobuf/ir_diff_dumper.cpp
+++ b/vndk/tools/header-checker/src/repr/protobuf/ir_diff_dumper.cpp
@@ -15,10 +15,12 @@
#include "repr/protobuf/ir_diff_dumper.h"
#include "repr/ir_diff_representation.h"
+#include "repr/protobuf/api.h"
#include "repr/protobuf/converter.h"
-#include <string>
#include <fstream>
+#include <memory>
+#include <string>
#include <llvm/Support/raw_ostream.h>
@@ -366,6 +368,11 @@ bool ProtobufIRDiffDumper::Dump() {
return google::protobuf::TextFormat::Print(*diff_tu_.get(), &text_os);
}
+std::unique_ptr<IRDiffDumper> CreateProtobufIRDiffDumper(
+ const std::string &dump_path) {
+ return std::make_unique<ProtobufIRDiffDumper>(dump_path);
+}
+
} // namespace repr
} // namespace header_checker
diff --git a/vndk/tools/header-checker/src/repr/protobuf/ir_dumper.cpp b/vndk/tools/header-checker/src/repr/protobuf/ir_dumper.cpp
index 5c7931f93..d4a0594cb 100644
--- a/vndk/tools/header-checker/src/repr/protobuf/ir_dumper.cpp
+++ b/vndk/tools/header-checker/src/repr/protobuf/ir_dumper.cpp
@@ -15,8 +15,10 @@
#include "repr/protobuf/ir_dumper.h"
#include "repr/protobuf/abi_dump.h"
+#include "repr/protobuf/api.h"
#include <fstream>
+#include <memory>
#include <llvm/Support/raw_ostream.h>
@@ -489,6 +491,10 @@ bool ProtobufIRDumper::Dump() {
return google::protobuf::TextFormat::Print(*tu_ptr_.get(), &text_os);
}
+std::unique_ptr<IRDumper> CreateProtobufIRDumper(const std::string &dump_path) {
+ return std::make_unique<ProtobufIRDumper>(dump_path);
+}
+
} // namespace repr
} // namespace header_checker
diff --git a/vndk/tools/header-checker/src/repr/protobuf/ir_reader.cpp b/vndk/tools/header-checker/src/repr/protobuf/ir_reader.cpp
index f29dc8b60..1f92c9618 100644
--- a/vndk/tools/header-checker/src/repr/protobuf/ir_reader.cpp
+++ b/vndk/tools/header-checker/src/repr/protobuf/ir_reader.cpp
@@ -15,9 +15,11 @@
#include "repr/protobuf/ir_reader.h"
#include "repr/ir_representation_internal.h"
+#include "repr/protobuf/api.h"
#include "repr/protobuf/converter.h"
#include <fstream>
+#include <memory>
#include <google/protobuf/text_format.h>
@@ -369,6 +371,11 @@ void ProtobufIRReader::ReadElfObjects(const abi_dump::TranslationUnit &tu) {
}
}
+std::unique_ptr<IRReader> CreateProtobufIRReader(
+ const std::set<std::string> *exported_headers) {
+ return std::make_unique<ProtobufIRReader>(exported_headers);
+}
+
} // namespace repr
} // namespace header_checker