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/analyzer/function-set.cc | |
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/analyzer/function-set.cc')
-rw-r--r-- | gcc/analyzer/function-set.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/analyzer/function-set.cc b/gcc/analyzer/function-set.cc index 6ed15ae..1b6b5d9 100644 --- a/gcc/analyzer/function-set.cc +++ b/gcc/analyzer/function-set.cc @@ -59,6 +59,8 @@ bool function_set::contains_decl_p (tree fndecl) const { gcc_assert (fndecl && DECL_P (fndecl)); + if (!maybe_special_function_p (fndecl)) + return false; return contains_name_p (IDENTIFIER_POINTER (DECL_NAME (fndecl))); } |