1 // Copyright (C) 2016 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef ABI_DIFF_WRAPPERS_H 16 #define ABI_DIFF_WRAPPERS_H 17 18 #include <abi_diff_helpers.h> 19 #include <ir_representation.h> 20 21 #include <deque> 22 23 namespace abi_diff_wrappers { 24 25 using abi_util::AbiElementMap; 26 using abi_util::AbiDiffHelper; 27 using abi_util::DiffStatus; 28 29 template <typename T, typename F> 30 static bool IgnoreSymbol(const T *element, 31 const std::set<std::string> &ignored_symbols, 32 F func) { 33 return ignored_symbols.find(func(element)) != 34 ignored_symbols.end(); 35 } 36 37 template <typename T> 38 class DiffWrapper : public AbiDiffHelper { 39 40 public: 41 DiffWrapper(const T *oldp, const T *newp, 42 abi_util::IRDiffDumper *ir_diff_dumper, 43 const AbiElementMap<const abi_util::TypeIR *> &old_types, 44 const AbiElementMap<const abi_util::TypeIR *> &new_types, 45 std::set<std::string> *type_cache) 46 : AbiDiffHelper(old_types, new_types, type_cache, ir_diff_dumper), 47 oldp_(oldp), newp_(newp) { } 48 49 bool DumpDiff(abi_util::IRDiffDumper::DiffKind diff_kind); 50 51 private: 52 const T *oldp_; 53 const T *newp_; 54 }; 55 56 } // abi_diff_wrappers 57 58 #endif // ABI_DIFF_WRAPPERS_H 59