diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-04-02 14:43:58 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-05-21 17:27:45 +0200 |
| commit | eff5e6c1a4e6c36614dcfaa0213e2ccf57e844a3 (patch) | |
| tree | a644a85a6408ef3c1e53c4af52a459ca047da420 /scope.c | |
| parent | db0a795b145501e456cac5180be03ef697810845 (diff) | |
| download | sparse-dev-eff5e6c1a4e6c36614dcfaa0213e2ccf57e844a3.tar.gz | |
scope: add is_in_scope()
Add an helper to check if a scope is included into another one.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'scope.c')
| -rw-r--r-- | scope.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -162,3 +162,12 @@ int is_outer_scope(struct scope *scope) return 1; } +int is_in_scope(struct scope *outer, struct scope *inner) +{ + while (inner != outer) { + if (inner == function_scope) + return 0; + inner = inner->next; + } + return 1; +} |
