Filter global variables and functions by -ignore-linker-set-key

Test: ./test.py HeaderCheckerTest.test_libgolden_cpp_return_type_diff
Bug: 259148872
Change-Id: I81f672d650a93eee69107ade07fc660a64c38e45
This commit is contained in:
Hsin-Yi Chen
2022-11-15 11:59:05 +08:00
parent aa16c32035
commit f5b6ebad09
3 changed files with 8 additions and 9 deletions

View File

@@ -382,8 +382,11 @@ bool HeaderAbiDiff::DumpDiffElements(
const T *old_element = pair.first;
const T *new_element = pair.second;
// The old and new linker set keys are supposed to be equal.
if (IgnoreSymbol<T>(old_element, ignored_symbols_,
[](const T *e) {return e->GetLinkerSetKey();})) {
[](const T *e) { return e->GetLinkerSetKey(); }) ||
ignored_linker_set_keys_.find(old_element->GetLinkerSetKey()) !=
ignored_linker_set_keys_.end()) {
continue;
}

View File

@@ -32,10 +32,6 @@ template <>
bool DiffWrapper<repr::RecordTypeIR>::DumpDiff(
repr::DiffMessageIR::DiffKind diff_kind) {
std::deque<std::string> type_queue;
if (oldp_->GetLinkerSetKey() != newp_->GetLinkerSetKey()) {
llvm::errs() << "Comparing two different unreferenced records\n";
return false;
}
if (!type_cache_->insert(
oldp_->GetSelfType() + newp_->GetSelfType()).second) {
return true;
@@ -48,10 +44,6 @@ template <>
bool DiffWrapper<repr::EnumTypeIR>::DumpDiff(
repr::DiffMessageIR::DiffKind diff_kind) {
std::deque<std::string> type_queue;
if (oldp_->GetLinkerSetKey() != newp_->GetLinkerSetKey()) {
llvm::errs() << "Comparing two different unreferenced enums\n";
return false;
}
if (!type_cache_->insert(
oldp_->GetSelfType() + newp_->GetSelfType()).second) {
return true;

View File

@@ -178,6 +178,10 @@ class HeaderCheckerTest(unittest.TestCase):
def test_libgolden_cpp_return_type_diff(self):
self.prepare_and_run_abi_diff_all_archs(
"libgolden_cpp", "libgolden_cpp_return_type_diff", 8)
self.prepare_and_run_abi_diff_all_archs(
"libgolden_cpp", "libgolden_cpp_return_type_diff", 0,
["-ignore-linker-set-key", "_ZN17HighVolumeSpeaker6ListenEv",
"-ignore-linker-set-key", "_ZN16LowVolumeSpeaker6ListenEv"])
def test_libgolden_cpp_add_odr(self):
self.prepare_and_run_abi_diff_all_archs(