[DynInst_API:] [dyninst/dyninst] b6fcbb: Clean up SymtabAPI::Function classes (#1475)


Date: Tue, 08 Aug 2023 12:45:49 -0700
From: Tim Haines <noreply@xxxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] b6fcbb: Clean up SymtabAPI::Function classes (#1475)
  Branch: refs/heads/master
  Home:   https://github.com/dyninst/dyninst
  Commit: b6fcbb0c4f647fe4fbd39db1e0fb8cbc5cd1206f
      https://github.com/dyninst/dyninst/commit/b6fcbb0c4f647fe4fbd39db1e0fb8cbc5cd1206f
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-08-08 (Tue, 08 Aug 2023)

  Changed paths:
    M symtabAPI/h/Function.h

  Log Message:
  -----------
  Clean up SymtabAPI::Function classes (#1475)

* Remove undefined FunctionBase constructors

They were added by 5ed068167 in 2013, but never defined.

* Make ~FunctionBase public

FunctionBase is intended to be derived from and thus derived types can
be deleted through pointers to base. This would cause UB in the current
state.

http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-dtor-virtual

  A base class destructor should be either public and virtual, or
protected and non-virtual

* Make Function(Symbol *) public

It's awkward having it be protected and then friended so it can be used.
Just make it part of the API.

* Function should not export its interface.

These functions should override those in FunctionBase, but should not
define a new interface.

* Explicitly mark overridden members in Function

* Make InlinedFunction(FunctionBase *) public

It's awkward having it be protected and then friended so it can be used.
Just make it part of the API.

* Make ~InlinedFunction public

InlinedFunction is intended to be derived from and thus derived types
can be deleted through pointers to base. This would cause UB in the
current state.

http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-dtor-virtual

  A base class destructor should be either public and virtual, or
protected and non-virtual

* Make InlinedFunction::getModule public

It's a pure virtual member in FunctionBase, so making it protected here
means that calls through a pointer to InlinedFunction could generate a
runtime error. gcc and clang seem to "do what I mean" even though it's
ill-formed. It also removes the astonishment that `getModule` isn't
accessible through the public interface even though it is required to be
there.

>From C++11 standard (n3242):

11 Member access control [class.access]

5. It should be noted that it is access to members and base classes that
is controlled, not their visibility. Names of members are still visible,
and implicit conversions to base classes are still considered, when
those members and base classes are inaccessible. The interpretation of a
given construct is established without regard to access control. If the
interpretation established makes use of inaccessible member names or
base classes, the construct is ill-formed.

* InlinedFunction should not export its interface.

These functions should override those in FunctionBase, but should not
define a new interface.

* Explicitly mark overridden members in InlinedFunction


[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [dyninst/dyninst] b6fcbb: Clean up SymtabAPI::Function classes (#1475), Tim Haines <=