Merge "Convert type_queue to a member of AbiDiffHelper"
This commit is contained in:
@@ -163,6 +163,7 @@ cc_library_host_static {
|
|||||||
],
|
],
|
||||||
|
|
||||||
static_libs: [
|
static_libs: [
|
||||||
|
"libbase",
|
||||||
"libheader-checker-proto",
|
"libheader-checker-proto",
|
||||||
"libjsoncpp",
|
"libjsoncpp",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -26,41 +26,36 @@ namespace diff {
|
|||||||
using repr::AbiElementMap;
|
using repr::AbiElementMap;
|
||||||
using repr::DiffStatus;
|
using repr::DiffStatus;
|
||||||
using repr::TypeStackGuard;
|
using repr::TypeStackGuard;
|
||||||
using repr::Unwind;
|
|
||||||
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool DiffWrapper<repr::RecordTypeIR>::DumpDiff(
|
bool DiffWrapper<repr::RecordTypeIR>::DumpDiff(
|
||||||
repr::DiffMessageIR::DiffKind diff_kind) {
|
repr::DiffMessageIR::DiffKind diff_kind) {
|
||||||
std::deque<std::string> type_queue;
|
|
||||||
if (!type_cache_->insert(
|
if (!type_cache_->insert(
|
||||||
oldp_->GetSelfType() + newp_->GetSelfType()).second) {
|
oldp_->GetSelfType() + newp_->GetSelfType()).second) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
CompareRecordTypes(oldp_, newp_, &type_queue, diff_kind);
|
CompareRecordTypes(oldp_, newp_, diff_kind);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool DiffWrapper<repr::EnumTypeIR>::DumpDiff(
|
bool DiffWrapper<repr::EnumTypeIR>::DumpDiff(
|
||||||
repr::DiffMessageIR::DiffKind diff_kind) {
|
repr::DiffMessageIR::DiffKind diff_kind) {
|
||||||
std::deque<std::string> type_queue;
|
|
||||||
if (!type_cache_->insert(
|
if (!type_cache_->insert(
|
||||||
oldp_->GetSelfType() + newp_->GetSelfType()).second) {
|
oldp_->GetSelfType() + newp_->GetSelfType()).second) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
CompareEnumTypes(oldp_, newp_, &type_queue, diff_kind);
|
CompareEnumTypes(oldp_, newp_, diff_kind);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool DiffWrapper<repr::GlobalVarIR>::DumpDiff(
|
bool DiffWrapper<repr::GlobalVarIR>::DumpDiff(
|
||||||
repr::DiffMessageIR::DiffKind diff_kind) {
|
repr::DiffMessageIR::DiffKind diff_kind) {
|
||||||
std::deque<std::string> type_queue;
|
TypeStackGuard guard(type_stack_, oldp_->GetName());
|
||||||
TypeStackGuard guard(&type_queue, oldp_->GetName());
|
DiffStatus type_diff = CompareAndDumpTypeDiff(
|
||||||
DiffStatus type_diff = CompareAndDumpTypeDiff(oldp_->GetReferencedType(),
|
oldp_->GetReferencedType(), newp_->GetReferencedType(), diff_kind);
|
||||||
newp_->GetReferencedType(),
|
|
||||||
&type_queue, diff_kind);
|
|
||||||
if (type_diff.IsDirectDiff() || oldp_->GetAccess() != newp_->GetAccess()) {
|
if (type_diff.IsDirectDiff() || oldp_->GetAccess() != newp_->GetAccess()) {
|
||||||
repr::GlobalVarIR old_global_var = *oldp_;
|
repr::GlobalVarIR old_global_var = *oldp_;
|
||||||
repr::GlobalVarIR new_global_var = *newp_;
|
repr::GlobalVarIR new_global_var = *newp_;
|
||||||
@@ -70,7 +65,7 @@ bool DiffWrapper<repr::GlobalVarIR>::DumpDiff(
|
|||||||
&new_global_var);
|
&new_global_var);
|
||||||
global_var_diff_ir.SetName(oldp_->GetName());
|
global_var_diff_ir.SetName(oldp_->GetName());
|
||||||
return ir_diff_dumper_->AddDiffMessageIR(&global_var_diff_ir,
|
return ir_diff_dumper_->AddDiffMessageIR(&global_var_diff_ir,
|
||||||
Unwind(&type_queue), diff_kind);
|
UnwindTypeStack(), diff_kind);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -78,15 +73,11 @@ bool DiffWrapper<repr::GlobalVarIR>::DumpDiff(
|
|||||||
template <>
|
template <>
|
||||||
bool DiffWrapper<repr::FunctionIR>::DumpDiff(
|
bool DiffWrapper<repr::FunctionIR>::DumpDiff(
|
||||||
repr::DiffMessageIR::DiffKind diff_kind) {
|
repr::DiffMessageIR::DiffKind diff_kind) {
|
||||||
std::deque<std::string> type_queue;
|
TypeStackGuard guard(type_stack_, oldp_->GetName());
|
||||||
TypeStackGuard guard(&type_queue, oldp_->GetName());
|
DiffStatus function_type_diff = CompareFunctionTypes(oldp_, newp_, diff_kind);
|
||||||
|
|
||||||
DiffStatus function_type_diff =
|
|
||||||
CompareFunctionTypes(oldp_, newp_, &type_queue, diff_kind);
|
|
||||||
|
|
||||||
CompareTemplateInfo(oldp_->GetTemplateElements(),
|
CompareTemplateInfo(oldp_->GetTemplateElements(),
|
||||||
newp_->GetTemplateElements(),
|
newp_->GetTemplateElements(), diff_kind);
|
||||||
&type_queue, diff_kind);
|
|
||||||
|
|
||||||
if (function_type_diff.IsDirectDiff() ||
|
if (function_type_diff.IsDirectDiff() ||
|
||||||
(oldp_->GetAccess() != newp_->GetAccess())) {
|
(oldp_->GetAccess() != newp_->GetAccess())) {
|
||||||
@@ -98,7 +89,7 @@ bool DiffWrapper<repr::FunctionIR>::DumpDiff(
|
|||||||
function_type_diff.IsExtension());
|
function_type_diff.IsExtension());
|
||||||
function_diff_ir.SetName(oldp_->GetName());
|
function_diff_ir.SetName(oldp_->GetName());
|
||||||
return ir_diff_dumper_->AddDiffMessageIR(&function_diff_ir,
|
return ir_diff_dumper_->AddDiffMessageIR(&function_diff_ir,
|
||||||
Unwind(&type_queue), diff_kind);
|
UnwindTypeStack(), diff_kind);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "utils/header_abi_util.h"
|
#include "utils/header_abi_util.h"
|
||||||
|
|
||||||
|
#include <android-base/strings.h>
|
||||||
#include <llvm/Support/raw_ostream.h>
|
#include <llvm/Support/raw_ostream.h>
|
||||||
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
@@ -25,19 +26,6 @@ namespace header_checker {
|
|||||||
namespace repr {
|
namespace repr {
|
||||||
|
|
||||||
|
|
||||||
std::string Unwind(const std::deque<std::string> *type_queue) {
|
|
||||||
if (!type_queue) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
std::string stack_str;
|
|
||||||
std::deque<std::string> type_queue_copy = *type_queue;
|
|
||||||
while (!type_queue_copy.empty()) {
|
|
||||||
stack_str += type_queue_copy.front() + "-> ";
|
|
||||||
type_queue_copy.pop_front();
|
|
||||||
}
|
|
||||||
return stack_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string ConvertTypeIdToString(
|
static std::string ConvertTypeIdToString(
|
||||||
const AbiElementMap<const TypeIR *> &type_graph,
|
const AbiElementMap<const TypeIR *> &type_graph,
|
||||||
const std::string &type_id) {
|
const std::string &type_id) {
|
||||||
@@ -126,6 +114,10 @@ void ReplaceTypeIdsWithTypeNames(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AbiDiffHelper::UnwindTypeStack() {
|
||||||
|
return android::base::Join(type_stack_, "-> ");
|
||||||
|
}
|
||||||
|
|
||||||
void AbiDiffHelper::CompareEnumFields(
|
void AbiDiffHelper::CompareEnumFields(
|
||||||
const std::vector<EnumFieldIR> &old_fields,
|
const std::vector<EnumFieldIR> &old_fields,
|
||||||
const std::vector<EnumFieldIR> &new_fields,
|
const std::vector<EnumFieldIR> &new_fields,
|
||||||
@@ -164,10 +156,9 @@ void AbiDiffHelper::CompareEnumFields(
|
|||||||
enum_type_diff_ir->SetFieldsDiff(std::move(enum_field_diffs));
|
enum_type_diff_ir->SetFieldsDiff(std::move(enum_field_diffs));
|
||||||
}
|
}
|
||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareEnumTypes(
|
DiffStatus AbiDiffHelper::CompareEnumTypes(const EnumTypeIR *old_type,
|
||||||
const EnumTypeIR *old_type, const EnumTypeIR *new_type,
|
const EnumTypeIR *new_type,
|
||||||
std::deque<std::string> *type_queue,
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
|
||||||
if (old_type->GetLinkerSetKey() != new_type->GetLinkerSetKey()) {
|
if (old_type->GetLinkerSetKey() != new_type->GetLinkerSetKey()) {
|
||||||
return DiffStatus::kDirectDiff;
|
return DiffStatus::kDirectDiff;
|
||||||
}
|
}
|
||||||
@@ -187,8 +178,9 @@ DiffStatus AbiDiffHelper::CompareEnumTypes(
|
|||||||
enum_type_diff_ir.get());
|
enum_type_diff_ir.get());
|
||||||
if ((enum_type_diff_ir->IsExtended() ||
|
if ((enum_type_diff_ir->IsExtended() ||
|
||||||
enum_type_diff_ir->IsIncompatible()) &&
|
enum_type_diff_ir->IsIncompatible()) &&
|
||||||
(ir_diff_dumper_ && !ir_diff_dumper_->AddDiffMessageIR(
|
(ir_diff_dumper_ &&
|
||||||
enum_type_diff_ir.get(), Unwind(type_queue), diff_kind))) {
|
!ir_diff_dumper_->AddDiffMessageIR(enum_type_diff_ir.get(),
|
||||||
|
UnwindTypeStack(), diff_kind))) {
|
||||||
llvm::errs() << "AddDiffMessage on EnumTypeDiffIR failed\n";
|
llvm::errs() << "AddDiffMessage on EnumTypeDiffIR failed\n";
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
@@ -355,10 +347,10 @@ static bool CompareSizeAndAlignment(const TypeIR *old_type,
|
|||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareCommonRecordFields(
|
DiffStatus AbiDiffHelper::CompareCommonRecordFields(
|
||||||
const RecordFieldIR *old_field, const RecordFieldIR *new_field,
|
const RecordFieldIR *old_field, const RecordFieldIR *new_field,
|
||||||
std::deque<std::string> *type_queue, DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
DiffStatus field_diff_status = CompareAndDumpTypeDiff(
|
DiffStatus field_diff_status =
|
||||||
old_field->GetReferencedType(), new_field->GetReferencedType(),
|
CompareAndDumpTypeDiff(old_field->GetReferencedType(),
|
||||||
type_queue, diff_kind);
|
new_field->GetReferencedType(), diff_kind);
|
||||||
// CompareAndDumpTypeDiff should not return kDirectExt.
|
// CompareAndDumpTypeDiff should not return kDirectExt.
|
||||||
// In case it happens, report an incompatible diff for review.
|
// In case it happens, report an incompatible diff for review.
|
||||||
if (field_diff_status.IsExtension() ||
|
if (field_diff_status.IsExtension() ||
|
||||||
@@ -380,7 +372,7 @@ DiffStatus AbiDiffHelper::CompareCommonRecordFields(
|
|||||||
// This function returns either kNoDiff or kIndirectDiff. It is the status of
|
// This function returns either kNoDiff or kIndirectDiff. It is the status of
|
||||||
// the field pairs that are filtered out.
|
// the field pairs that are filtered out.
|
||||||
DiffStatus AbiDiffHelper::FilterOutRenamedRecordFields(
|
DiffStatus AbiDiffHelper::FilterOutRenamedRecordFields(
|
||||||
std::deque<std::string> *type_queue, DiffMessageIR::DiffKind diff_kind,
|
DiffMessageIR::DiffKind diff_kind,
|
||||||
std::vector<const RecordFieldIR *> &old_fields,
|
std::vector<const RecordFieldIR *> &old_fields,
|
||||||
std::vector<const RecordFieldIR *> &new_fields) {
|
std::vector<const RecordFieldIR *> &new_fields) {
|
||||||
DiffStatus diff_status = DiffStatus::kNoDiff;
|
DiffStatus diff_status = DiffStatus::kNoDiff;
|
||||||
@@ -421,7 +413,7 @@ DiffStatus AbiDiffHelper::FilterOutRenamedRecordFields(
|
|||||||
}
|
}
|
||||||
|
|
||||||
DiffStatus field_diff_status =
|
DiffStatus field_diff_status =
|
||||||
CompareCommonRecordFields(*old_it, *new_it, type_queue, diff_kind);
|
CompareCommonRecordFields(*old_it, *new_it, diff_kind);
|
||||||
if (field_diff_status.IsDirectDiff()) {
|
if (field_diff_status.IsDirectDiff()) {
|
||||||
out_old_fields.emplace_back(*old_it);
|
out_old_fields.emplace_back(*old_it);
|
||||||
out_new_fields.emplace_back(*new_it);
|
out_new_fields.emplace_back(*new_it);
|
||||||
@@ -442,7 +434,7 @@ DiffStatus AbiDiffHelper::FilterOutRenamedRecordFields(
|
|||||||
RecordFieldDiffResult AbiDiffHelper::CompareRecordFields(
|
RecordFieldDiffResult AbiDiffHelper::CompareRecordFields(
|
||||||
const std::vector<RecordFieldIR> &old_fields,
|
const std::vector<RecordFieldIR> &old_fields,
|
||||||
const std::vector<RecordFieldIR> &new_fields,
|
const std::vector<RecordFieldIR> &new_fields,
|
||||||
std::deque<std::string> *type_queue, DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
RecordFieldDiffResult result;
|
RecordFieldDiffResult result;
|
||||||
DiffStatus &diff_status = result.status;
|
DiffStatus &diff_status = result.status;
|
||||||
diff_status = DiffStatus::kNoDiff;
|
diff_status = DiffStatus::kNoDiff;
|
||||||
@@ -463,7 +455,7 @@ RecordFieldDiffResult AbiDiffHelper::CompareRecordFields(
|
|||||||
result.added_fields =
|
result.added_fields =
|
||||||
utils::FindRemovedElements(new_fields_map, old_fields_map);
|
utils::FindRemovedElements(new_fields_map, old_fields_map);
|
||||||
diff_status.CombineWith(FilterOutRenamedRecordFields(
|
diff_status.CombineWith(FilterOutRenamedRecordFields(
|
||||||
type_queue, diff_kind, result.removed_fields, result.added_fields));
|
diff_kind, result.removed_fields, result.added_fields));
|
||||||
if (result.removed_fields.size() != 0) {
|
if (result.removed_fields.size() != 0) {
|
||||||
diff_status.CombineWith(DiffStatus::kDirectDiff);
|
diff_status.CombineWith(DiffStatus::kDirectDiff);
|
||||||
}
|
}
|
||||||
@@ -475,7 +467,7 @@ RecordFieldDiffResult AbiDiffHelper::CompareRecordFields(
|
|||||||
utils::FindCommonElements(old_fields_map, new_fields_map);
|
utils::FindCommonElements(old_fields_map, new_fields_map);
|
||||||
for (auto &&common_fields : cf) {
|
for (auto &&common_fields : cf) {
|
||||||
DiffStatus field_diff_status = CompareCommonRecordFields(
|
DiffStatus field_diff_status = CompareCommonRecordFields(
|
||||||
common_fields.first, common_fields.second, type_queue, diff_kind);
|
common_fields.first, common_fields.second, diff_kind);
|
||||||
diff_status.CombineWith(field_diff_status);
|
diff_status.CombineWith(field_diff_status);
|
||||||
if (field_diff_status.IsDirectDiff()) {
|
if (field_diff_status.IsDirectDiff()) {
|
||||||
result.diffed_fields.emplace_back(common_fields.first,
|
result.diffed_fields.emplace_back(common_fields.first,
|
||||||
@@ -488,7 +480,6 @@ RecordFieldDiffResult AbiDiffHelper::CompareRecordFields(
|
|||||||
bool AbiDiffHelper::CompareBaseSpecifiers(
|
bool AbiDiffHelper::CompareBaseSpecifiers(
|
||||||
const std::vector<CXXBaseSpecifierIR> &old_base_specifiers,
|
const std::vector<CXXBaseSpecifierIR> &old_base_specifiers,
|
||||||
const std::vector<CXXBaseSpecifierIR> &new_base_specifiers,
|
const std::vector<CXXBaseSpecifierIR> &new_base_specifiers,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
if (old_base_specifiers.size() != new_base_specifiers.size()) {
|
if (old_base_specifiers.size() != new_base_specifiers.size()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -497,7 +488,7 @@ bool AbiDiffHelper::CompareBaseSpecifiers(
|
|||||||
while (i < old_base_specifiers.size()) {
|
while (i < old_base_specifiers.size()) {
|
||||||
if (CompareAndDumpTypeDiff(old_base_specifiers.at(i).GetReferencedType(),
|
if (CompareAndDumpTypeDiff(old_base_specifiers.at(i).GetReferencedType(),
|
||||||
new_base_specifiers.at(i).GetReferencedType(),
|
new_base_specifiers.at(i).GetReferencedType(),
|
||||||
type_queue, diff_kind)
|
diff_kind)
|
||||||
.IsDirectDiff() ||
|
.IsDirectDiff() ||
|
||||||
(old_base_specifiers.at(i).GetAccess() !=
|
(old_base_specifiers.at(i).GetAccess() !=
|
||||||
new_base_specifiers.at(i).GetAccess())) {
|
new_base_specifiers.at(i).GetAccess())) {
|
||||||
@@ -511,7 +502,6 @@ bool AbiDiffHelper::CompareBaseSpecifiers(
|
|||||||
DiffStatus AbiDiffHelper::CompareTemplateInfo(
|
DiffStatus AbiDiffHelper::CompareTemplateInfo(
|
||||||
const std::vector<TemplateElementIR> &old_template_elements,
|
const std::vector<TemplateElementIR> &old_template_elements,
|
||||||
const std::vector<TemplateElementIR> &new_template_elements,
|
const std::vector<TemplateElementIR> &new_template_elements,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
uint32_t old_template_size = old_template_elements.size();
|
uint32_t old_template_size = old_template_elements.size();
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
@@ -524,10 +514,9 @@ DiffStatus AbiDiffHelper::CompareTemplateInfo(
|
|||||||
old_template_elements[i];
|
old_template_elements[i];
|
||||||
const TemplateElementIR &new_template_element =
|
const TemplateElementIR &new_template_element =
|
||||||
new_template_elements[i];
|
new_template_elements[i];
|
||||||
auto template_element_diff =
|
auto template_element_diff = CompareAndDumpTypeDiff(
|
||||||
CompareAndDumpTypeDiff(old_template_element.GetReferencedType(),
|
old_template_element.GetReferencedType(),
|
||||||
new_template_element.GetReferencedType(),
|
new_template_element.GetReferencedType(), diff_kind);
|
||||||
type_queue, diff_kind);
|
|
||||||
if (template_element_diff.HasDiff()) {
|
if (template_element_diff.HasDiff()) {
|
||||||
final_diff_status.CombineWith(template_element_diff);
|
final_diff_status.CombineWith(template_element_diff);
|
||||||
}
|
}
|
||||||
@@ -590,20 +579,16 @@ AbiDiffHelper::FixupDiffedFieldTypeIds(
|
|||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareFunctionTypes(
|
DiffStatus AbiDiffHelper::CompareFunctionTypes(
|
||||||
const CFunctionLikeIR *old_type, const CFunctionLikeIR *new_type,
|
const CFunctionLikeIR *old_type, const CFunctionLikeIR *new_type,
|
||||||
std::deque<std::string> *type_queue, DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
DiffStatus status = CompareFunctionParameters(old_type->GetParameters(),
|
DiffStatus status = CompareFunctionParameters(
|
||||||
new_type->GetParameters(),
|
old_type->GetParameters(), new_type->GetParameters(), diff_kind);
|
||||||
type_queue, diff_kind);
|
|
||||||
status.CombineWith(CompareReturnTypes(old_type->GetReturnType(),
|
status.CombineWith(CompareReturnTypes(old_type->GetReturnType(),
|
||||||
new_type->GetReturnType(), type_queue,
|
new_type->GetReturnType(), diff_kind));
|
||||||
diff_kind));
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareRecordTypes(
|
DiffStatus AbiDiffHelper::CompareRecordTypes(
|
||||||
const RecordTypeIR *old_type,
|
const RecordTypeIR *old_type, const RecordTypeIR *new_type,
|
||||||
const RecordTypeIR *new_type,
|
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
auto record_type_diff_ir = std::make_unique<RecordTypeDiffIR>();
|
auto record_type_diff_ir = std::make_unique<RecordTypeDiffIR>();
|
||||||
// Compare names.
|
// Compare names.
|
||||||
@@ -655,13 +640,13 @@ DiffStatus AbiDiffHelper::CompareRecordTypes(
|
|||||||
|
|
||||||
auto &old_fields_dup = old_type->GetFields();
|
auto &old_fields_dup = old_type->GetFields();
|
||||||
auto &new_fields_dup = new_type->GetFields();
|
auto &new_fields_dup = new_type->GetFields();
|
||||||
RecordFieldDiffResult field_status_and_diffs = CompareRecordFields(
|
RecordFieldDiffResult field_status_and_diffs =
|
||||||
old_fields_dup, new_fields_dup, type_queue, diff_kind);
|
CompareRecordFields(old_fields_dup, new_fields_dup, diff_kind);
|
||||||
final_diff_status.CombineWith(field_status_and_diffs.status);
|
final_diff_status.CombineWith(field_status_and_diffs.status);
|
||||||
|
|
||||||
std::vector<CXXBaseSpecifierIR> old_bases = old_type->GetBases();
|
std::vector<CXXBaseSpecifierIR> old_bases = old_type->GetBases();
|
||||||
std::vector<CXXBaseSpecifierIR> new_bases = new_type->GetBases();
|
std::vector<CXXBaseSpecifierIR> new_bases = new_type->GetBases();
|
||||||
if (!CompareBaseSpecifiers(old_bases, new_bases, type_queue, diff_kind) &&
|
if (!CompareBaseSpecifiers(old_bases, new_bases, diff_kind) &&
|
||||||
ir_diff_dumper_) {
|
ir_diff_dumper_) {
|
||||||
final_diff_status.CombineWith(DiffStatus::kDirectDiff);
|
final_diff_status.CombineWith(DiffStatus::kDirectDiff);
|
||||||
ReplaceReferencesOtherTypeIdWithName(old_types_, old_bases);
|
ReplaceReferencesOtherTypeIdWithName(old_types_, old_bases);
|
||||||
@@ -695,15 +680,15 @@ DiffStatus AbiDiffHelper::CompareRecordTypes(
|
|||||||
|
|
||||||
if (final_diff_status.IsDirectDiff() &&
|
if (final_diff_status.IsDirectDiff() &&
|
||||||
!ir_diff_dumper_->AddDiffMessageIR(record_type_diff_ir.get(),
|
!ir_diff_dumper_->AddDiffMessageIR(record_type_diff_ir.get(),
|
||||||
Unwind(type_queue), diff_kind)) {
|
UnwindTypeStack(), diff_kind)) {
|
||||||
llvm::errs() << "AddDiffMessage on record type failed\n";
|
llvm::errs() << "AddDiffMessage on record type failed\n";
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final_diff_status.CombineWith(CompareTemplateInfo(
|
final_diff_status.CombineWith(
|
||||||
old_type->GetTemplateElements(), new_type->GetTemplateElements(),
|
CompareTemplateInfo(old_type->GetTemplateElements(),
|
||||||
type_queue, diff_kind));
|
new_type->GetTemplateElements(), diff_kind));
|
||||||
|
|
||||||
return (final_diff_status.HasDiff() ? DiffStatus::kIndirectDiff
|
return (final_diff_status.HasDiff() ? DiffStatus::kIndirectDiff
|
||||||
: DiffStatus::kNoDiff);
|
: DiffStatus::kNoDiff);
|
||||||
@@ -711,28 +696,20 @@ DiffStatus AbiDiffHelper::CompareRecordTypes(
|
|||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareLvalueReferenceTypes(
|
DiffStatus AbiDiffHelper::CompareLvalueReferenceTypes(
|
||||||
const LvalueReferenceTypeIR *old_type,
|
const LvalueReferenceTypeIR *old_type,
|
||||||
const LvalueReferenceTypeIR *new_type,
|
const LvalueReferenceTypeIR *new_type, DiffMessageIR::DiffKind diff_kind) {
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
|
||||||
return CompareAndDumpTypeDiff(old_type->GetReferencedType(),
|
return CompareAndDumpTypeDiff(old_type->GetReferencedType(),
|
||||||
new_type->GetReferencedType(),
|
new_type->GetReferencedType(), diff_kind);
|
||||||
type_queue, diff_kind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareRvalueReferenceTypes(
|
DiffStatus AbiDiffHelper::CompareRvalueReferenceTypes(
|
||||||
const RvalueReferenceTypeIR *old_type,
|
const RvalueReferenceTypeIR *old_type,
|
||||||
const RvalueReferenceTypeIR *new_type,
|
const RvalueReferenceTypeIR *new_type, DiffMessageIR::DiffKind diff_kind) {
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
|
||||||
return CompareAndDumpTypeDiff(old_type->GetReferencedType(),
|
return CompareAndDumpTypeDiff(old_type->GetReferencedType(),
|
||||||
new_type->GetReferencedType(),
|
new_type->GetReferencedType(), diff_kind);
|
||||||
type_queue, diff_kind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareQualifiedTypes(
|
DiffStatus AbiDiffHelper::CompareQualifiedTypes(
|
||||||
const QualifiedTypeIR *old_type,
|
const QualifiedTypeIR *old_type, const QualifiedTypeIR *new_type,
|
||||||
const QualifiedTypeIR *new_type,
|
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
// If all the qualifiers are not the same, return direct_diff, else
|
// If all the qualifiers are not the same, return direct_diff, else
|
||||||
// recursively compare the unqualified types.
|
// recursively compare the unqualified types.
|
||||||
@@ -742,27 +719,22 @@ DiffStatus AbiDiffHelper::CompareQualifiedTypes(
|
|||||||
return DiffStatus::kDirectDiff;
|
return DiffStatus::kDirectDiff;
|
||||||
}
|
}
|
||||||
return CompareAndDumpTypeDiff(old_type->GetReferencedType(),
|
return CompareAndDumpTypeDiff(old_type->GetReferencedType(),
|
||||||
new_type->GetReferencedType(),
|
new_type->GetReferencedType(), diff_kind);
|
||||||
type_queue, diff_kind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareArrayTypes(const ArrayTypeIR *old_type,
|
DiffStatus AbiDiffHelper::CompareArrayTypes(const ArrayTypeIR *old_type,
|
||||||
const ArrayTypeIR *new_type,
|
const ArrayTypeIR *new_type,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
if (!CompareSizeAndAlignment(old_type, new_type) ||
|
if (!CompareSizeAndAlignment(old_type, new_type) ||
|
||||||
old_type->IsOfUnknownBound() != new_type->IsOfUnknownBound()) {
|
old_type->IsOfUnknownBound() != new_type->IsOfUnknownBound()) {
|
||||||
return DiffStatus::kDirectDiff;
|
return DiffStatus::kDirectDiff;
|
||||||
}
|
}
|
||||||
return CompareAndDumpTypeDiff(old_type->GetReferencedType(),
|
return CompareAndDumpTypeDiff(old_type->GetReferencedType(),
|
||||||
new_type->GetReferencedType(), type_queue,
|
new_type->GetReferencedType(), diff_kind);
|
||||||
diff_kind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DiffStatus AbiDiffHelper::ComparePointerTypes(
|
DiffStatus AbiDiffHelper::ComparePointerTypes(
|
||||||
const PointerTypeIR *old_type,
|
const PointerTypeIR *old_type, const PointerTypeIR *new_type,
|
||||||
const PointerTypeIR *new_type,
|
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
// The following need to be the same for two pointer types to be considered
|
// The following need to be the same for two pointer types to be considered
|
||||||
// equivalent:
|
// equivalent:
|
||||||
@@ -770,8 +742,7 @@ DiffStatus AbiDiffHelper::ComparePointerTypes(
|
|||||||
// 2) The ultimate pointee is the same.
|
// 2) The ultimate pointee is the same.
|
||||||
assert(CompareSizeAndAlignment(old_type, new_type));
|
assert(CompareSizeAndAlignment(old_type, new_type));
|
||||||
return CompareAndDumpTypeDiff(old_type->GetReferencedType(),
|
return CompareAndDumpTypeDiff(old_type->GetReferencedType(),
|
||||||
new_type->GetReferencedType(),
|
new_type->GetReferencedType(), diff_kind);
|
||||||
type_queue, diff_kind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareBuiltinTypes(
|
DiffStatus AbiDiffHelper::CompareBuiltinTypes(
|
||||||
@@ -790,7 +761,7 @@ DiffStatus AbiDiffHelper::CompareBuiltinTypes(
|
|||||||
DiffStatus AbiDiffHelper::CompareFunctionParameters(
|
DiffStatus AbiDiffHelper::CompareFunctionParameters(
|
||||||
const std::vector<ParamIR> &old_parameters,
|
const std::vector<ParamIR> &old_parameters,
|
||||||
const std::vector<ParamIR> &new_parameters,
|
const std::vector<ParamIR> &new_parameters,
|
||||||
std::deque<std::string> *type_queue, DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
size_t old_parameters_size = old_parameters.size();
|
size_t old_parameters_size = old_parameters.size();
|
||||||
if (old_parameters_size != new_parameters.size()) {
|
if (old_parameters_size != new_parameters.size()) {
|
||||||
return DiffStatus::kDirectDiff;
|
return DiffStatus::kDirectDiff;
|
||||||
@@ -801,7 +772,7 @@ DiffStatus AbiDiffHelper::CompareFunctionParameters(
|
|||||||
const ParamIR &new_parameter = new_parameters.at(i);
|
const ParamIR &new_parameter = new_parameters.at(i);
|
||||||
result.CombineWith(CompareParameterTypes(old_parameter.GetReferencedType(),
|
result.CombineWith(CompareParameterTypes(old_parameter.GetReferencedType(),
|
||||||
new_parameter.GetReferencedType(),
|
new_parameter.GetReferencedType(),
|
||||||
type_queue, diff_kind));
|
diff_kind));
|
||||||
if (old_parameter.GetIsDefault() != new_parameter.GetIsDefault()) {
|
if (old_parameter.GetIsDefault() != new_parameter.GetIsDefault()) {
|
||||||
result.CombineWith(DiffStatus::kDirectDiff);
|
result.CombineWith(DiffStatus::kDirectDiff);
|
||||||
}
|
}
|
||||||
@@ -916,7 +887,7 @@ static bool ResolveImplicitlyConvertibleQualifiedReferences(
|
|||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareParameterTypes(
|
DiffStatus AbiDiffHelper::CompareParameterTypes(
|
||||||
const std::string &old_type_id, const std::string &new_type_id,
|
const std::string &old_type_id, const std::string &new_type_id,
|
||||||
std::deque<std::string> *type_queue, DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
// Compare size and alignment.
|
// Compare size and alignment.
|
||||||
const TypeIR *old_type_ir = FindTypeById(old_types_, old_type_id);
|
const TypeIR *old_type_ir = FindTypeById(old_types_, old_type_id);
|
||||||
const TypeIR *new_type_ir = FindTypeById(new_types_, new_type_id);
|
const TypeIR *new_type_ir = FindTypeById(new_types_, new_type_id);
|
||||||
@@ -934,8 +905,8 @@ DiffStatus AbiDiffHelper::CompareParameterTypes(
|
|||||||
return DiffStatus::kDirectDiff;
|
return DiffStatus::kDirectDiff;
|
||||||
}
|
}
|
||||||
// Compare the unqualified referenced types.
|
// Compare the unqualified referenced types.
|
||||||
DiffStatus result = CompareAndDumpTypeDiff(
|
DiffStatus result = CompareAndDumpTypeDiff(old_referenced_type_id,
|
||||||
old_referenced_type_id, new_referenced_type_id, type_queue, diff_kind);
|
new_referenced_type_id, diff_kind);
|
||||||
if (!are_qualifiers_equal) {
|
if (!are_qualifiers_equal) {
|
||||||
result.CombineWith(DiffStatus::kDirectExt);
|
result.CombineWith(DiffStatus::kDirectExt);
|
||||||
}
|
}
|
||||||
@@ -946,7 +917,7 @@ DiffStatus AbiDiffHelper::CompareParameterTypes(
|
|||||||
// to ResolveImplicitlyConvertibleQualifiedReferences.
|
// to ResolveImplicitlyConvertibleQualifiedReferences.
|
||||||
DiffStatus AbiDiffHelper::CompareReturnTypes(
|
DiffStatus AbiDiffHelper::CompareReturnTypes(
|
||||||
const std::string &old_type_id, const std::string &new_type_id,
|
const std::string &old_type_id, const std::string &new_type_id,
|
||||||
std::deque<std::string> *type_queue, DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
// Compare size and alignment.
|
// Compare size and alignment.
|
||||||
const TypeIR *old_type_ir = FindTypeById(old_types_, old_type_id);
|
const TypeIR *old_type_ir = FindTypeById(old_types_, old_type_id);
|
||||||
const TypeIR *new_type_ir = FindTypeById(new_types_, new_type_id);
|
const TypeIR *new_type_ir = FindTypeById(new_types_, new_type_id);
|
||||||
@@ -964,8 +935,8 @@ DiffStatus AbiDiffHelper::CompareReturnTypes(
|
|||||||
return DiffStatus::kDirectDiff;
|
return DiffStatus::kDirectDiff;
|
||||||
}
|
}
|
||||||
// Compare the unqualified referenced types.
|
// Compare the unqualified referenced types.
|
||||||
DiffStatus result = CompareAndDumpTypeDiff(
|
DiffStatus result = CompareAndDumpTypeDiff(old_referenced_type_id,
|
||||||
old_referenced_type_id, new_referenced_type_id, type_queue, diff_kind);
|
new_referenced_type_id, diff_kind);
|
||||||
if (!are_qualifiers_equal) {
|
if (!are_qualifiers_equal) {
|
||||||
result.CombineWith(DiffStatus::kDirectExt);
|
result.CombineWith(DiffStatus::kDirectExt);
|
||||||
}
|
}
|
||||||
@@ -973,8 +944,7 @@ DiffStatus AbiDiffHelper::CompareReturnTypes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareAndDumpTypeDiff(
|
DiffStatus AbiDiffHelper::CompareAndDumpTypeDiff(
|
||||||
const TypeIR *old_type, const TypeIR *new_type,
|
const TypeIR *old_type, const TypeIR *new_type, LinkableMessageKind kind,
|
||||||
LinkableMessageKind kind, std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
if (ignored_linker_set_keys_.find(new_type->GetLinkerSetKey()) !=
|
if (ignored_linker_set_keys_.find(new_type->GetLinkerSetKey()) !=
|
||||||
ignored_linker_set_keys_.end()) {
|
ignored_linker_set_keys_.end()) {
|
||||||
@@ -988,41 +958,38 @@ DiffStatus AbiDiffHelper::CompareAndDumpTypeDiff(
|
|||||||
case LinkableMessageKind::QualifiedTypeKind:
|
case LinkableMessageKind::QualifiedTypeKind:
|
||||||
return CompareQualifiedTypes(
|
return CompareQualifiedTypes(
|
||||||
static_cast<const QualifiedTypeIR *>(old_type),
|
static_cast<const QualifiedTypeIR *>(old_type),
|
||||||
static_cast<const QualifiedTypeIR *>(new_type), type_queue,
|
static_cast<const QualifiedTypeIR *>(new_type), diff_kind);
|
||||||
diff_kind);
|
|
||||||
case LinkableMessageKind::ArrayTypeKind:
|
case LinkableMessageKind::ArrayTypeKind:
|
||||||
return CompareArrayTypes(static_cast<const ArrayTypeIR *>(old_type),
|
return CompareArrayTypes(static_cast<const ArrayTypeIR *>(old_type),
|
||||||
static_cast<const ArrayTypeIR *>(new_type),
|
static_cast<const ArrayTypeIR *>(new_type),
|
||||||
type_queue, diff_kind);
|
diff_kind);
|
||||||
case LinkableMessageKind::EnumTypeKind:
|
case LinkableMessageKind::EnumTypeKind:
|
||||||
return CompareEnumTypes(static_cast<const EnumTypeIR *>(old_type),
|
return CompareEnumTypes(static_cast<const EnumTypeIR *>(old_type),
|
||||||
static_cast<const EnumTypeIR *>(new_type),
|
static_cast<const EnumTypeIR *>(new_type),
|
||||||
type_queue, diff_kind);
|
diff_kind);
|
||||||
|
|
||||||
case LinkableMessageKind::LvalueReferenceTypeKind:
|
case LinkableMessageKind::LvalueReferenceTypeKind:
|
||||||
return CompareLvalueReferenceTypes(
|
return CompareLvalueReferenceTypes(
|
||||||
static_cast<const LvalueReferenceTypeIR *>(old_type),
|
static_cast<const LvalueReferenceTypeIR *>(old_type),
|
||||||
static_cast<const LvalueReferenceTypeIR *>(new_type), type_queue,
|
static_cast<const LvalueReferenceTypeIR *>(new_type), diff_kind);
|
||||||
diff_kind);
|
|
||||||
case LinkableMessageKind::RvalueReferenceTypeKind:
|
case LinkableMessageKind::RvalueReferenceTypeKind:
|
||||||
return CompareRvalueReferenceTypes(
|
return CompareRvalueReferenceTypes(
|
||||||
static_cast<const RvalueReferenceTypeIR *>(old_type),
|
static_cast<const RvalueReferenceTypeIR *>(old_type),
|
||||||
static_cast<const RvalueReferenceTypeIR *>(new_type), type_queue,
|
static_cast<const RvalueReferenceTypeIR *>(new_type), diff_kind);
|
||||||
diff_kind);
|
|
||||||
case LinkableMessageKind::PointerTypeKind:
|
case LinkableMessageKind::PointerTypeKind:
|
||||||
return ComparePointerTypes(static_cast<const PointerTypeIR *>(old_type),
|
return ComparePointerTypes(static_cast<const PointerTypeIR *>(old_type),
|
||||||
static_cast<const PointerTypeIR *>(new_type),
|
static_cast<const PointerTypeIR *>(new_type),
|
||||||
type_queue, diff_kind);
|
diff_kind);
|
||||||
|
|
||||||
case LinkableMessageKind::RecordTypeKind:
|
case LinkableMessageKind::RecordTypeKind:
|
||||||
return CompareRecordTypes(static_cast<const RecordTypeIR *>(old_type),
|
return CompareRecordTypes(static_cast<const RecordTypeIR *>(old_type),
|
||||||
static_cast<const RecordTypeIR *>(new_type),
|
static_cast<const RecordTypeIR *>(new_type),
|
||||||
type_queue, diff_kind);
|
diff_kind);
|
||||||
|
|
||||||
case LinkableMessageKind::FunctionTypeKind: {
|
case LinkableMessageKind::FunctionTypeKind: {
|
||||||
DiffStatus result = CompareFunctionTypes(
|
DiffStatus result = CompareFunctionTypes(
|
||||||
static_cast<const FunctionTypeIR *>(old_type),
|
static_cast<const FunctionTypeIR *>(old_type),
|
||||||
static_cast<const FunctionTypeIR *>(new_type), type_queue, diff_kind);
|
static_cast<const FunctionTypeIR *>(new_type), diff_kind);
|
||||||
// Do not allow extending function pointers, function references, etc.
|
// Do not allow extending function pointers, function references, etc.
|
||||||
if (result.IsExtension()) {
|
if (result.IsExtension()) {
|
||||||
result.CombineWith(DiffStatus::kDirectDiff);
|
result.CombineWith(DiffStatus::kDirectDiff);
|
||||||
@@ -1046,7 +1013,6 @@ static DiffStatus CompareDistinctKindMessages(
|
|||||||
|
|
||||||
DiffStatus AbiDiffHelper::CompareAndDumpTypeDiff(
|
DiffStatus AbiDiffHelper::CompareAndDumpTypeDiff(
|
||||||
const std::string &old_type_id, const std::string &new_type_id,
|
const std::string &old_type_id, const std::string &new_type_id,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind) {
|
DiffMessageIR::DiffKind diff_kind) {
|
||||||
// Check the map for type ids which have already been compared
|
// Check the map for type ids which have already been compared
|
||||||
// These types have already been diffed, return without further comparison.
|
// These types have already been diffed, return without further comparison.
|
||||||
@@ -1054,7 +1020,7 @@ DiffStatus AbiDiffHelper::CompareAndDumpTypeDiff(
|
|||||||
return DiffStatus::kNoDiff;
|
return DiffStatus::kNoDiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeStackGuard guard(type_queue,
|
TypeStackGuard guard(type_stack_,
|
||||||
ConvertTypeIdToString(old_types_, old_type_id));
|
ConvertTypeIdToString(old_types_, old_type_id));
|
||||||
|
|
||||||
AbiElementMap<const TypeIR *>::const_iterator old_it =
|
AbiElementMap<const TypeIR *>::const_iterator old_it =
|
||||||
@@ -1075,8 +1041,8 @@ DiffStatus AbiDiffHelper::CompareAndDumpTypeDiff(
|
|||||||
if (old_kind != new_kind) {
|
if (old_kind != new_kind) {
|
||||||
diff_status = CompareDistinctKindMessages(old_it->second, new_it->second);
|
diff_status = CompareDistinctKindMessages(old_it->second, new_it->second);
|
||||||
} else {
|
} else {
|
||||||
diff_status = CompareAndDumpTypeDiff(old_it->second , new_it->second ,
|
diff_status = CompareAndDumpTypeDiff(old_it->second, new_it->second,
|
||||||
old_kind, type_queue, diff_kind);
|
old_kind, diff_kind);
|
||||||
}
|
}
|
||||||
return diff_status;
|
return diff_status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,26 +72,18 @@ struct RecordFieldDiffResult {
|
|||||||
|
|
||||||
class TypeStackGuard {
|
class TypeStackGuard {
|
||||||
public:
|
public:
|
||||||
TypeStackGuard(std::deque<std::string> *type_stack,
|
TypeStackGuard(std::deque<std::string> &type_stack,
|
||||||
const std::string &type_name) {
|
const std::string &type_name)
|
||||||
type_stack_ = type_stack;
|
: type_stack_(type_stack) {
|
||||||
if (type_stack_) {
|
type_stack_.push_back(type_name);
|
||||||
type_stack_->push_back(type_name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~TypeStackGuard() {
|
~TypeStackGuard() { type_stack_.pop_back(); }
|
||||||
if (type_stack_ && !type_stack_->empty()) {
|
|
||||||
type_stack_->pop_back();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::deque<std::string> *type_stack_;
|
std::deque<std::string> &type_stack_;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string Unwind(const std::deque<std::string> *type_queue);
|
|
||||||
|
|
||||||
struct DiffPolicyOptions {
|
struct DiffPolicyOptions {
|
||||||
DiffPolicyOptions(bool consider_opaque_types_different)
|
DiffPolicyOptions(bool consider_opaque_types_different)
|
||||||
: consider_opaque_types_different_(consider_opaque_types_different) {}
|
: consider_opaque_types_different_(consider_opaque_types_different) {}
|
||||||
@@ -113,71 +105,57 @@ class AbiDiffHelper {
|
|||||||
ignored_linker_set_keys_(ignored_linker_set_keys),
|
ignored_linker_set_keys_(ignored_linker_set_keys),
|
||||||
ir_diff_dumper_(ir_diff_dumper) {}
|
ir_diff_dumper_(ir_diff_dumper) {}
|
||||||
|
|
||||||
|
// Concatenate the strings in type_stack.
|
||||||
|
std::string UnwindTypeStack();
|
||||||
|
|
||||||
bool AreOpaqueTypesEqual(const std::string &old_type_str,
|
bool AreOpaqueTypesEqual(const std::string &old_type_str,
|
||||||
const std::string &new_type_str) const;
|
const std::string &new_type_str) const;
|
||||||
|
|
||||||
DiffStatus CompareAndDumpTypeDiff(
|
DiffStatus CompareAndDumpTypeDiff(
|
||||||
const std::string &old_type_str, const std::string &new_type_str,
|
const std::string &old_type_str, const std::string &new_type_str,
|
||||||
std::deque<std::string> *type_queue = nullptr,
|
|
||||||
IRDiffDumper::DiffKind diff_kind = DiffMessageIR::Unreferenced);
|
IRDiffDumper::DiffKind diff_kind = DiffMessageIR::Unreferenced);
|
||||||
|
|
||||||
DiffStatus CompareAndDumpTypeDiff(
|
DiffStatus CompareAndDumpTypeDiff(
|
||||||
const TypeIR *old_type, const TypeIR *new_type,
|
const TypeIR *old_type, const TypeIR *new_type, LinkableMessageKind kind,
|
||||||
LinkableMessageKind kind,
|
|
||||||
std::deque<std::string> *type_queue = nullptr,
|
|
||||||
IRDiffDumper::DiffKind diff_kind = DiffMessageIR::Unreferenced);
|
IRDiffDumper::DiffKind diff_kind = DiffMessageIR::Unreferenced);
|
||||||
|
|
||||||
|
|
||||||
DiffStatus CompareRecordTypes(const RecordTypeIR *old_type,
|
DiffStatus CompareRecordTypes(const RecordTypeIR *old_type,
|
||||||
const RecordTypeIR *new_type,
|
const RecordTypeIR *new_type,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus CompareEnumTypes(const EnumTypeIR *old_type,
|
DiffStatus CompareEnumTypes(const EnumTypeIR *old_type,
|
||||||
const EnumTypeIR *new_type,
|
const EnumTypeIR *new_type,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus CompareFunctionTypes(const CFunctionLikeIR *old_type,
|
DiffStatus CompareFunctionTypes(const CFunctionLikeIR *old_type,
|
||||||
const CFunctionLikeIR *new_type,
|
const CFunctionLikeIR *new_type,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
DiffMessageIR::DiffKind diff_kind);
|
DiffMessageIR::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus CompareTemplateInfo(
|
DiffStatus CompareTemplateInfo(
|
||||||
const std::vector<TemplateElementIR> &old_template_elements,
|
const std::vector<TemplateElementIR> &old_template_elements,
|
||||||
const std::vector<TemplateElementIR> &new_template_elements,
|
const std::vector<TemplateElementIR> &new_template_elements,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DiffStatus CompareQualifiedTypes(const QualifiedTypeIR *old_type,
|
DiffStatus CompareQualifiedTypes(const QualifiedTypeIR *old_type,
|
||||||
const QualifiedTypeIR *new_type,
|
const QualifiedTypeIR *new_type,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus CompareArrayTypes(const ArrayTypeIR *old_type,
|
DiffStatus CompareArrayTypes(const ArrayTypeIR *old_type,
|
||||||
const ArrayTypeIR *new_type,
|
const ArrayTypeIR *new_type,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus ComparePointerTypes(const PointerTypeIR *old_type,
|
DiffStatus ComparePointerTypes(const PointerTypeIR *old_type,
|
||||||
const PointerTypeIR *new_type,
|
const PointerTypeIR *new_type,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus CompareLvalueReferenceTypes(
|
DiffStatus CompareLvalueReferenceTypes(const LvalueReferenceTypeIR *old_type,
|
||||||
const LvalueReferenceTypeIR *old_type,
|
const LvalueReferenceTypeIR *new_type,
|
||||||
const LvalueReferenceTypeIR *new_type,
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
|
||||||
|
|
||||||
DiffStatus CompareRvalueReferenceTypes(
|
|
||||||
const RvalueReferenceTypeIR *old_type,
|
|
||||||
const RvalueReferenceTypeIR *new_type,
|
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
|
||||||
|
|
||||||
|
DiffStatus CompareRvalueReferenceTypes(const RvalueReferenceTypeIR *old_type,
|
||||||
|
const RvalueReferenceTypeIR *new_type,
|
||||||
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus CompareBuiltinTypes(const BuiltinTypeIR *old_type,
|
DiffStatus CompareBuiltinTypes(const BuiltinTypeIR *old_type,
|
||||||
const BuiltinTypeIR *new_type);
|
const BuiltinTypeIR *new_type);
|
||||||
@@ -200,50 +178,42 @@ class AbiDiffHelper {
|
|||||||
|
|
||||||
DiffStatus CompareCommonRecordFields(const RecordFieldIR *old_field,
|
DiffStatus CompareCommonRecordFields(const RecordFieldIR *old_field,
|
||||||
const RecordFieldIR *new_field,
|
const RecordFieldIR *new_field,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus FilterOutRenamedRecordFields(
|
DiffStatus FilterOutRenamedRecordFields(
|
||||||
std::deque<std::string> *type_queue, DiffMessageIR::DiffKind diff_kind,
|
DiffMessageIR::DiffKind diff_kind,
|
||||||
std::vector<const RecordFieldIR *> &old_fields,
|
std::vector<const RecordFieldIR *> &old_fields,
|
||||||
std::vector<const RecordFieldIR *> &new_fields);
|
std::vector<const RecordFieldIR *> &new_fields);
|
||||||
|
|
||||||
RecordFieldDiffResult CompareRecordFields(
|
RecordFieldDiffResult CompareRecordFields(
|
||||||
const std::vector<RecordFieldIR> &old_fields,
|
const std::vector<RecordFieldIR> &old_fields,
|
||||||
const std::vector<RecordFieldIR> &new_fields,
|
const std::vector<RecordFieldIR> &new_fields,
|
||||||
std::deque<std::string> *type_queue, IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
bool CompareBaseSpecifiers(
|
bool CompareBaseSpecifiers(
|
||||||
const std::vector<CXXBaseSpecifierIR> &old_base_specifiers,
|
const std::vector<CXXBaseSpecifierIR> &old_base_specifiers,
|
||||||
const std::vector<CXXBaseSpecifierIR> &new_base_specifiers,
|
const std::vector<CXXBaseSpecifierIR> &new_base_specifiers,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus CompareFunctionParameters(
|
DiffStatus CompareFunctionParameters(
|
||||||
const std::vector<ParamIR> &old_parameters,
|
const std::vector<ParamIR> &old_parameters,
|
||||||
const std::vector<ParamIR> &new_parameters,
|
const std::vector<ParamIR> &new_parameters,
|
||||||
std::deque<std::string> *type_queue, IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus CompareParameterTypes(const std::string &old_type_id,
|
DiffStatus CompareParameterTypes(const std::string &old_type_id,
|
||||||
const std::string &new_type_id,
|
const std::string &new_type_id,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
DiffStatus CompareReturnTypes(const std::string &old_type_id,
|
DiffStatus CompareReturnTypes(const std::string &old_type_id,
|
||||||
const std::string &new_type_id,
|
const std::string &new_type_id,
|
||||||
std::deque<std::string> *type_queue,
|
|
||||||
IRDiffDumper::DiffKind diff_kind);
|
IRDiffDumper::DiffKind diff_kind);
|
||||||
|
|
||||||
template <typename DiffType, typename DiffElement>
|
|
||||||
bool AddToDiff(DiffType *mutable_diff, const DiffElement *oldp,
|
|
||||||
const DiffElement *newp,
|
|
||||||
std::deque<std::string> *type_queue = nullptr);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const AbiElementMap<const TypeIR *> &old_types_;
|
const AbiElementMap<const TypeIR *> &old_types_;
|
||||||
const AbiElementMap<const TypeIR *> &new_types_;
|
const AbiElementMap<const TypeIR *> &new_types_;
|
||||||
const DiffPolicyOptions &diff_policy_options_;
|
const DiffPolicyOptions &diff_policy_options_;
|
||||||
std::set<std::string> *type_cache_;
|
std::set<std::string> *type_cache_;
|
||||||
|
std::deque<std::string> type_stack_;
|
||||||
const std::set<std::string> &ignored_linker_set_keys_;
|
const std::set<std::string> &ignored_linker_set_keys_;
|
||||||
IRDiffDumper *ir_diff_dumper_;
|
IRDiffDumper *ir_diff_dumper_;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user