From f9ec2f155547525b7a954e738749649d24164ee6 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Tue, 17 Mar 2015 12:00:52 +0100 Subject: [PATCH] Make is_global_scope() return a pointer to the global scope This helps while debugging from GDB. * include/abg-fwd.h (is_global_scope): Return a global_scope*. * src/abg-ir.cc (is_global_scope): Likewise. Signed-off-by: Dodji Seketeli --- include/abg-fwd.h | 2 +- src/abg-ir.cc | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/abg-fwd.h b/include/abg-fwd.h index ec4703aa..04724418 100644 --- a/include/abg-fwd.h +++ b/include/abg-fwd.h @@ -143,7 +143,7 @@ get_translation_unit(const shared_ptr); bool is_global_scope(const scope_decl&); -bool +const global_scope* is_global_scope(const scope_decl*); bool diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 97397394..e6b51315 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -3059,10 +3059,11 @@ is_global_scope(const scope_decl& scope) /// /// @param scope the scope to consider. /// -/// @return true iff the current scope is the global one. -bool +/// @return the @ref global_scope* representing the scope @p scope or +/// 0 if @p scope is not a global scope. +const global_scope* is_global_scope(const scope_decl* scope) -{return scope ? is_global_scope(*scope) : false;} +{return dynamic_cast(scope);} /// Tests whether if a given scope is the global scope. ///