[DynInst_API:] [dyninst/dyninst] 85fb0f: Remove virtual calls in constructor/destructor (#1...


Date: Tue, 09 May 2023 13:06:08 -0700
From: Tim Haines <noreply@xxxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] 85fb0f: Remove virtual calls in constructor/destructor (#1...
  Branch: refs/heads/master
  Home:   https://github.com/dyninst/dyninst
  Commit: 85fb0f95050c903bf1e1a1dbcacf1913dad1d73b
      https://github.com/dyninst/dyninst/commit/85fb0f95050c903bf1e1a1dbcacf1913dad1d73b
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    M common/src/NodeIterator.h
    M common/src/addrtranslate-win.C
    M instructionAPI/src/InstructionDecoder-x86.C
    M parseAPI/src/CFGFactory.C
    M proccontrol/src/freebsd.C

  Log Message:
  -----------
  Remove virtual calls in constructor/destructor (#1428)

* AddressTranslateWin

Found using cppcheck:

common/src/addrtranslate-win.C:49:17: style: Virtual function 'init' is called from constructor 'AddressTranslateWin(PID pid,PROC_HANDLE phandle)' at line 168. Dynamic binding is not used. [virtualCallInConstructor]
   virtual bool init();

* NodeIteratorPredicateObj

Found using cppcheck:

common/src/NodeIterator.h:293:18: style: Virtual function 'inc' is
called from constructor
'NodeIteratorPredicateObj(Graph::NodePredicate::Ptr
p,NodeIterator&b,NodeIterator&e)' at line 331. Dynamic binding is not
used. [virtualCallInConstructor]

* NodeIteratorPredicateFunc

Found using cppcheck:

common/src/NodeIterator.h:352:18: style: Virtual function 'inc' is
called from constructor
'NodeIteratorPredicateFunc(Graph::NodePredicateFunc
p,void*u,NodeIterator&b,NodeIterator&e)' at line 394. Dynamic binding is
not used. [virtualCallInConstructor]

* InstructionDecoder_x86

Found using cppcheck:

instructionAPI/src/InstructionDecoder-x86.h:74:49: style: Virtual function 'setMode' is called from constructor 'InstructionDecoder_x86(Architecture a)' at line 144. Dynamic binding is not used. [virtualCallInConstructor]
                INSTRUCTION_EXPORT virtual void setMode(bool is64);
                                                ^
instructionAPI/src/InstructionDecoder-x86.C:144:28: note: Calling setMode
      if(a == Arch_x86_64) setMode(true);
                           ^
instructionAPI/src/InstructionDecoder-x86.h:74:49: note: setMode is a virtual function
                INSTRUCTION_EXPORT virtual void setMode(bool is64);

* CFGFactor::destroy_block

Found using cppcheck:

parseAPI/h/CFGFactory.h:117:18: style: Virtual function 'free_block' is called from destructor '~CFGFactory()' at line 92. Dynamic binding is not used. [virtualCallInConstructor]
    virtual void free_block(Block * b);
                 ^
parseAPI/src/CFGFactory.C:92:5: note: Calling destroy_block
    destroy_block(b);
    ^
parseAPI/src/CFGFactory.C:182:5: note: Calling free_block
    free_block(b);
    ^
parseAPI/h/CFGFactory.h:117:18: note: free_block is a virtual function
    virtual void free_block(Block * b);

* CFGFactor::free_func

Found using cppcheck:

parseAPI/h/CFGFactory.h:116:18: style: Virtual function 'free_func' is called from destructor '~CFGFactory()' at line 95. Dynamic binding is not used. [virtualCallInConstructor]
    virtual void free_func(Function * f);
                 ^
parseAPI/src/CFGFactory.C:95:5: note: Calling destroy_func
    destroy_func(f);
    ^
parseAPI/src/CFGFactory.C:172:4: note: Calling free_func
   free_func(f);
   ^
parseAPI/h/CFGFactory.h:116:18: note: free_func is a virtual function
    virtual void free_func(Function * f);

* CFGFactor::free_edge

* ~freebsd_process

Found using cppcheck:

proccontrol/src/freebsd.C:1046:17: warning: Member variable 'freebsd_thread::is_exited' is not initialized in the constructor. [uninitMemberVar]
freebsd_thread::freebsd_thread(int_process *p, Dyninst::THR_ID t, Dyninst::LWP l)
                ^
proccontrol/src/freebsd.h:122:17: style: Virtual function 'getEventQueue' is called from destructor '~freebsd_process()' at line 795. Dynamic binding is not used. [virtualCallInConstructor]
    virtual int getEventQueue();
                ^
proccontrol/src/freebsd.C:795:22: note: Calling getEventQueue
    int eventQueue = getEventQueue();
                     ^
proccontrol/src/freebsd.h:122:17: note: getEventQueue is a virtual function
    virtual int getEventQueue();


[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [dyninst/dyninst] 85fb0f: Remove virtual calls in constructor/destructor (#1..., Tim Haines <=