ROSE 2.23.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Rose::Source::Analysis::CppCompatibility Class Referencefinal

Description

Implements the Common compatibility interface for C++ ROSE AST nodes.

Definition at line 137 of file CppCompatibility.h.

#include <Rose/Source/Analysis/CppCompatibility.h>

Inheritance diagram for Rose::Source::Analysis::CppCompatibility:
Inheritance graph
[legend]
Collaboration diagram for Rose::Source::Analysis::CppCompatibility:
Collaboration graph
[legend]

Public Member Functions

Rose::Common::Analysis::VariableKeyType variableId (const SgInitializedName *var) const
 Converts a ROSE initialized-name pointer to an abstract variable key.
 
Rose::Common::Analysis::VariableKeyType variableId (const SgVariableDeclaration *var) const
 Converts a ROSE variable declaration pointer to an abstract variable key.
 
Rose::Common::Analysis::FunctionKeyType functionId (const SgFunctionDeclaration *fun) const
 Converts a ROSE function declaration pointer to an abstract function key.
 
std::string nameOf (Rose::Common::Analysis::VariableKeyType key) const
 Returns the source name of a variable represented by key.
 
std::string nameOf (Rose::Common::Analysis::FunctionKeyType key) const override
 Returns the source name of a function represented by key.
 
std::string nameOf (Rose::Common::Analysis::ClassKeyType key) const override
 Returns the source name of a class represented by key.
 
std::intptr_t numericId (Rose::Common::Analysis::AnyKeyType id) const
 Returns a numeric representation of any abstract key.
 
std::string uniqueName (Rose::Common::Analysis::AnyKeyType id) const
 Returns a unique frontend-derived name for any abstract key.
 
SourceLocation location (Rose::Common::Analysis::AnyKeyType id, bool resolveInstantiations=false) const
 Returns source location information for any abstract key.
 
int compareNames (Rose::Common::Analysis::FunctionKeyType lhs, Rose::Common::Analysis::FunctionKeyType rhs) const override
 Compares function source names.
 
int compareFunctionTypes (Rose::Common::Analysis::FunctionTypeKeyType lhs, Rose::Common::Analysis::FunctionTypeKeyType rhs, bool exclReturnType=true) const
 Compares two function types by canonical form.
 
int compareFunctionsByType (Rose::Common::Analysis::FunctionKeyType lhs, Rose::Common::Analysis::FunctionKeyType rhs, bool exclReturnType=true) const override
 Compares two functions by canonical function type.
 
int compareTypes (Rose::Common::Analysis::TypeKeyType lhs, Rose::Common::Analysis::TypeKeyType rhs) const
 Compares two non-function types by canonical form.
 
Rose::Common::Analysis::FunctionTypeRelation haveSameOrCovariantReturn (const Rose::Common::Analysis::ClassAnalysis &classes, Rose::Common::Analysis::FunctionKeyType basId, Rose::Common::Analysis::FunctionKeyType drvId) const override
 Tests whether drvId has the same or a covariant return type relative to basId.
 
Rose::Common::Analysis::FunctionTypeRelation areSameOrCovariant (const Rose::Common::Analysis::ClassAnalysis &classes, Rose::Common::Analysis::TypeKeyType basId, Rose::Common::Analysis::TypeKeyType drvId) const
 Tests whether two type keys denote the same or covariant class type.
 
void extractFromMemoryPool (Rose::Common::Analysis::ClassAnalysis &classes) const override
 Extracts C++ class information from the ROSE memory pool.
 
void extractFromProject (Rose::Common::Analysis::ClassAnalysis &classes, Rose::Common::Analysis::ASTRootType root) const override
 Extracts C++ class information by traversing the AST rooted at root.
 
Rose::Common::Analysis::LanguageSpecificFn languageSpecificProcessing () const override
 Returns C++-specific class-analysis 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 fn for each direct base-class edge of clkey.
 
Rose::Common::Analysis::DataMemberType typeOf (Rose::Common::Analysis::VariableKeyType var) const override
 Returns the type summary of a non-static data member.
 
