ROSE 2.23.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility Class Referencefinal

Description

a mapping of CIL related AST nodes in ROSE to fundamental functions of the class hierarchy analysis.

Note
The mapping holds no analysis state. It only caches data that is derived from the AST (decoded signature blobs, type identities); the cache is discarded by extractFromMemoryPool and extractFromProject. Consequently, a CilCompatibility object is not safe for concurrent use.

Definition at line 27 of file CilCompatibility.h.

#include <Rose/BinaryAnalysis/ByteCode/ClassHierarchy/CilCompatibility.h>

Inheritance diagram for Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility:
Collaboration graph
[legend]

Public Member Functions

std::string nameOf (Rose::Common::Analysis::FunctionKeyType key) const override
 returns the source name of the function represented by key.
 
std::string nameOf (Rose::Common::Analysis::ClassKeyType key) const override
 returns the source name of the class represented by key.
 
bool isAbstract (Rose::Common::Analysis::ClassKeyType key) const override
 returns true if the class represented by key is an abstract class.
 
bool isPureVirtual (Rose::Common::Analysis::FunctionKeyType key) const override
 returns true if the class represented by key is an abstract function.
 
bool isFinal (Rose::Common::Analysis::FunctionKeyType key) const override
 returns true if the function represented by key is final.
 
int compareNames (Rose::Common::Analysis::FunctionKeyType lhs, Rose::Common::Analysis::FunctionKeyType rhs) const override
 compares the source name of the functions lhs and rhs.
 
int compareFunctionsByType (Rose::Common::Analysis::FunctionKeyType lhs, Rose::Common::Analysis::FunctionKeyType rhs, bool exclReturnType=true) const override
 compares the canonical types of functions lhs and rhs
 
Rose::Common::Analysis::FunctionTypeRelation haveSameOrCovariantReturn (const Rose::Common::Analysis::ClassAnalysis &classes, Rose::Common::Analysis::FunctionKeyType basId, Rose::Common::Analysis::FunctionKeyType drvId) const override
 tests if drvId has the same or covariant return type with respect to basId
 
void explicitOverrides (const Rose::Common::Analysis::ClassAnalysis &classes, Rose::Common::Analysis::ClassKeyType cls, std::function< void(Rose::Common::Analysis::FunctionKeyType, Rose::Common::Analysis::FunctionKeyType)> fn) const override
 reports the explicit overrides (MethodImpl table) of cls.
 
bool canOverrideInContext (const Rose::Common::Analysis::ClassAnalysis &classes, Rose::Common::Analysis::ClassKeyType drvClass, Rose::Common::Analysis::FunctionKeyType drv, Rose::Common::Analysis::ClassKeyType basClass, Rose::Common::Analysis::FunctionKeyType bas) const override
 
void extractFromMemoryPool (Rose::Common::Analysis::ClassAnalysis &classes) const override
 extracts class information from the memory pool if available
 
void extractFromProject (Rose::Common::Analysis::ClassAnalysis &classes, Rose::Common::Analysis::ASTRootType root) const override
 extracts class by walking the AST rooted at root.
 
Rose::Common::Analysis::LanguageSpecificFn languageSpecificProcessing () const override
 returns CIL-specific class post-processing.
 
void inheritanceEdges (Rose::Common::Analysis::ClassKeyType clkey, std::function< void(Rose::Common::Analysis::ClassKeyType, Rose::Common::Analysis::ClassKeyType, bool)> fn) const override
 calls the callback function fn(derived, base, isvirtual) for all direct base classes of clkey
 
Rose::Common::Analysis::DataMemberType typeOf (Rose::Common::Analysis::VariableKeyType var) const override
 returns the type of a non-static data member var.
 
- Public Member Functions inherited from Rose::Common::Analysis::AbstractCompatibilityBridge
 AbstractCompatibilityBridge ()=default
 Constructs a stateless compatibility bridge.
 
virtual ~AbstractCompatibilityBridge ()=default
 Destroys a compatibility bridge through the base type.
 
virtual void inheritanceEdges (ClassKeyType clkey, std::function< void(ClassKeyType, ClassKeyType, bool)> fn) const =0
 calls the callback function fn(derived, base, isvirtual) for all direct base classes of clkey
 
