diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-04-24 10:33:49 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-04-24 10:33:49 -0400 |
commit | b9ee7c6bfdbfcc722f3e4c8bd8378cccd4311740 (patch) | |
tree | b956bca919e19eabba0e3ece188d32854d8f30dc /gcc/tree.cc | |
parent | b6d8e2975a9e1b9c3e839c09f265cd40426d23c1 (diff) | |
download | gcc-b9ee7c6bfdbfcc722f3e4c8bd8378cccd4311740.zip gcc-b9ee7c6bfdbfcc722f3e4c8bd8378cccd4311740.tar.gz gcc-b9ee7c6bfdbfcc722f3e4c8bd8378cccd4311740.tar.bz2 |
c++, tree: declare some basic functions inline
The functions strip_array_types, is_typedef_decl, typedef_variant_p
and cp_expr_location are used throughout the C++ front end including in
some fairly hot parts (e.g. in the tsubst routines and cp_walk_subtree)
and they're small enough that the overhead of calling them out-of-line
is relatively significant.
So this patch moves their definitions into the appropriate headers to
enable inlining them.
gcc/cp/ChangeLog:
* cp-tree.h (cp_expr_location): Define here.
* tree.cc (cp_expr_location): Don't define here.
gcc/ChangeLog:
* tree.cc (strip_array_types): Don't define here.
(is_typedef_decl): Don't define here.
(typedef_variant_p): Don't define here.
* tree.h (strip_array_types): Define here.
(is_typedef_decl): Define here.
(typedef_variant_p): Define here.
Diffstat (limited to 'gcc/tree.cc')
-rw-r--r-- | gcc/tree.cc | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/gcc/tree.cc b/gcc/tree.cc index 5f2af07..8394ff0 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -7312,18 +7312,6 @@ build_array_type_nelts (tree elt_type, poly_uint64 nelts) return build_array_type (elt_type, build_index_type (size_int (nelts - 1))); } -/* Recursively examines the array elements of TYPE, until a non-array - element type is found. */ - -tree -strip_array_types (tree type) -{ - while (TREE_CODE (type) == ARRAY_TYPE) - type = TREE_TYPE (type); - - return type; -} - /* Computes the canonical argument types from the argument type list ARGTYPES. @@ -12213,23 +12201,6 @@ get_binfo_at_offset (tree binfo, poly_int64 offset, tree expected_type) } } -/* Returns true if X is a typedef decl. */ - -bool -is_typedef_decl (const_tree x) -{ - return (x && TREE_CODE (x) == TYPE_DECL - && DECL_ORIGINAL_TYPE (x) != NULL_TREE); -} - -/* Returns true iff TYPE is a type variant created for a typedef. */ - -bool -typedef_variant_p (const_tree type) -{ - return is_typedef_decl (TYPE_NAME (type)); -} - /* PR 84195: Replace control characters in "unescaped" with their escaped equivalents. Allow newlines if -fmessage-length has been set to a non-zero value. This is done here, rather than |