1#ifndef ROSE_Source_Analysis_CppCompatibility_H
2#define ROSE_Source_Analysis_CppCompatibility_H 1
4#include <Rose/Common/Analysis/AbstractCompatibilityBridge.h>
5#include <Rose/Common/Analysis/ClassHierarchyAnalysis.h>
6#include <Rose/Source/Analysis/CppSpecialMemberAnalysis.h>
13#include <boost/optional/optional.hpp>
14#include <boost/utility/string_view.hpp>
32using Optional = boost::optional<Rose::Common::Analysis::ClassKeyType>;
39 std::tuple<StringView, std::uint32_t, std::uint32_t, std::uint32_t, std::uint32_t>;
55 std::uint32_t
startLine()
const {
return std::get<1>(*
this); }
59 std::uint32_t
startCol()
const {
return std::get<2>(*
this); }
63 std::uint32_t
limitLine()
const {
return std::get<3>(*
this); }
67 std::uint32_t
limitCol()
const {
return std::get<4>(*
this); }
174 std::intptr_t
numericId(Rose::Common::Analysis::AnyKeyType
id)
const;
179 std::string
uniqueName(Rose::Common::Analysis::AnyKeyType
id)
const;
219 Rose::Common::Analysis::FunctionTypeRelation
229 Rose::Common::Analysis::FunctionTypeRelation
315std::pair<Rose::Common::Analysis::ClassKeyType, Rose::Common::Analysis::TypeKeyType>
346boost::optional<std::string>
This is a stateless, abstract base class for implementing some functionality required by the class hi...
holds data about all classes in a program
Implements the Common compatibility interface for C++ ROSE AST nodes.
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.
SpecialMemberFunctionContainer specialMemberFunctions(Rose::Common::Analysis::ClassKeyType clazz) const
Extracts special member functions declared or generated for clazz.
bool isAbstract(Rose::Common::Analysis::ClassKeyType clkey) const override
Returns true when clkey denotes an abstract C++ class.
Rose::Common::Analysis::FunctionKeyType functionId(const SgFunctionDeclaration *fun) const
Converts a ROSE function declaration pointer to an abstract function key.
int compareTypes(Rose::Common::Analysis::TypeKeyType lhs, Rose::Common::Analysis::TypeKeyType rhs) const
Compares two non-function types by canonical form.
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.
Optional classType(Rose::Common::Analysis::FunctionKeyType fn) const
Returns the class that owns fn when it can be determined.
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.
bool isPureVirtual(Rose::Common::Analysis::FunctionKeyType id) const override
Returns true when id denotes a pure virtual C++ function.
Rose::Common::Analysis::ClassNameFn classNaming() const
Returns a class key naming callback.
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.
Rose::Common::Analysis::FuncNameFn functionNaming() const
Returns a function key naming callback.
std::string nameOf(Rose::Common::Analysis::ClassKeyType key) const override
Returns the source name of a class represented by key.
std::string nameOf(Rose::Common::Analysis::VariableKeyType key) const
Returns the source name of a variable represented by key.
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::intptr_t numericId(Rose::Common::Analysis::AnyKeyType id) const
Returns a numeric representation of any abstract key.
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.
SourceLocation location(Rose::Common::Analysis::AnyKeyType id, bool resolveInstantiations=false) const
Returns source location information for any abstract key.
int compareFunctionsByType(Rose::Common::Analysis::FunctionKeyType lhs, Rose::Common::Analysis::FunctionKeyType rhs, bool exclReturnType=true) const override
Compares two functions by canonical function type.
Rose::Common::Analysis::VarNameFn variableNaming() const
Returns a variable key naming callback.
Rose::Common::Analysis::LanguageSpecificFn languageSpecificProcessing() const override
Returns C++-specific class-analysis post-processing.
int compareFunctionTypes(Rose::Common::Analysis::FunctionTypeKeyType lhs, Rose::Common::Analysis::FunctionTypeKeyType rhs, bool exclReturnType=true) const
Compares two function types by canonical form.
std::string uniqueName(Rose::Common::Analysis::AnyKeyType id) const
Returns a unique frontend-derived name for any abstract key.
bool hasDefinition(Rose::Common::Analysis::FunctionKeyType id) const
Returns true when id has an attached function definition.
std::uint32_t languageStandard() const override
Returns the detected C++ language standard value.
void extractFromMemoryPool(Rose::Common::Analysis::ClassAnalysis &classes) const override
Extracts C++ class information from the ROSE memory pool.
std::string nameOf(Rose::Common::Analysis::FunctionKeyType key) const override
Returns the source name of a function represented by key.
int compareNames(Rose::Common::Analysis::FunctionKeyType lhs, Rose::Common::Analysis::FunctionKeyType rhs) const override
Compares function source names.
This class represents the concept of a class definition in C++.
This class represents the concept of a declaration statement.
This class represents the concept of a function declaration statement.
This class represents a type for all functions.
This class represents the notion of a declared variable.
This class represents the concept of a member function declaration statement.
This class represents a source project, with a list of SgFile objects and global information about th...
This class represents the base class for all types.
This class represents the concept of a C or C++ variable declaration.
Capabilities related to the analysis of source-code.
std::tuple< StringView, std::uint32_t, std::uint32_t, std::uint32_t, std::uint32_t > SourceLocationBase
Tuple storage for a source file location range.
SgFunctionDeclaration & keyDecl(SgFunctionDeclaration &fn)
Returns the canonical declaration used as a function key.
SgFunctionType * keyToFunctionType(Rose::Common::Analysis::FunctionTypeKeyType key)
Converts an abstract function type key to a ROSE function type pointer.
boost::optional< Rose::Common::Analysis::ClassKeyType > Optional
Optional C++ class key result.
boost::string_view StringView
Non-owning string view used for source text ranges.
Rose::Common::Analysis::ASTRootType rootToKey(const SgProject *n)
Converts a ROSE project pointer to an abstract root key.
Rose::Common::Analysis::ClassKeyType classToKey(const SgClassDefinition *n)
Converts a ROSE class definition pointer to an abstract class key.
std::pair< Rose::Common::Analysis::ClassKeyType, Rose::Common::Analysis::TypeKeyType > getClassCastInfo(Rose::Common::Analysis::TypeKeyType tykey)
Returns class and type keys used for class-cast analysis of tykey.
boost::optional< std::string > missingDiagnostics(Rose::Common::Analysis::ClassKeyType key)
Returns diagnostics explaining why a class key could not be resolved, if available.
SgClassDefinition * getClassDefOpt(const SgClassType &n)
Returns the class definition for a class type when available.
Rose::Common::Analysis::TypeKeyType typeToKey(const SgType *n)
Converts a ROSE type pointer to an abstract type key.
Rose::Common::Analysis::FunctionKeyType functionToKey(const SgFunctionDeclaration *n)
Converts a ROSE function declaration pointer to an abstract function key.
Rose::Common::Analysis::VariableKeyType variableToKey(const SgInitializedName *n)
Converts a ROSE initialized-name pointer to an abstract variable key.
SgProject * keyToRoot(Rose::Common::Analysis::ASTRootType key)
Converts an abstract root key to a ROSE project pointer.
SgClassDefinition & getClassDefForFunction(const SgMemberFunctionDeclaration &n)
Returns the class definition associated with a member function declaration.
SgType * keyToType(Rose::Common::Analysis::TypeKeyType key)
Converts an abstract type key to a ROSE type pointer.
std::string dbgInfo(Rose::Common::Analysis::ClassKeyType key, std::size_t numParents=3)
Returns debug information for a class key and up to numParents parent nodes.
Rose::Common::Analysis::FunctionTypeKeyType functionTypeToKey(const SgFunctionType *n)
Converts a ROSE function type pointer to an abstract function type key.
SgInitializedName * keyToVariable(Rose::Common::Analysis::VariableKeyType key)
Converts an abstract variable key to a ROSE initialized-name pointer.
std::ostream & operator<<(std::ostream &os, const SourceLocation &loc)
Writes a source location in a compact textual form.
SgFunctionDeclaration * keyToFunction(Rose::Common::Analysis::FunctionKeyType key)
Converts an abstract function key to a ROSE function declaration pointer.
SgClassDefinition * keyToClass(Rose::Common::Analysis::ClassKeyType key)
Converts an abstract class key to a ROSE class definition pointer.
SgClassDefinition & getClassDef(const SgDeclarationStatement &n)
Returns the class definition represented by a declaration statement.
Describes the class-valued type and selected qualifiers of a data member.
Strongly typed wrapper around an abstract pointer-sized analysis key.
Describes a source file range using one-based line and column positions.
std::uint32_t startLine() const
Returns the starting line.
std::uint32_t limitCol() const
Returns the limiting column.
StringView file() const
Returns the source filename.
std::uint32_t limitLine() const
Returns the limiting line.
std::uint32_t startCol() const
Returns the starting column.
SourceLocationBase base
Base tuple type used for storage.