diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-01-26 18:40:43 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-01-31 09:00:57 -0500 |
commit | 182ce042e7325a05a87fb34d2eaf6db3666fbd7f (patch) | |
tree | d9b9ba23a26d11ec85cf122c6d369c6c1b53c4e8 /gcc/calls.c | |
parent | 45eb3e4944ba93b1d4e9070c703068cfa7aaace4 (diff) | |
download | gcc-182ce042e7325a05a87fb34d2eaf6db3666fbd7f.zip gcc-182ce042e7325a05a87fb34d2eaf6db3666fbd7f.tar.gz gcc-182ce042e7325a05a87fb34d2eaf6db3666fbd7f.tar.bz2 |
calls.c: refactor special_function_p for use by analyzer (v2)
This patch refactors some code in special_function_p that checks for
the function being sane to match by name, splitting it out into a new
maybe_special_function_p, and using it it two places in the analyzer.
gcc/analyzer/ChangeLog:
* analyzer.cc (is_named_call_p): Replace tests for fndecl being
extern at file scope and having a non-NULL DECL_NAME with a call
to maybe_special_function_p.
* function-set.cc (function_set::contains_decl_p): Add call to
maybe_special_function_p.
gcc/ChangeLog:
* calls.c (special_function_p): Split out the check for DECL_NAME
being non-NULL and fndecl being extern at file scope into a
new maybe_special_function_p and call it. Drop check for fndecl
being non-NULL that was after a usage of DECL_NAME (fndecl).
* tree.h (maybe_special_function_p): New inline function.
Diffstat (limited to 'gcc/calls.c')
-rw-r--r-- | gcc/calls.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index 1336f49..d1c5317 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -586,18 +586,8 @@ special_function_p (const_tree fndecl, int flags) { tree name_decl = DECL_NAME (fndecl); - if (fndecl && name_decl - && IDENTIFIER_LENGTH (name_decl) <= 11 - /* Exclude functions not at the file scope, or not `extern', - since they are not the magic functions we would otherwise - think they are. - FIXME: this should be handled with attributes, not with this - hacky imitation of DECL_ASSEMBLER_NAME. It's (also) wrong - because you can declare fork() inside a function if you - wish. */ - && (DECL_CONTEXT (fndecl) == NULL_TREE - || TREE_CODE (DECL_CONTEXT (fndecl)) == TRANSLATION_UNIT_DECL) - && TREE_PUBLIC (fndecl)) + if (maybe_special_function_p (fndecl) + && IDENTIFIER_LENGTH (name_decl) <= 11) { const char *name = IDENTIFIER_POINTER (name_decl); const char *tname = name; |