downcast of address which does not point to an object of type 'AstInterface'

(note: object is of type 'AstTypeDef'); Clang -fsanitize=undefined

Change-Id: I1b11a7678f18557c8040af2118c1c0101913f086
This commit is contained in:
Stephan Bergmann
2013-08-14 16:05:07 +02:00
parent d239ee4fa4
commit 4ef1f4ae49
3 changed files with 8 additions and 8 deletions

View File

@@ -33,15 +33,15 @@ public:
AstStruct( AstStruct(
const OString& name, const OString& name,
std::vector< OString > const & typeParameters, std::vector< OString > const & typeParameters,
AstStruct* pBaseType, AstScope* pScope); AstStruct const* pBaseType, AstScope* pScope);
AstStruct(const NodeType type, AstStruct(const NodeType type,
const OString& name, const OString& name,
AstStruct* pBaseType, AstStruct const* pBaseType,
AstScope* pScope); AstScope* pScope);
virtual ~AstStruct(); virtual ~AstStruct();
AstStruct* getBaseType() AstStruct const* getBaseType()
{ return m_pBaseType; } { return m_pBaseType; }
DeclList::size_type getTypeParameterCount() const DeclList::size_type getTypeParameterCount() const
@@ -53,7 +53,7 @@ public:
virtual sal_Bool dump(RegistryKey& rKey); virtual sal_Bool dump(RegistryKey& rKey);
private: private:
AstStruct* m_pBaseType; AstStruct const* m_pBaseType;
DeclList m_typeParameters; DeclList m_typeParameters;
}; };

View File

@@ -27,7 +27,7 @@ using namespace ::rtl;
AstStruct::AstStruct( AstStruct::AstStruct(
const OString& name, std::vector< OString > const & typeParameters, const OString& name, std::vector< OString > const & typeParameters,
AstStruct* pBaseType, AstScope* pScope) AstStruct const* pBaseType, AstScope* pScope)
: AstType(NT_struct, name, pScope) : AstType(NT_struct, name, pScope)
, AstScope(NT_struct) , AstScope(NT_struct)
, m_pBaseType(pBaseType) , m_pBaseType(pBaseType)
@@ -42,7 +42,7 @@ AstStruct::AstStruct(
AstStruct::AstStruct(const NodeType type, AstStruct::AstStruct(const NodeType type,
const OString& name, const OString& name,
AstStruct* pBaseType, AstStruct const* pBaseType,
AstScope* pScope) AstScope* pScope)
: AstType(type, name, pScope) : AstType(type, name, pScope)
, AstScope(type) , AstScope(type)

View File

@@ -582,7 +582,7 @@ interface_dcl :
{ {
pInterface = new AstInterface( pInterface = new AstInterface(
*$1->getName(), *$1->getName(),
static_cast< AstInterface * >($1->getInherits()), pScope); static_cast< AstInterface const * >(resolveTypedefs($1->getInherits())), pScope);
if ( pInterface && if ( pInterface &&
(pDecl = pScope->lookupByName(pInterface->getScopedName())) ) (pDecl = pScope->lookupByName(pInterface->getScopedName())) )
{ {
@@ -2586,7 +2586,7 @@ struct_type :
if ( pScope ) if ( pScope )
{ {
AstStruct* pBase= static_cast< AstStruct* >($1->getInherits()); AstStruct const* pBase= static_cast< AstStruct const* >(resolveTypedefs($1->getInherits()));
pStruct = new AstStruct( pStruct = new AstStruct(
*$1->getName(), $1->getTypeParameters(), pBase, pScope); *$1->getName(), $1->getTypeParameters(), pBase, pScope);
pScope->addDeclaration(pStruct); pScope->addDeclaration(pStruct);