// Copyright (C) 2016 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 ABI_DIFF_WRAPPERS_H #define ABI_DIFF_WRAPPERS_H #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-parameter" #pragma clang diagnostic ignored "-Wnested-anon-types" #include "proto/abi_dump.pb.h" #include "proto/abi_diff.pb.h" #pragma clang diagnostic pop namespace abi_diff_wrappers { template static bool IgnoreSymbol(const T *element, const std::set &ignored_symbols) { return ignored_symbols.find(element->basic_abi().linker_set_key()) != ignored_symbols.end(); } template class DiffWrapperBase { public: virtual std::unique_ptr Get() = 0 ; protected: DiffWrapperBase(const T *oldp, const T *newp) : oldp_(oldp), newp_(newp) { } template bool GetElementDiffs( google::protobuf::RepeatedPtrField *dst, const google::protobuf::RepeatedPtrField &old_elements, const google::protobuf::RepeatedPtrField &new_elements); private: template void GetExtraElementDiffs( google::protobuf::RepeatedPtrField *dst, int i, int j, const google::protobuf::RepeatedPtrField &old_elements, const google::protobuf::RepeatedPtrField &new_elements); protected: const T *oldp_; const T *newp_; }; template class DiffWrapper : public DiffWrapperBase { public: DiffWrapper(const T *oldp, const T *newp) : DiffWrapperBase(oldp, newp) { } std::unique_ptr Get() override; }; } // abi_diff_wrappers #endif // ABI_DIFF_WRAPPERS_H