Giter Site home page Giter Site logo

Comments (1)

rm5248 avatar rm5248 commented on August 12, 2024

here is a patch that seems to work to show both the size of the class and the number of members in the class. I am not 100% sure that it works correctly, but my quick tests today show it being fine.

diff --git a/abi-compliance-checker.pl b/abi-compliance-checker.pl
index c07377d..be69015 100755
--- a/abi-compliance-checker.pl
+++ b/abi-compliance-checker.pl
@@ -6371,7 +6371,7 @@ sub getCheckedHeaders($)
 
 sub getSourceInfo()
 {
-    my ($CheckedHeaders, $CheckedSources, $CheckedLibs) = ("", "");
+    my ($CheckedHeaders, $CheckedSources, $CheckedLibs, $Classes) = ("", "");
     
     if(my @Headers = getCheckedHeaders(1))
     {
@@ -6426,8 +6426,73 @@ sub getSourceInfo()
         $CheckedLibs .= "</div>\n";
         $CheckedLibs .= "<br/>$TOP_REF<br/>\n";
     }
+
+    $Classes = "<a name='Classes'></a>";
+    if($In::Opt{"OldStyle"}) {
+        $Classes .= "<h2>Classes (".($#ClassNames+1).")</h2>";
+    }
+    else {
+        $Classes .= "<h2>Classes <span class='gray'>&nbsp;".($#ClassNames+1)."&nbsp;</span></h2>";
+    }
+    $Classes .= "<hr/>\n";
+    $Classes .= "<table class='summary'>\n";
+    $Classes .= "<tr><th>Class Name</th><th>Old Size</th><th>New Size</th><th>Old Number Members</th><th>New Number Members</th></tr>\n";
+    foreach my $ClassName (sort keys(%{$ClassNames{1}}))
+    {
+        my $ClassId_Old = $TName_Tid{1}{$ClassName};
+        next if(not $ClassId_Old);
+        
+        if(isPrivateABI($ClassId_Old, 1)) {
+            next;
+        }
+
+        if(index($ClassName, ">")!=-1)
+        { # skip affected template instances
+            next;
+        }
+        
+        if(not isCreatable($ClassId_Old, 1))
+        { # skip classes without public constructors (including auto-generated)
+          # example: class has only a private exported or private inline constructor
+            next;
+        }
+        
+        my %Class_Old = getType($ClassId_Old, 1);
+        my $ClassId_New = $TName_Tid{2}{$ClassName};
+        if(not $ClassId_New) {
+            next;
+        }
+        my %Class_New = getType($ClassId_New, 2);
+        if($Class_New{"Type"}!~/Class|Struct/)
+        { # became typedef
+            if($Level eq "Binary") {
+                next;
+            }
+            if($Level eq "Source")
+            {
+                %Class_New = getPureType($ClassId_New, 2);
+                if($Class_New{"Type"}!~/Class|Struct/) {
+                    next;
+                }
+                $ClassId_New = $Class_New{"Tid"};
+            }
+        }
+        
+        my $new_size = $Class_New{"Size"};
+        my $old_size = $Class_Old{"Size"};
+        my $new_num_members = keys(%{$Class_New{"Memb"}});
+        my $old_num_members = keys(%{$Class_Old{"Memb"}});
+        if(not $new_size){
+            $new_size=0;
+        }
+        if(not $old_size){
+            $old_size=0;
+        }
+        $Classes .= "<tr><td>$ClassName</td><td>$new_size</td><td>$old_size</td><td>$new_num_members</td><td>$old_num_members</td></tr>\n";
+    }
+    $Classes .= "</table>\n";
     
-    return $CheckedHeaders.$CheckedSources.$CheckedLibs;
+    return $CheckedHeaders.$CheckedSources.$CheckedLibs.$Classes;
 }
 
 sub getObjTitle()

from abi-compliance-checker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.