bool isPureVirtual (Rose::Common::Analysis::FunctionKeyType id) const override
 Returns true when id denotes a pure virtual C++ function.
 
bool hasDefinition (Rose::Common::Analysis::FunctionKeyType id) const
 Returns true when id has an attached function definition.
 
bool isAbstract (Rose::Common::Analysis::ClassKeyType clkey) const override
 Returns true when clkey denotes an abstract C++ class.
 
Rose::Common::Analysis::FuncNameFn functionNaming () const
 Returns a function key naming callback.
 
Rose::Common::Analysis::ClassNameFn classNaming () const
 Returns a class key naming callback.
 
Rose::Common::Analysis::VarNameFn variableNaming () const
 Returns a variable key naming callback.
 
bool isAutoGeneratable (const Rose::Common::Analysis::ClassAnalysis &all, Rose::Common::Analysis::ClassKeyType clkey, Rose::Common::Analysis::FunctionKeyType fnkey) const override
 Returns true when fnkey can be implicitly generated for clkey.
 
std::uint32_t languageStandard () const override
 Returns the detected C++ language standard value.
 
SpecialMemberFunctionContainer specialMemberFunctions (Rose::Common::Analysis::ClassKeyType clazz) const
 Extracts special member functions declared or generated for clazz.
 
Optional classType (Rose::Common::Analysis::FunctionKeyType fn) const
 Returns the class that owns fn when it can be determined.
 
- 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 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 bool isFinal (FunctionKeyType fnkey) const
 returns whether the virtual function fnkey cannot be overridden.
 
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.
 
virtual bool canOverrideInContext (const ClassAnalysis &classes, ClassKeyType drvClass, FunctionKeyType drv, ClassKeyType basClass, FunctionKeyType bas) const
 returns whether drv, declared in drvClass, may override bas, declared in basClass, with knowledge of the classes in between.
 

Member Function Documentation

◆ variableId() [1/2]

Rose::Common::Analysis::VariableKeyType Rose::Source::Analysis::CppCompatibility::variableId ( const SgInitializedName *  var) const

Converts a ROSE initialized-name pointer to an abstract variable key.

Parameters
varROSE initialized-name pointer to wrap.
Returns
abstract key for var.

◆ variableId() [2/2]

Rose::Common::Analysis::VariableKeyType Rose::Source::Analysis::CppCompatibility::variableId ( const SgVariableDeclaration *  var) const

Converts a ROSE variable declaration pointer to an abstract variable key.

Parameters
varROSE variable declaration pointer to wrap.
Returns
abstract key for var.

◆ functionId()

Rose::Common::Analysis::FunctionKeyType Rose::Source::Analysis::CppCompatibility::functionId ( const SgFunctionDeclaration *  fun) const

Converts a ROSE function declaration pointer to an abstract function key.

Parameters
funROSE function declaration pointer to wrap.
Returns
abstract key for fun.

◆ nameOf() [1/3]

std::string Rose::Source::Analysis::CppCompatibility::nameOf ( Rose::Common::Analysis::VariableKeyType  key) const

Returns the source name of a variable represented by key.

Parameters
keyabstract variable key to name.
Returns
source name for key.

◆ nameOf() [2/3]

std::string Rose::Source::Analysis::CppCompatibility::nameOf ( Rose::Common::Analysis::FunctionKeyType  key) const
overridevirtual

Returns the source name of a function represented by key.

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

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

◆ nameOf() [3/3]

std::string Rose::Source::Analysis::CppCompatibility::nameOf ( Rose::Common::Analysis::ClassKeyType  key) const
overridevirtual

Returns the source name of a class represented by key.

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

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

◆ numericId()

std::intptr_t Rose::Source::Analysis::CppCompatibility::numericId ( Rose::Common::Analysis::AnyKeyType  id) const

Returns a numeric representation of any abstract key.

Parameters
idabstract key variant to inspect.
Returns
numeric representation of id.

◆ uniqueName()

std::string Rose::Source::Analysis::CppCompatibility::uniqueName ( Rose::Common::Analysis::AnyKeyType  id) const

Returns a unique frontend-derived name for any abstract key.

Parameters
idabstract key variant to name.
Returns
frontend-derived unique name for id.

