Commit 2f46b8a5 authored by ussrhero's avatar ussrhero
Browse files

added getScopeName method to TypeInfo

parent 8d28d97e
...@@ -201,7 +201,7 @@ typedef unsigned long DebugOptionsSet; ...@@ -201,7 +201,7 @@ typedef unsigned long DebugOptionsSet;
enum BreakpointAccess { enum BreakpointAccess {
Read = 0x00000001, Read = 0x00000001,
Write = 0x00000002, Write = 0x00000002,
Execute = 0x00000004, Execute = 0x00000004
}; };
......
...@@ -46,6 +46,7 @@ public: ...@@ -46,6 +46,7 @@ public:
virtual std::wstring str() = 0; virtual std::wstring str() = 0;
virtual std::wstring getName() = 0; virtual std::wstring getName() = 0;
virtual std::wstring getScopeName() = 0;
virtual std::pair<std::wstring, std::wstring> splitName() = 0; virtual std::pair<std::wstring, std::wstring> splitName() = 0;
virtual size_t getSize() = 0; virtual size_t getSize() = 0;
......
...@@ -31,6 +31,10 @@ protected: ...@@ -31,6 +31,10 @@ protected:
NOT_IMPLEMENTED(); NOT_IMPLEMENTED();
} }
virtual std::wstring getScopeName() {
NOT_IMPLEMENTED();
}
virtual std::pair<std::wstring, std::wstring> splitName() { virtual std::pair<std::wstring, std::wstring> splitName() {
NOT_IMPLEMENTED(); NOT_IMPLEMENTED();
} }
......
...@@ -41,6 +41,10 @@ protected: ...@@ -41,6 +41,10 @@ protected:
NOT_IMPLEMENTED(); NOT_IMPLEMENTED();
} }
virtual std::wstring getScopeName() {
throw TypeException( getName(), L"type has no scope name" );
}
virtual std::pair<std::wstring, std::wstring> splitName() { virtual std::pair<std::wstring, std::wstring> splitName() {
return std::pair<std::wstring, std::wstring>(getName(), std::wstring()); return std::pair<std::wstring, std::wstring>(getName(), std::wstring());
} }
...@@ -306,6 +310,7 @@ protected: ...@@ -306,6 +310,7 @@ protected:
} }
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class TypeInfoFields : public TypeInfoImp class TypeInfoFields : public TypeInfoImp
...@@ -372,13 +377,30 @@ private: ...@@ -372,13 +377,30 @@ private:
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class TypeInfoUdt : public TypeInfoFields class SymbolFields : public TypeInfoFields
{
public:
SymbolFields(SymbolPtr &symbol) :
TypeInfoFields( symbol->getName() ),
m_symbol(symbol)
{}
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
protected:
SymbolPtr m_symbol;
};
class TypeInfoUdt : public SymbolFields
{ {
public: public:
TypeInfoUdt(SymbolPtr &symbol) : TypeInfoUdt(SymbolPtr &symbol) :
TypeInfoFields( symbol->getName() ), SymbolFields( symbol )
m_symbol( symbol )
{} {}
protected: protected:
...@@ -420,8 +442,6 @@ protected: ...@@ -420,8 +442,6 @@ protected:
protected: protected:
SymbolPtr m_symbol;
virtual void getFields(); virtual void getFields();
virtual void getVirtualDisplacement( const std::wstring& fieldName, MEMOFFSET_32 &virtualBasePtr, size_t &virtualDispIndex, size_t &virtualDispSize ); virtual void getVirtualDisplacement( const std::wstring& fieldName, MEMOFFSET_32 &virtualBasePtr, size_t &virtualDispIndex, size_t &virtualDispSize );
...@@ -442,13 +462,12 @@ protected: ...@@ -442,13 +462,12 @@ protected:
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class TypeInfoEnum : public TypeInfoFields class TypeInfoEnum : public SymbolFields
{ {
public: public:
TypeInfoEnum( SymbolPtr& symbol ) : TypeInfoEnum( SymbolPtr& symbol ) :
TypeInfoFields( symbol->getName() ), SymbolFields( symbol )
m_symbol( symbol )
{} {}
virtual std::wstring str(); virtual std::wstring str();
...@@ -567,6 +586,10 @@ protected: ...@@ -567,6 +586,10 @@ protected:
return getPtrSize(); return getPtrSize();
} }
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
private: private:
SymbolPtr m_symbol; SymbolPtr m_symbol;
...@@ -729,6 +752,10 @@ public: ...@@ -729,6 +752,10 @@ public:
return L"VTable"; return L"VTable";
} }
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
virtual size_t getAlignReq() { virtual size_t getAlignReq() {
return getPtrSizeBySymbol( m_symbol ); return getPtrSizeBySymbol( m_symbol );
} }
...@@ -804,6 +831,10 @@ protected: ...@@ -804,6 +831,10 @@ protected:
virtual TypeInfoPtr getClassParent(); virtual TypeInfoPtr getClassParent();
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
private: private:
SymbolPtr m_symbol; SymbolPtr m_symbol;
...@@ -880,6 +911,10 @@ public: ...@@ -880,6 +911,10 @@ public:
m_symbol = symbol; m_symbol = symbol;
} }
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
protected: protected:
SymbolPtr m_symbol; SymbolPtr m_symbol;
...@@ -959,6 +994,10 @@ public: ...@@ -959,6 +994,10 @@ public:
m_symbol = symbol; m_symbol = symbol;
} }
std::wstring getScopeName() {
return m_symbol->getScopeName();
}
protected: protected:
SymbolPtr m_symbol; SymbolPtr m_symbol;
......
...@@ -580,4 +580,15 @@ TEST_F(TypeInfoTest, GetTypeProviderFromPdb) ...@@ -580,4 +580,15 @@ TEST_F(TypeInfoTest, GetTypeProviderFromPdb)
EXPECT_EQ( L"structTest", structType->getName() ); EXPECT_EQ( L"structTest", structType->getName() );
} }
TEST_F(TypeInfoTest, GetScopeName)
{
EXPECT_EQ(L"targetapp", loadType(L"g_classChild")->getScopeName() );
EXPECT_EQ(L"targetapp", loadTypedVar(L"CdeclFuncPtr")->getType()->getScopeName() );
EXPECT_EQ(L"targetapp", loadType( L"g_structTestPtr" )->getScopeName() );
EXPECT_THROW(loadType(L"UInt4B")->getScopeName(), TypeException);
EXPECT_THROW(loadType(L"Void")->getScopeName(), TypeException);
EXPECT_THROW(loadType(L"Float*")->getScopeName(), TypeException);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment