summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2022-02-28 17:13:47 +0100
committerDodji Seketeli <dodji@redhat.com>2022-02-28 17:30:04 +0100
commit1eb3dc84f7ee648bd2c72509f9e4e00fc638991c (patch)
tree32eabc4257ceb37cae9f27d28142bcc42741390b
parentabilint: add the --show-type-use option (diff)
downloadlibabigail-1eb3dc84f7ee648bd2c72509f9e4e00fc638991c.tar.gz
libabigail-1eb3dc84f7ee648bd2c72509f9e4e00fc638991c.tar.bz2
libabigail-1eb3dc84f7ee648bd2c72509f9e4e00fc638991c.tar.xz
abilint --show-type-use: Show results for global decls that have no symbols
In some abixml file, there can be global decls that don't have ELF symbols. We still want to see how those decls use the type that is being used, as analyzed by abilint --show-type-use <type-id>. * include/abg-fwd.h (is_at_global_scope): Declare ... * src/abg-ir.cc (is_at_global_scope): ... new overload. * tools/abilint.cc (emit_artifact_use_trace): Emit the trace also when the decl is at global scope or has a linkage name. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
-rw-r--r--include/abg-fwd.h3
-rw-r--r--src/abg-ir.cc9
-rw-r--r--tools/abilint.cc8
3 files changed, 18 insertions, 2 deletions
diff --git a/include/abg-fwd.h b/include/abg-fwd.h
index c5e98afe..6afaf7bc 100644
--- a/include/abg-fwd.h
+++ b/include/abg-fwd.h
@@ -349,6 +349,9 @@ is_at_global_scope(const decl_base&);
349bool 349bool
350is_at_global_scope(const decl_base_sptr); 350is_at_global_scope(const decl_base_sptr);
351 351
352bool
353is_at_global_scope(const decl_base*);
354
352class_or_union* 355class_or_union*
353is_at_class_scope(const decl_base_sptr); 356is_at_class_scope(const decl_base_sptr);
354 357
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 82971253..4afe2d61 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -9332,6 +9332,15 @@ bool
9332is_at_global_scope(const decl_base_sptr decl) 9332is_at_global_scope(const decl_base_sptr decl)
9333{return (decl && is_global_scope(decl->get_scope()));} 9333{return (decl && is_global_scope(decl->get_scope()));}
9334 9334
9335/// Tests whether a given declaration is at global scope.
9336///
9337/// @param decl the decl to consider.
9338///
9339/// @return true iff decl is at global scope.
9340bool
9341is_at_global_scope(const decl_base* decl)
9342{return is_at_global_scope(*decl);}
9343
9335/// Tests whether a given decl is at class scope. 9344/// Tests whether a given decl is at class scope.
9336/// 9345///
9337/// @param decl the decl to consider. 9346/// @param decl the decl to consider.
diff --git a/tools/abilint.cc b/tools/abilint.cc
index ba2de634..4883b557 100644
--- a/tools/abilint.cc
+++ b/tools/abilint.cc
@@ -398,10 +398,14 @@ emit_artifact_use_trace(const artifact_use_relation_tree& artifact_use_tree,
398 if (is_decl(artifact)) 398 if (is_decl(artifact))
399 { 399 {
400 if (abigail::ir::var_decl* v = is_var_decl(artifact)) 400 if (abigail::ir::var_decl* v = is_var_decl(artifact))
401 if (v->get_symbol()) 401 if (v->get_symbol()
402 || is_at_global_scope(v)
403 || !v->get_linkage_name().empty())
402 do_emit_trace = true; 404 do_emit_trace = true;
403 if (abigail::ir::function_decl* f = is_function_decl(artifact)) 405 if (abigail::ir::function_decl* f = is_function_decl(artifact))
404 if (f->get_symbol()) 406 if (f->get_symbol()
407 || is_at_global_scope(f)
408 || !f->get_linkage_name().empty())
405 do_emit_trace = true; 409 do_emit_trace = true;
406 } 410 }
407 411