◆ location()

SourceLocation Rose::Source::Analysis::CppCompatibility::location ( Rose::Common::Analysis::AnyKeyType  id,
bool  resolveInstantiations = false 
) const

Returns source location information for any abstract key.

Parameters
idabstract key variant whose source location is requested.
resolveInstantiationstrue to resolve template instantiation locations when supported.
Returns
source location for id.
Note
If the source location cannot be resolved, the exact fallback values are implementation-defined.

◆ compareNames()

int Rose::Source::Analysis::CppCompatibility::compareNames ( Rose::Common::Analysis::FunctionKeyType  lhs,
Rose::Common::Analysis::FunctionKeyType  rhs 
) const
overridevirtual

Compares function source names.

Parameters
lhsleft-hand side function key.
rhsright-hand side function key.
Returns
negative, zero, or positive according to the implementation-defined name ordering.

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

◆ compareFunctionTypes()

int Rose::Source::Analysis::CppCompatibility::compareFunctionTypes ( Rose::Common::Analysis::FunctionTypeKeyType  lhs,
Rose::Common::Analysis::FunctionTypeKeyType  rhs,
bool  exclReturnType = true 
) const

Compares two function types by canonical form.

Parameters
lhsleft-hand side function type key.
rhsright-hand side function type key.
exclReturnTypetrue to ignore top-level return type differences.
Returns
negative, zero, or positive according to the canonical type ordering.

◆ compareFunctionsByType()

int Rose::Source::Analysis::CppCompatibility::compareFunctionsByType ( Rose::Common::Analysis::FunctionKeyType  lhs,
Rose::Common::Analysis::FunctionKeyType  rhs,
bool  exclReturnType = true 
) const
overridevirtual

Compares two functions by canonical function type.

Parameters
lhsleft-hand side function key.
rhsright-hand side function key.
exclReturnTypetrue to ignore top-level return type differences.
Returns
negative, zero, or positive according to the canonical function type ordering.

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

◆ compareTypes()

int Rose::Source::Analysis::CppCompatibility::compareTypes ( Rose::Common::Analysis::TypeKeyType  lhs,
Rose::Common::Analysis::TypeKeyType  rhs 
) const

Compares two non-function types by canonical form.

Parameters
lhsleft-hand side type key.
rhsright-hand side type key.
Returns
negative, zero, or positive according to the canonical type ordering.

◆ haveSameOrCovariantReturn()

Rose::Common::Analysis::FunctionTypeRelation Rose::Source::Analysis::CppCompatibility::haveSameOrCovariantReturn ( const Rose::Common::Analysis::ClassAnalysis &  classes,
Rose::Common::Analysis::FunctionKeyType  basId,
Rose::Common::Analysis::FunctionKeyType  drvId 
) const
overridevirtual

Tests whether drvId has the same or a covariant return type relative to basId.

Parameters
classesclass hierarchy used to evaluate covariance.
basIdbase-class function key.
drvIdderived-class function key.
Returns
relationship between the return types of basId and drvId.

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

◆ areSameOrCovariant()

Rose::Common::Analysis::FunctionTypeRelation Rose::Source::Analysis::CppCompatibility::areSameOrCovariant ( const Rose::Common::Analysis::ClassAnalysis &  classes,
Rose::Common::Analysis::TypeKeyType  basId,
Rose::Common::Analysis::TypeKeyType  drvId 
) const

Tests whether two type keys denote the same or covariant class type.

Parameters
classesclass hierarchy used to evaluate covariance.
basIdbase return type key.
drvIdderived return type key.
Returns
relationship between basId and drvId.

◆ extractFromMemoryPool()

void Rose::Source::Analysis::CppCompatibility::extractFromMemoryPool ( Rose::Common::Analysis::ClassAnalysis &  classes) const
overridevirtual

Extracts C++ class information from the ROSE memory pool.

Parameters
classesanalysis object to populate.
Returns
nothing.

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

◆ extractFromProject()

void Rose::Source::Analysis::CppCompatibility::extractFromProject ( Rose::Common::Analysis::ClassAnalysis &  classes,
Rose::Common::Analysis::ASTRootType  root 
) const
overridevirtual