virtual bool isAutoGeneratable (const ClassAnalysis &classes, ClassKeyType clkey, FunctionKeyType fnkey) const
 returns whether a function with fnkey's signature can be implicitly generated in clkey.
 
virtual std::uint32_t languageStandard () const
 returns the active language standard as a C++ __cplusplus-style value when available.
 
virtual bool inheritedMethodsImplementVirtualBaseMethods () const
 returns whether a method inherited along the non-virtual inheritance chain implements an otherwise unimplemented function of a virtual base.
 
virtual bool isInheritableImplementation (FunctionKeyType fnkey) const
 returns whether the inherited function fnkey qualifies as an implementation of a virtual base function (see inheritedMethodsImplementVirtualBaseMethods).
 
virtual bool canOverride (FunctionKeyType drv, FunctionKeyType bas) const
 returns whether drv may override bas under language rules beyond name and signature, such as access control.
 
virtual void explicitOverrides (const ClassAnalysis &classes, ClassKeyType cls, std::function< void(FunctionKeyType, FunctionKeyType)> fn) const
 reports override relations that are declared explicitly instead of being derived from names and signatures.
 

Member Function Documentation

◆ nameOf() [1/2]

std::string Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::nameOf ( Rose::Common::Analysis::FunctionKeyType  key) const
overridevirtual

returns the source name of the function represented by key.

Parameters
keyCIL function key to name.
Returns
source name for key.

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ nameOf() [2/2]

std::string Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::nameOf ( Rose::Common::Analysis::ClassKeyType  key) const
overridevirtual

returns the source name of the class represented by key.

Parameters
keyCIL class key to name.
Returns
source name for key.

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ isAbstract()

bool Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::isAbstract ( Rose::Common::Analysis::ClassKeyType  key) const
overridevirtual

returns true if the class represented by key is an abstract class.

Parameters
keyCIL class key to inspect.
Returns
true if key denotes an abstract class.

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ isPureVirtual()

bool Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::isPureVirtual ( Rose::Common::Analysis::FunctionKeyType  key) const
overridevirtual

returns true if the class represented by key is an abstract function.

Parameters
keyCIL function key to inspect.
Returns
true if key denotes an abstract function.
Note
abstract member functions are called pure virtual in C++

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ isFinal()

bool Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::isFinal ( Rose::Common::Analysis::FunctionKeyType  key) const
overridevirtual

returns true if the function represented by key is final.

Parameters
keyCIL function key to inspect.
Returns
true if key denotes a method with the Final attribute (sealed override).

Reimplemented from Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ compareNames()

int Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::compareNames ( Rose::Common::Analysis::FunctionKeyType  lhs,
Rose::Common::Analysis::FunctionKeyType  rhs 
) const
overridevirtual

compares the source name of the functions lhs and rhs.

Parameters
lhsleft-hand side function
rhsright-hand side function
Returns
-1 iff nameOf(lhs) < nameOf(rhs) 0 iff nameOf(lhs) == nameOf(rhs) 1 iff nameOf(lhs) > nameOf(rhs)
Note
abstract member functions are called pure virtual in C++

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ compareFunctionsByType()

int Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::compareFunctionsByType ( Rose::Common::Analysis::FunctionKeyType  lhs,
Rose::Common::Analysis::FunctionKeyType  rhs,
bool  exclReturnType = true 
) const
overridevirtual

compares the canonical types of functions lhs and rhs

Parameters
lhsleft-hand side function
rhsright-hand side function
exclReturnTypeif true the return types of lhs and rhs are not considered (though the return types of potential arguments and return types are). This can be useful for obtaining equality of functions that have covariant return types.
Returns
0 iff lhs and rhs have the same type 1 iff lhs > rhs -1 iff lhs < rhs

if lhs and rhs are not equal, the ordering is not specified but produces consistent results

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ haveSameOrCovariantReturn()

Rose::Common::Analysis::FunctionTypeRelation Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::haveSameOrCovariantReturn ( const Rose::Common::Analysis::ClassAnalysis &  classes,
Rose::Common::Analysis::FunctionKeyType  basId,
Rose::Common::Analysis::FunctionKeyType  drvId 
) const
overridevirtual

