#include <include/EDoc/FunctionType.h>
Inheritance diagram for EDoc::FunctionType:
This stores information about the individual elements of a function pointer or a member function pointer in C++. This information is stored seperatly in order to be able to match function pointers that can be called across C/C++ with types that may have different names due to typedefs etc.
It is primarily used for storing the type of a Function object and for being stored in a CodeBlock::function_pointers list as a list of calls to function pointers. The most important call is the IsEquivilant() function.
Definition at line 44 of file FunctionType.h.
Public Member Functions | |
FunctionType (Dictionary &dict_in, std::string key_name_in) | |
See StringIdentifiedObject::(Dictionary& dict_in, std::string key_name_in, bool populated_in=false). | |
FunctionType (Dictionary &dict_in, int32_t index_in) | |
See StringIdentifiedObject(Dictionary& dict_in, int32_t index_in, bool populated_in=false). | |
FunctionType & | operator= (const FunctionType &right) |
Copies data from another object into this one. | |
void | Read (PersistenceIFace &file, IndexedDictionary &idict) |
See StringIdentifiedObject::Read(). | |
void | Write (PersistenceIFace &file) const |
See StringIdentifiedObject::Write(). | |
virtual void | Merge (const StringIdentifiedObject &right) |
See StringIdentifiedObject::Merge(). | |
virtual size_t | ReplaceReferences (PStack &stack, void *remove, void *replace) |
DictionarySpecific::ReplaceReferences(). | |
virtual std::ostream & | Print (std::ostream &out, std::string prefix="") const |
See DictionarySpecific::Print(). | |
virtual void | Validate (PStack &stack, const Dictionary &dict_in) const |
See DictionarySpecific::Validate(). | |
bool | operator== (const FunctionType &right) const |
Returns true if the two types are the same. | |
virtual uint8_t | GetRecordType () const |
See StringIdentifiedObject::GetRecordType(). | |
std::string | GetDeclaredName () const |
Returns a string representation of this function pointer type using the names for the types as the user may have defined them. | |
std::string | GetNormalisedName () const |
Returns a string representation of this function pointer type using the names for the types in a normalized format. | |
std::string | GetSpecString () const |
See Function::GetSpecString(). | |
bool | IsEquivilant (const FunctionType &right) const |
Returns true if the function type on the right is equivilant to the function type on the left. | |
std::string | GetNameInternal (bool canonical) const |
Returns the name of this function type in one of two formats. | |
const std::string & | GetKeyName () const |
Returns the string key that identifies this object. | |
ssize_t | GetIndex () const |
Returns the integer key that identifies this object. | |
bool | IsPopulated () const |
Returns true if this object has been completely populated from a file source or manually or false if the object is incomplete. | |
std::string | ToString (std::string prefix="") const |
Returns a string representing the current object in a user readable manner. | |
Data Fields | |
std::string | full_name |
A representative name for the function type. | |
Type * | return_type |
The type instance that represents the functions return type. | |
Type * | method_context |
The type instance that represents the class this function belongs to if it is a pointer to a C++ class member. | |
std::vector< Type * > | parameters |
The type instances for all the parameters that make up the functions aregument list. | |
bool | is_const |
True if method_context is not null and this member is defined const. | |
bool | has_exception_spec |
See Function::has_exception_spec. | |
std::vector< Type * > | exception_spec |
See Function::exception_spec. | |
std::vector< FunctionType * > | equivilant |
Stores a list of other function types that are considered equivilant to this one. | |
std::vector< Function * > | addressed_functions |
USED ONLY FROM Dictionary::CalculatePropogatingExceptions(). | |
Protected Member Functions | |
void | SetKeyName (std::string key_name_in) |
Used by derived class to set the string key once it is able to determine it. | |
Protected Attributes | |
bool | populated |
True if this object has been completely populated. | |
int32_t | index |
Set to the integer index used to identify this object or -1 if the key_name is used to identify this object. | |
std::string | key_name |
Set to the string key used to identify this object. | |
bool | writing |
USED ONLY FROM Dictionary::Write(). | |
Dictionary & | dict |
A reference to the dictionary this object belongs to. |
EDoc::FunctionType::FunctionType | ( | EDoc::Dictionary & | dict_in, | |
std::string | key_name_in | |||
) |
See StringIdentifiedObject::(Dictionary& dict_in, std::string key_name_in, bool populated_in=false).
Definition at line 56 of file FunctionType.cpp.
EDoc::FunctionType::FunctionType | ( | EDoc::Dictionary & | dict_in, | |
int32_t | index_in | |||
) |
See StringIdentifiedObject(Dictionary& dict_in, int32_t index_in, bool populated_in=false).
Definition at line 65 of file FunctionType.cpp.
EDoc::FunctionType::operator= | ( | const FunctionType & | right | ) |
Copies data from another object into this one.
This can be used across different dictionaries and will only copy object data but not identification information used in the StringIdentifiedObject such as the key name.
Definition at line 74 of file FunctionType.cpp.
References EDoc::DictionarySpecific::dict, EDOC_Finer, EDoc::Erase(), exception_spec, full_name, has_exception_spec, is_const, method_context, parameters, EDoc::StringIdentifiedObject::populated, return_type, and EDoc::Dictionary::types.
EDoc::FunctionType::Read | ( | EDoc::PersistenceIFace & | file, | |
EDoc::IndexedDictionary & | idict | |||
) | [virtual] |
See StringIdentifiedObject::Read().
EDoc::EOFException |
| |
EDoc::FileIOException |
|
Implements EDoc::StringIdentifiedObject.
Definition at line 112 of file FunctionType.cpp.
References EDoc::Erase(), exception_spec, full_name, has_exception_spec, is_const, KEY_EXCEPTION_SPEC_LI, KEY_EXCEPTION_SPEC_LS, KEY_FULL_NAME, KEY_HAS_EXCEPTION_SPEC, KEY_IS_CONST, KEY_IS_METHOD, KEY_METHOD_CONTEXT, KEY_PARAMETERS_LI, KEY_PARAMETERS_LS, KEY_RETURN_TYPE, method_context, EDoc::StringIdentifiedObject::populated, EDoc::PersistenceIFace::ReadBoolean(), EDoc::PersistenceIFace::ReadString(), EDoc::PersistenceIFace::ReadUInt32(), return_type, EDoc::StringIdentifiedObject::SetKeyName(), and EDoc::IndexedDictionary::types.
EDoc::FunctionType::Write | ( | EDoc::PersistenceIFace & | file | ) | const [virtual] |
See StringIdentifiedObject::Write().
EDoc::FileIOException |
|
Implements EDoc::StringIdentifiedObject.
Definition at line 151 of file FunctionType.cpp.
References exception_spec, full_name, EDoc::StringIdentifiedObject::GetIndex(), has_exception_spec, is_const, KEY_EXCEPTION_SPEC_LI, KEY_EXCEPTION_SPEC_LS, KEY_FULL_NAME, KEY_HAS_EXCEPTION_SPEC, KEY_IS_CONST, KEY_IS_METHOD, KEY_METHOD_CONTEXT, KEY_PARAMETERS_LI, KEY_PARAMETERS_LS, KEY_RETURN_TYPE, method_context, return_type, EDoc::PersistenceIFace::WriteBoolean(), EDoc::PersistenceIFace::WriteString(), and EDoc::PersistenceIFace::WriteUInt32().
EDoc::FunctionType::Merge | ( | const StringIdentifiedObject & | right | ) | [virtual] |
See StringIdentifiedObject::Merge().
EDoc::MergeException |
|
Implements EDoc::StringIdentifiedObject.
Definition at line 221 of file FunctionType.cpp.
References EDOC_MERGE_ERROR, EDOC_NOTIFICATION, EDOC_Warning, exception_spec, full_name, GetDeclaredName(), EDoc::StringIdentifiedObject::GetKeyName(), GetNormalisedName(), EDoc::Type::GetNormalisedName(), GetSpecString(), has_exception_spec, is_const, method_context, parameters, EDoc::StringIdentifiedObject::populated, return_type, and EDoc::WDIFF_THROW.
EDoc::FunctionType::ReplaceReferences | ( | EDoc::PStack & | stack, | |
void * | remove, | |||
void * | replace | |||
) | [virtual] |
DictionarySpecific::ReplaceReferences().
Implements EDoc::DictionarySpecific.
Definition at line 427 of file FunctionType.cpp.
References addressed_functions, EDOC_REPLACE, exception_spec, method_context, parameters, EDoc::PStack::Push(), and return_type.
EDoc::FunctionType::Print | ( | std::ostream & | out, | |
std::string | prefix = "" | |||
) | const [virtual] |
See DictionarySpecific::Print().
Implements EDoc::DictionarySpecific.
Definition at line 182 of file FunctionType.cpp.
References full_name, GetDeclaredName(), EDoc::Type::GetDeclaredName(), GetSpecString(), has_exception_spec, is_const, method_context, parameters, and return_type.
EDoc::FunctionType::Validate | ( | EDoc::PStack & | stack, | |
const Dictionary & | dict_in | |||
) | const [virtual] |
See DictionarySpecific::Validate().
Implements EDoc::DictionarySpecific.
Definition at line 457 of file FunctionType.cpp.
References addressed_functions, EDoc::DictionarySpecific::dict, EDOC_ASSERT, exception_spec, EDoc::Dictionary::function_types, EDoc::StringIdentifiedObject::GetKeyName(), has_exception_spec, EDoc::StringIdentifiedObject::index, EDoc::StringIdentifiedObject::key_name, method_context, parameters, EDoc::StringIdentifiedObject::populated, return_type, and EDoc::Type::Validate().
Referenced by EDoc::FunctionTypeLoc::Validate(), and EDoc::Function::Validate().
EDoc::FunctionType::operator== | ( | const FunctionType & | right | ) | const |
Returns true if the two types are the same.
Works across dictionaries.
EDoc::FunctionType::GetRecordType | ( | ) | const [virtual] |
See StringIdentifiedObject::GetRecordType().
Implements EDoc::StringIdentifiedObject.
Definition at line 51 of file FunctionType.cpp.
References VALUE_RECORD_TYPE_FUNCTION_TYPE.
EDoc::FunctionType::GetDeclaredName | ( | ) | const [inline] |
Returns a string representation of this function pointer type using the names for the types as the user may have defined them.
Definition at line 130 of file FunctionType.h.
References GetNameInternal().
Referenced by Merge(), Print(), and EDoc::FunctionTypeLoc::Write().
EDoc::FunctionType::GetNormalisedName | ( | ) | const [inline] |
Returns a string representation of this function pointer type using the names for the types in a normalized format.
Definition at line 139 of file FunctionType.h.
References GetNameInternal().
Referenced by Merge(), and EDoc::FunctionTypeLoc::operator==().
EDoc::FunctionType::GetSpecString | ( | ) | const |
See Function::GetSpecString().
Definition at line 361 of file FunctionType.cpp.
References exception_spec, has_exception_spec, and EDoc::StringIdentifiedObject::IsPopulated().
EDoc::FunctionType::IsEquivilant | ( | const FunctionType & | right | ) | const |
Returns true if the function type on the right is equivilant to the function type on the left.
Note: This is not exact. It will return true in some cases where they are NOT equivilant. This is due to C type equivilance tests that differ from C++ ones. This needs to be worked on in the future, however it will match as best it can from the data it has available.
Types that trace to a root type with external linkage can be accuratly tested for equivilance, however types whose root_type does NOT have external linkage can not be tested for equality currently. So we just assume they are equal.
Definition at line 390 of file FunctionType.cpp.
References EDoc::Type::IsEquivilant(), parameters, and return_type.
EDoc::FunctionType::GetNameInternal | ( | bool | canonical | ) | const |
Returns the name of this function type in one of two formats.
canonical | If true returns the canonical form of the function name otherwise returns the declared form of the function pointer types name. |
Definition at line 516 of file FunctionType.cpp.
References full_name, EDoc::Type::GetNormalisedName(), method_context, parameters, and return_type.
Referenced by GetDeclaredName(), and GetNormalisedName().
EDoc::StringIdentifiedObject::GetKeyName | ( | ) | const [inherited] |
Returns the string key that identifies this object.
Will assert if the object has not yet been populated OR it currently uses an integer identifier not a string identifier.
Definition at line 51 of file StringIdentifiedObject.cpp.
References EDOC_ASSERT, EDoc::StringIdentifiedObject::index, EDoc::StringIdentifiedObject::key_name, and EDoc::StringIdentifiedObject::writing.
Referenced by EDoc::ManagedObject::CAdd(), EDoc::ManagedObject::CAlwaysGet(), EDoc::ManagedObject::CRemove(), EDoc::Function::ExpandCallGraph(), EDoc::FunctionLoc::FunctionLoc(), EDoc::Type::GetBestName(), EDoc::Type::IsEquivilant(), EDoc::Type::Merge(), EDoc::Location::Merge(), Merge(), EDoc::Function::Merge(), EDoc::FunctionLoc::operator<(), EDoc::TypeLoc::Print(), EDoc::PropogatingException::Print(), EDoc::FunctionTypeLoc::Print(), EDoc::FunctionLoc::Print(), EDoc::Function::Print(), EDoc::Exception::Print(), EDoc::CatchBlock::Print(), EDoc::Dictionary::ProcessCodeBlock(), EDoc::Dictionary::ProcessFunction(), EDoc::StdErrFunctionProgress::Progress(), EDoc::Dictionary::Read(), EDoc::Dictionary::UpdateFunctionAddressLists(), EDoc::Type::Validate(), Validate(), EDoc::Function::Validate(), EDoc::File::Validate(), EDoc::Dictionary::Validate(), EDoc::CatchBlock::Validate(), and EDoc::Function::Write().
EDoc::StringIdentifiedObject::GetIndex | ( | ) | const [inline, inherited] |
Returns the integer key that identifies this object.
Definition at line 142 of file StringIdentifiedObject.h.
References EDoc::StringIdentifiedObject::index.
Referenced by EDoc::TypeLoc::Write(), EDoc::Type::Write(), EDoc::FunctionTypeLoc::Write(), Write(), EDoc::FunctionLoc::Write(), and EDoc::Function::Write().
EDoc::StringIdentifiedObject::IsPopulated | ( | ) | const [inline, inherited] |
Returns true if this object has been completely populated from a file source or manually or false if the object is incomplete.
Definition at line 151 of file StringIdentifiedObject.h.
References EDoc::StringIdentifiedObject::populated.
Referenced by EDoc::Dictionary::GeneratePredefined(), EDoc::Type::GetBestName(), GetSpecString(), EDoc::Function::GetSpecString(), and EDoc::Dictionary::Read().
EDoc::StringIdentifiedObject::SetKeyName | ( | std::string | key_name_in | ) | [protected, inherited] |
Used by derived class to set the string key once it is able to determine it.
Usually an instance is created with an integer index and then data is loaded into the object and once it has loaded it is able to determine what its string index should be. Then it will call this function which sets the integer index to -1 and sets the string key to the given value.
Definition at line 57 of file StringIdentifiedObject.cpp.
References EDOC_ASSERT, EDoc::StringIdentifiedObject::index, and EDoc::StringIdentifiedObject::key_name.
Referenced by EDoc::Type::Read(), Read(), EDoc::Function::Read(), and EDoc::File::Read().
EDoc::DictionarySpecific::ToString | ( | std::string | prefix = "" |
) | const [inherited] |
Returns a string representing the current object in a user readable manner.
This will return as a string exactly what Print() would display. This is primarily here for use from within python and for debugging.
Definition at line 34 of file DictionarySpecific.cpp.
References EDoc::DictionarySpecific::Print().
Referenced by EDoc::Dictionary::Read().
std::string EDoc::FunctionType::full_name |
A representative name for the function type.
Definition at line 171 of file FunctionType.h.
Referenced by GetNameInternal(), Merge(), operator=(), Print(), Read(), and Write().
The type instance that represents the functions return type.
Definition at line 176 of file FunctionType.h.
Referenced by GetNameInternal(), IsEquivilant(), Merge(), operator=(), Print(), Read(), ReplaceReferences(), Validate(), and Write().
The type instance that represents the class this function belongs to if it is a pointer to a C++ class member.
Definition at line 182 of file FunctionType.h.
Referenced by GetNameInternal(), Merge(), operator=(), Print(), Read(), ReplaceReferences(), Validate(), and Write().
std::vector<Type*> EDoc::FunctionType::parameters |
The type instances for all the parameters that make up the functions aregument list.
Definition at line 188 of file FunctionType.h.
Referenced by GetNameInternal(), IsEquivilant(), Merge(), operator=(), Print(), ReplaceReferences(), and Validate().
True if method_context is not null and this member is defined const.
Definition at line 194 of file FunctionType.h.
Referenced by Merge(), operator=(), Print(), Read(), and Write().
See Function::has_exception_spec.
Definition at line 199 of file FunctionType.h.
Referenced by GetSpecString(), Merge(), operator=(), Print(), Read(), Validate(), and Write().
std::vector<Type*> EDoc::FunctionType::exception_spec |
Definition at line 204 of file FunctionType.h.
Referenced by GetSpecString(), Merge(), operator=(), Read(), ReplaceReferences(), Validate(), and Write().
std::vector<FunctionType*> EDoc::FunctionType::equivilant |
Stores a list of other function types that are considered equivilant to this one.
This value is set by Dictionary::UpdateFunctionAddressLists() and is used in expanding the callgraph for function pointer calls. Its value is considered temporary and should not be used elsewhere.
Definition at line 229 of file FunctionType.h.
Referenced by EDoc::Dictionary::UpdateFunctionAddressLists().
std::vector<Function*> EDoc::FunctionType::addressed_functions |
USED ONLY FROM Dictionary::CalculatePropogatingExceptions().
This is only used as a "cache" and contains a list of all functions that match this type whose addresses have been taken.
Definition at line 237 of file FunctionType.h.
Referenced by ReplaceReferences(), and Validate().
bool EDoc::StringIdentifiedObject::populated [protected, inherited] |
True if this object has been completely populated.
Definition at line 176 of file StringIdentifiedObject.h.
Referenced by EDoc::Dictionary::GeneratePredefined(), EDoc::StringIdentifiedObject::IsPopulated(), EDoc::Type::Merge(), Merge(), EDoc::Function::Merge(), EDoc::File::Merge(), EDoc::Type::operator=(), operator=(), EDoc::Function::operator=(), EDoc::Type::Read(), Read(), EDoc::Function::Read(), EDoc::File::Read(), EDoc::Type::Validate(), Validate(), and EDoc::Function::Validate().
int32_t EDoc::StringIdentifiedObject::index [mutable, protected, inherited] |
Set to the integer index used to identify this object or -1 if the key_name is used to identify this object.
Definition at line 182 of file StringIdentifiedObject.h.
Referenced by EDoc::IndexedObject::CAdd(), EDoc::Dictionary::GeneratePredefined(), EDoc::StringIdentifiedObject::GetIndex(), EDoc::StringIdentifiedObject::GetKeyName(), EDoc::StringIdentifiedObject::SetKeyName(), EDoc::Type::Validate(), Validate(), EDoc::Function::Validate(), and EDoc::File::Validate().
std::string EDoc::StringIdentifiedObject::key_name [protected, inherited] |
Set to the string key used to identify this object.
Definition at line 187 of file StringIdentifiedObject.h.
Referenced by EDoc::Dictionary::GeneratePredefined(), EDoc::StringIdentifiedObject::GetKeyName(), EDoc::StringIdentifiedObject::SetKeyName(), EDoc::Type::Validate(), Validate(), EDoc::Function::Validate(), and EDoc::File::Validate().
bool EDoc::StringIdentifiedObject::writing [mutable, protected, inherited] |
USED ONLY FROM Dictionary::Write().
While writing an object to file it is possible to use both the objects integer and string keys. This is the only time that is allowable and this flag is used to determine that.
Definition at line 204 of file StringIdentifiedObject.h.
Referenced by EDoc::StringIdentifiedObject::GetKeyName().
Dictionary& EDoc::DictionarySpecific::dict [protected, inherited] |
A reference to the dictionary this object belongs to.
Definition at line 150 of file DictionarySpecific.h.
Referenced by EDoc::ManagedObject::CAlwaysGet(), EDoc::CatchBlock::CatchBlock(), EDoc::Exception::Exception(), EDoc::Function::ExpandCallGraph(), EDoc::CodeBlock::ExpandCallGraph(), EDoc::FunctionLoc::FunctionLoc(), EDoc::FunctionTypeLoc::FunctionTypeLoc(), EDoc::Function::GetSubstException(), EDoc::Location::Location(), EDoc::ManagedObject::ManagedObject(), EDoc::Type::Merge(), EDoc::Location::Merge(), EDoc::Function::Merge(), EDoc::SpecificManagedObject< EDoc::Type >::New(), EDoc::TypeLoc::operator=(), EDoc::Type::operator=(), EDoc::TryBlock::operator=(), EDoc::PropogatingException::operator=(), EDoc::Location::operator=(), EDoc::FunctionTypeLoc::operator=(), operator=(), EDoc::FunctionLoc::operator=(), EDoc::Function::operator=(), EDoc::Exception::operator=(), EDoc::CodeBlock::operator=(), EDoc::PropogatingException::PropogatingException(), EDoc::TryBlock::Read(), EDoc::Function::Read(), EDoc::CodeBlock::Read(), EDoc::TryBlock::TryBlock(), EDoc::TypeLoc::TypeLoc(), EDoc::TypeLoc::Validate(), EDoc::Type::Validate(), EDoc::TryBlock::Validate(), EDoc::PropogatingException::Validate(), EDoc::ManagedObject::Validate(), EDoc::Location::Validate(), EDoc::FunctionTypeLoc::Validate(), Validate(), EDoc::FunctionLoc::Validate(), EDoc::Function::Validate(), EDoc::File::Validate(), EDoc::Exception::Validate(), EDoc::CodeBlock::Validate(), EDoc::CatchBlock::Validate(), EDoc::Type::Write(), and EDoc::Function::Write().