Extracts C++ class information by traversing the AST rooted at root.

Parameters
classesanalysis object to populate.
rootabstract key for the AST root to traverse.
Returns
nothing.

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

◆ languageSpecificProcessing()

Rose::Common::Analysis::LanguageSpecificFn Rose::Source::Analysis::CppCompatibility::languageSpecificProcessing ( ) const
overridevirtual

Returns C++-specific class-analysis post-processing.

Returns
callback that performs C++-specific post-processing.

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

◆ inheritanceEdges()

void Rose::Source::Analysis::CppCompatibility::inheritanceEdges ( Rose::Common::Analysis::ClassKeyType  clkey,
std::function< void(Rose::Common::Analysis::ClassKeyType, Rose::Common::Analysis::ClassKeyType, bool)>  fn 
) const
override

Calls fn for each direct base-class edge 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::Source::Analysis::CppCompatibility::typeOf ( Rose::Common::Analysis::VariableKeyType  var) const
overridevirtual

Returns the type summary of a non-static data member.

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

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

◆ isPureVirtual()

bool Rose::Source::Analysis::CppCompatibility::isPureVirtual ( Rose::Common::Analysis::FunctionKeyType  id) const
overridevirtual

Returns true when id denotes a pure virtual C++ function.

Parameters
idfunction key to inspect.
Returns
true if id denotes a pure virtual function.

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

◆ hasDefinition()

bool Rose::Source::Analysis::CppCompatibility::hasDefinition ( Rose::Common::Analysis::FunctionKeyType  id) const

Returns true when id has an attached function definition.

Parameters
idfunction key to inspect.
Returns
true if id has an attached definition.

◆ isAbstract()

bool Rose::Source::Analysis::CppCompatibility::isAbstract ( Rose::Common::Analysis::ClassKeyType  clkey) const
overridevirtual

Returns true when clkey denotes an abstract C++ class.

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

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

◆ functionNaming()

Rose::Common::Analysis::FuncNameFn Rose::Source::Analysis::CppCompatibility::functionNaming ( ) const

Returns a function key naming callback.

Returns
callback that maps function keys to names.

◆ classNaming()

Rose::Common::Analysis::ClassNameFn Rose::Source::Analysis::CppCompatibility::classNaming ( ) const

Returns a class key naming callback.

Returns
callback that maps class keys to names.

◆ variableNaming()

Rose::Common::Analysis::VarNameFn Rose::Source::Analysis::CppCompatibility::variableNaming ( ) const

Returns a variable key naming callback.

Returns
callback that maps variable keys to names.

◆ isAutoGeneratable()

bool Rose::Source::Analysis::CppCompatibility::isAutoGeneratable ( const Rose::Common::Analysis::ClassAnalysis &  all,
Rose::Common::Analysis::ClassKeyType  clkey,
Rose::Common::Analysis::FunctionKeyType  fnkey 
) const
overridevirtual

Returns true when fnkey can be implicitly generated for clkey.

Parameters
allclass analysis context.
clkeyclass for which implicit generation is tested.
fnkeyfunction whose signature is tested.
Returns
true if fnkey can be implicitly generated for clkey.

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

◆ languageStandard()

std::uint32_t Rose::Source::Analysis::CppCompatibility::languageStandard ( ) const
overridevirtual

Returns the detected C++ language standard value.

Returns
C++ standard version as a __cplusplus-style value, or zero if unavailable.

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

◆ specialMemberFunctions()

SpecialMemberFunctionContainer Rose::Source::Analysis::CppCompatibility::specialMemberFunctions ( Rose::Common::Analysis::ClassKeyType  clazz) const

Extracts special member functions declared or generated for clazz.

Parameters
clazzclass whose special member functions are requested.
Returns
detected special member function descriptors for clazz.

◆ classType()

Optional Rose::Source::Analysis::CppCompatibility::classType ( Rose::Common::Analysis::FunctionKeyType  fn) const

Returns the class that owns fn when it can be determined.

Parameters
fnfunction key to inspect.
Returns
owning class key, or an empty optional when the owner is unavailable.

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