aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorRob Taylor <rob.taylor@codethink.co.uk>2007-06-29 17:33:29 +0100
committerJosh Triplett <josh@freedesktop.org>2007-07-13 08:33:54 -0700
commit0f7245f57921d2b002c775c870692d148edebb5a (patch)
treebf2ecf690a878dae6df68c19e3c3de73780ea269
parent78d2e4b170d776017b56231f47b9a7749e50a73f (diff)
downloadsparse-dev-0f7245f57921d2b002c775c870692d148edebb5a.tar.gz
add sparse_keep_tokens api to lib.h
Adds sparse_keep_tokens, which is the same as __sparse, but doesn't free the tokens after parsing. Useful fow ehen you want to inspect macro symbols after parsing. Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
-rw-r--r--lib.c13
-rw-r--r--lib.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index efba3d41..a1442a26 100644
--- a/lib.c
+++ b/lib.c
@@ -749,7 +749,7 @@ struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list
return list;
}
-struct symbol_list * __sparse(char *filename)
+struct symbol_list * sparse_keep_tokens(char *filename)
{
struct symbol_list *res;
@@ -759,6 +759,17 @@ struct symbol_list * __sparse(char *filename)
new_file_scope();
res = sparse_file(filename);
+ /* And return it */
+ return res;
+}
+
+
+struct symbol_list * __sparse(char *filename)
+{
+ struct symbol_list *res;
+
+ res = sparse_keep_tokens(filename);
+
/* Drop the tokens for this file after parsing */
clear_token_alloc();
diff --git a/lib.h b/lib.h
index bc2a8c24..aacafea2 100644
--- a/lib.h
+++ b/lib.h
@@ -113,6 +113,7 @@ extern void declare_builtin_functions(void);
extern void create_builtin_stream(void);
extern struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list **files);
extern struct symbol_list *__sparse(char *filename);
+extern struct symbol_list *sparse_keep_tokens(char *filename);
extern struct symbol_list *sparse(char *filename);
static inline int symbol_list_size(struct symbol_list *list)