Merge "Mark two records as different if the access specifier is downgraded."
This commit is contained in:
@@ -518,7 +518,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());
|
||||||
if (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(
|
||||||
std::make_unique<abi_util::AccessSpecifierDiffIR>(
|
std::make_unique<abi_util::AccessSpecifierDiffIR>(
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class SuperSpeaker {
|
|||||||
#else
|
#else
|
||||||
int mSpeakderId;
|
int mSpeakderId;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GOLDEN_FUNCTION_POINTER
|
#if GOLDEN_FUNCTION_POINTER
|
||||||
#if GOLDEN_FUNCTION_POINTER_ADD_PARAM
|
#if GOLDEN_FUNCTION_POINTER_ADD_PARAM
|
||||||
SuperSpeaker * (*speaker_fp)(int, char, int);
|
SuperSpeaker * (*speaker_fp)(int, char, int);
|
||||||
@@ -67,4 +68,17 @@ class SuperSpeaker {
|
|||||||
SuperSpeaker * (*speaker_fp)(int, char);
|
SuperSpeaker * (*speaker_fp)(int, char);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if GOLDEN_WITH_INTERNAL_STRUCT
|
||||||
|
#ifdef GOLDEN_WITH_PUBLIC_INTERNAL_STRUCT
|
||||||
|
public:
|
||||||
|
#else
|
||||||
|
private:
|
||||||
|
#endif
|
||||||
|
struct InternalStruct {
|
||||||
|
int internal;
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
InternalStruct a;
|
||||||
|
#endif // GOLDEN_WITH_INTERNAL_STRUCT
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -398,6 +398,32 @@ TEST_MODULES = [
|
|||||||
arch = '',
|
arch = '',
|
||||||
api = 'current',
|
api = 'current',
|
||||||
),
|
),
|
||||||
|
Module(
|
||||||
|
name = 'libgolden_cpp_internal_public_struct',
|
||||||
|
srcs = ['integration/cpp/gold/golden_1.cpp',
|
||||||
|
'integration/cpp/gold/high_volume_speaker.cpp',
|
||||||
|
'integration/cpp/gold/low_volume_speaker.cpp',
|
||||||
|
],
|
||||||
|
version_script = 'integration/cpp/gold/map.txt',
|
||||||
|
export_include_dirs = ['integration/cpp/gold/include'],
|
||||||
|
cflags = ['-DGOLDEN_WITH_INTERNAL_STRUCT',
|
||||||
|
'-DGOLDEN_WITH_PUBLIC_INTERNAL_STRUCT'],
|
||||||
|
arch = '',
|
||||||
|
api = 'current',
|
||||||
|
),
|
||||||
|
Module(
|
||||||
|
name = 'libgolden_cpp_internal_private_struct',
|
||||||
|
srcs = ['integration/cpp/gold/golden_1.cpp',
|
||||||
|
'integration/cpp/gold/high_volume_speaker.cpp',
|
||||||
|
'integration/cpp/gold/low_volume_speaker.cpp',
|
||||||
|
],
|
||||||
|
version_script = 'integration/cpp/gold/map.txt',
|
||||||
|
export_include_dirs = ['integration/cpp/gold/include'],
|
||||||
|
cflags = ['-DGOLDEN_WITH_INTERNAL_STRUCT'],
|
||||||
|
arch = '',
|
||||||
|
api = 'current',
|
||||||
|
),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
TEST_MODULES = { m.name: m for m in TEST_MODULES }
|
TEST_MODULES = { m.name: m for m in TEST_MODULES }
|
||||||
|
|||||||
@@ -238,6 +238,17 @@ class MyTest(unittest.TestCase):
|
|||||||
"libgolden_cpp_function_pointer_parameter_added", 8, [], True,
|
"libgolden_cpp_function_pointer_parameter_added", 8, [], True,
|
||||||
True)
|
True)
|
||||||
|
|
||||||
|
def test_libgolden_cpp_internal_struct_access_upgraded(self):
|
||||||
|
self.prepare_and_run_abi_diff_all_archs(
|
||||||
|
"libgolden_cpp_internal_private_struct",
|
||||||
|
"libgolden_cpp_internal_public_struct", 0, [], True,
|
||||||
|
True)
|
||||||
|
|
||||||
|
def test_libgolden_cpp_internal_struct_access_downgraded(self):
|
||||||
|
self.prepare_and_run_abi_diff_all_archs(
|
||||||
|
"libgolden_cpp_internal_public_struct",
|
||||||
|
"libgolden_cpp_internal_private_struct", 8, [], True,
|
||||||
|
True)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user