ROSE 2.23.0
Loading...
Searching...
No Matches
AbstractCompatibilityBridge.h
1
2#ifndef ROSE_Common_Analysis_AbstractCompatibilityBridge_H
3#define ROSE_Common_Analysis_AbstractCompatibilityBridge_H 1
4
5#include <Rose/Common/Analysis/AnalysisTypes.h>
6
7namespace Rose::Common::Analysis
8{
9
10struct ClassAnalysis;
11
15using LanguageSpecificFn = std::function<void(ClassAnalysis&)>;
16
21{
22 public:
23
26
28 virtual
30
31 private:
32
36
40
44 AbstractCompatibilityBridge& operator=(const AbstractCompatibilityBridge& other) = delete;
45
50
51 public:
52 // not sure if clone will be needed..
53 // virtual AbstractCompatibilityBridge& clone() const = delete;
54
55
59 virtual
60 std::string
61 nameOf(FunctionKeyType key) const = 0;
62
63
67 virtual
68 std::string
69 nameOf(ClassKeyType key) const = 0;
70
71
75 virtual
76 bool
77 isAbstract(ClassKeyType key) const = 0;
78
79
85 virtual
86 bool
88
89
98 virtual
99 int
101
102
115 virtual
116 int
117 compareFunctionsByType(FunctionKeyType lhs, FunctionKeyType rhs, bool exclReturnType = true) const = 0;
118
119
128 virtual
129 FunctionTypeRelation
131
132
139 virtual
140 void
142
143
151 virtual
152 void
154
155
162 virtual
163 LanguageSpecificFn
165
166
171 virtual
172 void
173 inheritanceEdges(ClassKeyType clkey, std::function<void(ClassKeyType, ClassKeyType, bool)> fn) const = 0;
174
175
179 virtual
181 typeOf(VariableKeyType var) const = 0;
182
189 virtual
190 bool
192 {
193 (void)classes;
194 (void)clkey;
195 (void)fnkey;
196 return false;
197 }
198
201 virtual
202 std::uint32_t
203 languageStandard() const { return 0; }
204
218 virtual
219 bool
221
231 virtual
232 bool
234 {
235 (void)fnkey;
236 return true;
237 }
238
252 virtual
253 bool
255 {
256 (void)drv;
257 (void)bas;
258 return true;
259 }
260
269 virtual
270 bool
272 {
273 (void)fnkey;
274 return false;
275 }
276
290 virtual
291 void
293 ClassKeyType cls,
294 std::function<void(FunctionKeyType, FunctionKeyType)> fn
295 ) const
296 {
297 (void)classes;
298 (void)cls;
299 (void)fn;
300 }
301
318 virtual
319 bool
321 ClassKeyType drvClass,
322 FunctionKeyType drv,
323 ClassKeyType basClass,
325 ) const
326 {
327 (void)classes;
328 (void)drvClass;
329 (void)basClass;
330 return canOverride(drv, bas);
331 }
332
333 // no state
334};
335
336} // namespace
337
338#endif /*_ABSTRACT_COMPATIBILITY_BRIDGE_H*/
This is a stateless, abstract base class for implementing some functionality required by the class hi...
virtual bool isAbstract(ClassKeyType key) const =0
returns true if the class represented by key is an abstract class.
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 void extractFromMemoryPool(ClassAnalysis &classes) const =0
extracts class information from the memory pool if available
virtual bool inheritedMethodsImplementVirtualBaseMethods() const
returns whether a method inherited along the non-virtual inheritance chain implements an otherwise un...
AbstractCompatibilityBridge()=default
Constructs a stateless compatibility bridge.
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 std::string nameOf(ClassKeyType key) const =0
returns the source name of the class represented by key.
virtual bool canOverride(FunctionKeyType drv, FunctionKeyType bas) const
returns whether drv may override bas under language rules beyond name and signature,...
virtual ~AbstractCompatibilityBridge()=default
Destroys a compatibility bridge through the base type.
virtual DataMemberType typeOf(VariableKeyType var) const =0
returns the type of a non-static data member var.
virtual FunctionTypeRelation haveSameOrCovariantReturn(const ClassAnalysis &classes, FunctionKeyType basId, FunctionKeyType drvId) const =0
tests if drvId has the same or covariant return type with respect to basId
virtual void extractFromProject(ClassAnalysis &classes, ASTRootType root) const =0
extracts class by walking the AST rooted at root.
virtual bool isPureVirtual(FunctionKeyType key) const =0
returns true if the class represented by key is an abstract function.
virtual LanguageSpecificFn languageSpecificProcessing() const =0
returns a function that handles language specific post-processing for the extract classes.
virtual int compareNames(FunctionKeyType lhs, FunctionKeyType rhs) const =0
compares the source name of the functions lhs and rhs.
virtual std::uint32_t languageStandard() const
returns the active language standard as a C++ __cplusplus-style value when available.
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,...
virtual bool isInheritableImplementation(FunctionKeyType fnkey) const
returns whether the inherited function fnkey qualifies as an implementation of a virtual base functio...
virtual bool isFinal(FunctionKeyType fnkey) const
returns whether the virtual function fnkey cannot be overridden.
virtual std::string nameOf(FunctionKeyType key) const =0
returns the source name of the function represented by key.
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 signa...
virtual int compareFunctionsByType(FunctionKeyType lhs, FunctionKeyType rhs, bool exclReturnType=true) const =0
compares the canonical types of functions lhs and rhs
holds data about all classes in a program
Describes the class-valued type and selected qualifiers of a data member.
Strongly typed wrapper around an abstract pointer-sized analysis key.