aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuliano Procida <gprocida@google.com>2023-05-02 13:15:33 +0100
committerGiuliano Procida <gprocida@google.com>2023-05-16 16:57:14 +0100
commit9f1dfb157d5f98b80bbb18e1314fdadcb7cfe3b5 (patch)
tree19feaef2d2d6385f7e7ff7810df1eade95512c5c
parent38a8c5b948bd41ecab4dd08dd0a40fff12c98153 (diff)
downloadstg-9f1dfb157d5f98b80bbb18e1314fdadcb7cfe3b5.tar.gz
Abigail reader: update is-declaration-only handling comment
Under rare circumstances, libabigail, or perhaps only older versions of it, can emit non-empty struct types with the `is-declaration-only` flag set. The flag in turn comes from DWARF's `DW_AT_declaration` which cannot be interpreted in isolation. We also cannot rely on just the absence of children to detect forward declations as this does not distinguish `struct foo;` from `struct foo {};`. In any case, this comment is now clearer and shorter. PiperOrigin-RevId: 528750564 Change-Id: Ie30b0229db7c6779619fee7f491d965be854d4f9
-rw-r--r--abigail_reader.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/abigail_reader.cc b/abigail_reader.cc
index 0005af8..7329dc3 100644
--- a/abigail_reader.cc
+++ b/abigail_reader.cc
@@ -559,10 +559,8 @@ void Abigail::ProcessTypeDecl(Id id, xmlNodePtr type_decl) {
void Abigail::ProcessStructUnion(Id id, bool is_struct,
xmlNodePtr struct_union) {
- // TODO
- // Libabigail is reporting wrong information for is-declaration-only so it is
- // not reliable. We are looking at the children of the element instead.
- // It can be removed once the bug is fixed.
+ // Libabigail sometimes reports is-declaration-only but still provides some
+ // child elements. So we check both things.
const bool forward =
ReadAttribute<bool>(struct_union, "is-declaration-only", false)
&& Child(struct_union) == nullptr;