Merge "Add linker_set_key to RecordTypeDiff and EnumTypeDiff"
This commit is contained in:
@@ -204,6 +204,7 @@ DiffStatus AbiDiffHelper::CompareEnumTypes(
|
|||||||
}
|
}
|
||||||
auto enum_type_diff_ir = std::make_unique<EnumTypeDiffIR>();
|
auto enum_type_diff_ir = std::make_unique<EnumTypeDiffIR>();
|
||||||
enum_type_diff_ir->SetName(old_type->GetName());
|
enum_type_diff_ir->SetName(old_type->GetName());
|
||||||
|
enum_type_diff_ir->SetLinkerSetKey(old_type->GetLinkerSetKey());
|
||||||
const std::string &old_underlying_type =
|
const std::string &old_underlying_type =
|
||||||
ConvertTypeIdToString(old_types_, old_type->GetUnderlyingType());
|
ConvertTypeIdToString(old_types_, old_type->GetUnderlyingType());
|
||||||
const std::string &new_underlying_type =
|
const std::string &new_underlying_type =
|
||||||
@@ -555,6 +556,7 @@ DiffStatus AbiDiffHelper::CompareRecordTypes(
|
|||||||
}
|
}
|
||||||
DiffStatus final_diff_status = DiffStatus::no_diff;
|
DiffStatus final_diff_status = DiffStatus::no_diff;
|
||||||
record_type_diff_ir->SetName(old_type->GetName());
|
record_type_diff_ir->SetName(old_type->GetName());
|
||||||
|
record_type_diff_ir->SetLinkerSetKey(old_type->GetLinkerSetKey());
|
||||||
if (IsAccessDownGraded(old_type->GetAccess(), new_type->GetAccess())) {
|
if (IsAccessDownGraded(old_type->GetAccess(), new_type->GetAccess())) {
|
||||||
final_diff_status = DiffStatus::indirect_diff;
|
final_diff_status = DiffStatus::indirect_diff;
|
||||||
record_type_diff_ir->SetAccessDiff(
|
record_type_diff_ir->SetAccessDiff(
|
||||||
|
|||||||
@@ -190,6 +190,10 @@ class RecordTypeDiffIR : public DiffMessageIR {
|
|||||||
base_specifier_diffs_ = std::move(base_diffs);
|
base_specifier_diffs_ = std::move(base_diffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetLinkerSetKey(std::string linker_set_key) {
|
||||||
|
linker_set_key_ = std::move(linker_set_key);
|
||||||
|
}
|
||||||
|
|
||||||
bool DiffExists() const {
|
bool DiffExists() const {
|
||||||
return (type_diff_ != nullptr) || (vtable_diffs_ != nullptr) ||
|
return (type_diff_ != nullptr) || (vtable_diffs_ != nullptr) ||
|
||||||
(fields_removed_.size() != 0) || (field_diffs_.size() != 0) ||
|
(fields_removed_.size() != 0) || (field_diffs_.size() != 0) ||
|
||||||
@@ -208,6 +212,8 @@ class RecordTypeDiffIR : public DiffMessageIR {
|
|||||||
return base_specifier_diffs_.get();
|
return base_specifier_diffs_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string &GetLinkerSetKey() const { return linker_set_key_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// optional implemented with vector / std::unique_ptr.
|
// optional implemented with vector / std::unique_ptr.
|
||||||
std::unique_ptr<TypeDiffIR> type_diff_;
|
std::unique_ptr<TypeDiffIR> type_diff_;
|
||||||
@@ -217,8 +223,7 @@ class RecordTypeDiffIR : public DiffMessageIR {
|
|||||||
std::vector<const RecordFieldIR *> fields_added_;
|
std::vector<const RecordFieldIR *> fields_added_;
|
||||||
std::unique_ptr<AccessSpecifierDiffIR> access_diff_;
|
std::unique_ptr<AccessSpecifierDiffIR> access_diff_;
|
||||||
std::unique_ptr<CXXBaseSpecifierDiffIR> base_specifier_diffs_;
|
std::unique_ptr<CXXBaseSpecifierDiffIR> base_specifier_diffs_;
|
||||||
// Template Diffs are not needed since they will show up in the linker set
|
std::string linker_set_key_;
|
||||||
// key.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnumFieldDiffIR {
|
class EnumFieldDiffIR {
|
||||||
@@ -274,6 +279,12 @@ class EnumTypeDiffIR : public DiffMessageIR {
|
|||||||
return underlying_type_diff_.get();
|
return underlying_type_diff_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetLinkerSetKey(std::string linker_set_key) {
|
||||||
|
linker_set_key_ = std::move(linker_set_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string &GetLinkerSetKey() const { return linker_set_key_; }
|
||||||
|
|
||||||
bool IsExtended() const {
|
bool IsExtended() const {
|
||||||
if (fields_removed_.size() == 0 && fields_diff_.size() == 0 &&
|
if (fields_removed_.size() == 0 && fields_diff_.size() == 0 &&
|
||||||
fields_added_.size() != 0) {
|
fields_added_.size() != 0) {
|
||||||
@@ -300,8 +311,7 @@ class EnumTypeDiffIR : public DiffMessageIR {
|
|||||||
std::vector<const EnumFieldIR *> fields_removed_;
|
std::vector<const EnumFieldIR *> fields_removed_;
|
||||||
std::vector<const EnumFieldIR *> fields_added_;
|
std::vector<const EnumFieldIR *> fields_added_;
|
||||||
std::vector<EnumFieldDiffIR> fields_diff_;
|
std::vector<EnumFieldDiffIR> fields_diff_;
|
||||||
// Modifiable to allow implicit construction.
|
std::string linker_set_key_;
|
||||||
std::string name_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GlobalVarDiffIR : public DiffMessageIR {
|
class GlobalVarDiffIR : public DiffMessageIR {
|
||||||
|
|||||||
@@ -138,8 +138,10 @@ abi_diff::RecordTypeDiff IRDiffToProtobufConverter::ConvertRecordTypeDiffIR(
|
|||||||
const RecordTypeDiffIR *record_type_diff_ir) {
|
const RecordTypeDiffIR *record_type_diff_ir) {
|
||||||
abi_diff::RecordTypeDiff record_type_diff_protobuf;
|
abi_diff::RecordTypeDiff record_type_diff_protobuf;
|
||||||
record_type_diff_protobuf.set_name(record_type_diff_ir->GetName());
|
record_type_diff_protobuf.set_name(record_type_diff_ir->GetName());
|
||||||
const TypeDiffIR *type_diff_ir = record_type_diff_ir->GetTypeDiff();
|
record_type_diff_protobuf.set_linker_set_key(
|
||||||
|
record_type_diff_ir->GetLinkerSetKey());
|
||||||
// If a type_info diff exists
|
// If a type_info diff exists
|
||||||
|
const TypeDiffIR *type_diff_ir = record_type_diff_ir->GetTypeDiff();
|
||||||
if (type_diff_ir != nullptr) {
|
if (type_diff_ir != nullptr) {
|
||||||
abi_diff::TypeInfoDiff *type_info_diff =
|
abi_diff::TypeInfoDiff *type_info_diff =
|
||||||
record_type_diff_protobuf.mutable_type_info_diff();
|
record_type_diff_protobuf.mutable_type_info_diff();
|
||||||
@@ -230,6 +232,8 @@ abi_diff::EnumTypeDiff IRDiffToProtobufConverter::ConvertEnumTypeDiffIR(
|
|||||||
const EnumTypeDiffIR *enum_type_diff_ir) {
|
const EnumTypeDiffIR *enum_type_diff_ir) {
|
||||||
abi_diff::EnumTypeDiff enum_type_diff_protobuf;
|
abi_diff::EnumTypeDiff enum_type_diff_protobuf;
|
||||||
enum_type_diff_protobuf.set_name(enum_type_diff_ir->GetName());
|
enum_type_diff_protobuf.set_name(enum_type_diff_ir->GetName());
|
||||||
|
enum_type_diff_protobuf.set_linker_set_key(
|
||||||
|
enum_type_diff_ir->GetLinkerSetKey());
|
||||||
const std::pair<std::string, std::string> *underlying_type_diff =
|
const std::pair<std::string, std::string> *underlying_type_diff =
|
||||||
enum_type_diff_ir->GetUnderlyingTypeDiff();
|
enum_type_diff_ir->GetUnderlyingTypeDiff();
|
||||||
if ((underlying_type_diff != nullptr &&
|
if ((underlying_type_diff != nullptr &&
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ message CXXBaseSpecifierDiff {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message RecordTypeDiff {
|
message RecordTypeDiff {
|
||||||
|
// Template diffs are not needed since they have different linker set keys.
|
||||||
optional string name = 1;
|
optional string name = 1;
|
||||||
optional string type_stack = 2;
|
optional string type_stack = 2;
|
||||||
optional TypeInfoDiff type_info_diff = 3;
|
optional TypeInfoDiff type_info_diff = 3;
|
||||||
@@ -38,6 +39,7 @@ message RecordTypeDiff {
|
|||||||
repeated RecordFieldDeclDiff fields_diff = 6;
|
repeated RecordFieldDeclDiff fields_diff = 6;
|
||||||
optional CXXBaseSpecifierDiff bases_diff = 7;
|
optional CXXBaseSpecifierDiff bases_diff = 7;
|
||||||
optional VTableLayoutDiff vtable_layout_diff = 8;
|
optional VTableLayoutDiff vtable_layout_diff = 8;
|
||||||
|
optional string linker_set_key = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UnderlyingTypeDiff {
|
message UnderlyingTypeDiff {
|
||||||
@@ -57,6 +59,7 @@ message EnumTypeDiff {
|
|||||||
optional UnderlyingTypeDiff underlying_type_diff = 4;
|
optional UnderlyingTypeDiff underlying_type_diff = 4;
|
||||||
repeated abi_dump.EnumFieldDecl fields_added = 5;
|
repeated abi_dump.EnumFieldDecl fields_added = 5;
|
||||||
repeated abi_dump.EnumFieldDecl fields_removed = 6;
|
repeated abi_dump.EnumFieldDecl fields_removed = 6;
|
||||||
|
optional string linker_set_key = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message FunctionDeclDiff {
|
message FunctionDeclDiff {
|
||||||
|
|||||||
Reference in New Issue
Block a user