tests if drvId has the same or covariant return type with respect to basId

Parameters
classesthe extracted class analysis
basIdID of a function in a base class
drvIdID of a function in a derived class
Returns
the return-type relationship between basId and drvId.

The function only checks the return type, and does not check whether the classes in which the functions drvId and basId are defined are in a inheritance relationship.

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ explicitOverrides()

void Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::explicitOverrides ( const Rose::Common::Analysis::ClassAnalysis &  classes,
Rose::Common::Analysis::ClassKeyType  cls,
std::function< void(Rose::Common::Analysis::FunctionKeyType, Rose::Common::Analysis::FunctionKeyType)>  fn 
) const
override

reports the explicit overrides (MethodImpl table) of cls.

Parameters
classesthe class analysis
clsclass whose MethodImpl rows are reported
fncallback invoked as fn(overrider, overridden)

Reports explicit interface implementations, overrides under a different name, and covariant returns. Rows whose declaration is not loaded (e.g., an interface of an assembly that is not available) are skipped.

◆ canOverrideInContext()

bool Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::canOverrideInContext ( const Rose::Common::Analysis::ClassAnalysis &  classes,
Rose::Common::Analysis::ClassKeyType  drvClass,
Rose::Common::Analysis::FunctionKeyType  drv,
Rose::Common::Analysis::ClassKeyType  basClass,
Rose::Common::Analysis::FunctionKeyType  bas 
) const
overridevirtual
Parameters
classesthe class analysis
drvClassclass that declares drv (invalid for implied overrides)
drvfunction in the derived class
basClassclass that declares bas
basfunction in the base class
Returns
true if the CLI would let drv reuse the slot of bas.

Implements the slot rules of ECMA-335 II.10.3: new-slot and final methods, access (II.10.3.3), and the return type, which is part of the slot signature. Methods of a class implicitly implement interface methods when they are public.

Reimplemented from Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ extractFromMemoryPool()

void Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::extractFromMemoryPool ( Rose::Common::Analysis::ClassAnalysis &  classes) const
overridevirtual

extracts class information from the memory pool if available

Parameters
classesanalysis object to populate.
Returns
nothing.
  1. For each class in the memory pool an entry in classes is created
  2. Adds all member functions declared in a class to the class representation CRep
  3. Adds all data members declared in a class to the class representation CRep

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ extractFromProject()

void Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::extractFromProject ( Rose::Common::Analysis::ClassAnalysis &  classes,
Rose::Common::Analysis::ASTRootType  root 
) const
overridevirtual

extracts class by walking the AST rooted at root.

Parameters
classesanalysis object to populate.
rootabstract key for the AST root to traverse.
Returns
nothing.
  1. For each known class an entry in classes is created
  2. Adds all member functions declared in a class to the class representation CRep
  3. Adds all data members declared in a class to the class representation CRep

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ languageSpecificProcessing()

Rose::Common::Analysis::LanguageSpecificFn Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::languageSpecificProcessing ( ) const
overridevirtual

returns CIL-specific class post-processing.

Returns
callback for CIL-specific post-processing.

CIL currently does not need additional processing after the common class hierarchy analysis.

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.

◆ inheritanceEdges()

void Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::inheritanceEdges ( Rose::Common::Analysis::ClassKeyType  clkey,
std::function< void(Rose::Common::Analysis::ClassKeyType, Rose::Common::Analysis::ClassKeyType, bool)>  fn 
) const
override

calls the callback function fn(derived, base, isvirtual) for all direct base classes of clkey

Parameters
clkeyclass whose direct inheritance edges are requested.
fncallback invoked for each edge as (derived, base, isVirtual).
Returns
nothing.

◆ typeOf()

Rose::Common::Analysis::DataMemberType Rose::BinaryAnalysis::ByteCode::ClassHierarchy::CilCompatibility::typeOf ( Rose::Common::Analysis::VariableKeyType  var) const
overridevirtual

returns the type of a non-static data member var.

Parameters
vardata member key to inspect.
Returns
summarized data member type properties.

Implements Rose::Common::Analysis::AbstractCompatibilityBridge.


The documentation for this class was generated from the following file: