aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 8b4d865..9d4bc7f 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -11864,6 +11864,27 @@ types_same_for_odr (tree type1, tree type2)
return true;
}
+/* TARGET is a call target of GIMPLE call statement
+ (obtained by gimple_call_fn). Return true if it is
+ OBJ_TYPE_REF representing an virtual call of C++ method.
+ (As opposed to OBJ_TYPE_REF representing objc calls
+ through a cast where middle-end devirtualization machinery
+ can't apply.) */
+
+bool
+virtual_method_call_p (tree target)
+{
+ if (TREE_CODE (target) != OBJ_TYPE_REF)
+ return false;
+ target = TREE_TYPE (target);
+ gcc_checking_assert (TREE_CODE (target) == POINTER_TYPE);
+ target = TREE_TYPE (target);
+ if (TREE_CODE (target) == FUNCTION_TYPE)
+ return false;
+ gcc_checking_assert (TREE_CODE (target) == METHOD_TYPE);
+ return true;
+}
+
/* REF is OBJ_TYPE_REF, return the class the ref corresponds to. */
tree