]> sourceware.org Git - libabigail.git/commitdiff
Mention virtual-ness of member function in their pretty representation
authorDodji Seketeli <dodji@redhat.com>
Thu, 2 Oct 2014 10:30:54 +0000 (12:30 +0200)
committerDodji Seketeli <dodji@redhat.com>
Thu, 2 Oct 2014 10:30:54 +0000 (12:30 +0200)
* include/abg-fwd.h (get_member_function_is_virtual): Declare new
overload for pointers.
* src/abg-ir.cc (get_member_function_is_virtual): Define it.
(function_decl::get_pretty_representation): Print virtual-ness of
the function_decl being pretty printed.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-fwd.h
src/abg-ir.cc
tests/data/test-abidiff/test-struct1-report.txt

index 4e272f673d86ffd0a4d402239b83443c2c82ae9d..3fc9b33bb597b175dea46203f3ceb7c0626af4a2 100644 (file)
@@ -357,6 +357,9 @@ get_member_function_is_virtual(const function_decl&);
 bool
 get_member_function_is_virtual(const shared_ptr<function_decl>);
 
+bool
+get_member_function_is_virtual(const function_decl*);
+
 void
 set_member_function_is_virtual(const function_decl&, bool);
 
index 454a90084b96ac26a778573fbebccc253b0a2151..117a72aeaa660f6a9938aa57fb5e59f88a2a1a83 100644 (file)
@@ -2132,6 +2132,15 @@ bool
 get_member_function_is_virtual(const function_decl_sptr mem_fn)
 {return mem_fn ? get_member_function_is_virtual(*mem_fn) : false;}
 
+/// Test if a given member function is virtual.
+///
+/// @param mem_fn the member function to consider.
+///
+/// @return true iff a @p mem_fn is virtual.
+bool
+get_member_function_is_virtual(const function_decl* mem_fn)
+{return mem_fn ? get_member_function_is_virtual(*mem_fn) : false;}
+
 /// Set the virtual-ness of a member function.
 ///
 /// @param f the member function to consider.
@@ -4991,6 +5000,10 @@ function_decl::get_pretty_representation() const
     dynamic_cast<const class_decl::method_decl*>(this);
 
   string result = mem_fn ? "method ": "function ";
+
+  if (get_member_function_is_virtual(mem_fn))
+    result += "virtual ";
+
   decl_base_sptr type =
     mem_fn
     ? get_type_declaration(mem_fn->get_type()->get_return_type())
index 9e371de86d88f945e988f43ae5dd5c189a62090a..994cc66e169450b49c6a2cca17f76f82dd1c1de4 100644 (file)
@@ -3,7 +3,7 @@
     in unqualified underlying type 'class s0':
       size changed from 192 to 256 bits
       1 member function insertion:
-        'method int s0::foo(int, char) const', virtual at voffset 2/2
+        'method virtual int s0::foo(int, char) const', virtual at voffset 2/2_ZNK2s03fooEic}
 
       1 data member deletion:
         'char s0::m1', at offset 96 (in bits)
This page took 0.046719 seconds and 5 git commands to generate.