source: removed typecast from CxxAstVisitor
This commit is contained in:
@@ -1160,9 +1160,10 @@ const clang::NamedDecl* CxxAstVisitor::getTopmostContextDecl() const
|
|||||||
{
|
{
|
||||||
for (std::vector<std::shared_ptr<CxxContext>>::const_reverse_iterator it = m_contextStack.rbegin(); it != m_contextStack.rend(); it ++)
|
for (std::vector<std::shared_ptr<CxxContext>>::const_reverse_iterator it = m_contextStack.rbegin(); it != m_contextStack.rend(); it ++)
|
||||||
{
|
{
|
||||||
if (std::shared_ptr<CxxContextDecl> context = std::dynamic_pointer_cast<CxxContextDecl>(*it))
|
const clang::NamedDecl* decl = (*it)->getDecl();
|
||||||
|
if (decl)
|
||||||
{
|
{
|
||||||
return context->getDecl();
|
return decl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -1179,7 +1180,6 @@ NameHierarchy CxxAstVisitor::getContextName(const size_t skip) const
|
|||||||
|
|
||||||
bool CxxAstVisitor::checkIgnoresTypeLoc(const clang::TypeLoc& tl)
|
bool CxxAstVisitor::checkIgnoresTypeLoc(const clang::TypeLoc& tl)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((!tl.getAs<clang::TagTypeLoc>().isNull()) ||
|
if ((!tl.getAs<clang::TagTypeLoc>().isNull()) ||
|
||||||
(!tl.getAs<clang::TypedefTypeLoc>().isNull()) ||
|
(!tl.getAs<clang::TypedefTypeLoc>().isNull()) ||
|
||||||
(!tl.getAs<clang::TemplateTypeParmTypeLoc>().isNull()) ||
|
(!tl.getAs<clang::TemplateTypeParmTypeLoc>().isNull()) ||
|
||||||
|
|||||||
@@ -38,3 +38,8 @@ NameHierarchy CxxContextType::getName()
|
|||||||
{
|
{
|
||||||
return m_nameCache->getValue(m_type);
|
return m_nameCache->getValue(m_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const clang::NamedDecl* CxxContextType::getDecl()
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class CxxContext
|
|||||||
public:
|
public:
|
||||||
virtual ~CxxContext();
|
virtual ~CxxContext();
|
||||||
virtual NameHierarchy getName() = 0;
|
virtual NameHierarchy getName() = 0;
|
||||||
|
virtual const clang::NamedDecl* getDecl() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CxxContextDecl: public CxxContext
|
class CxxContextDecl: public CxxContext
|
||||||
@@ -22,7 +23,7 @@ public:
|
|||||||
CxxContextDecl(const clang::NamedDecl* decl, std::shared_ptr<DeclNameCache> nameCache);
|
CxxContextDecl(const clang::NamedDecl* decl, std::shared_ptr<DeclNameCache> nameCache);
|
||||||
virtual ~CxxContextDecl();
|
virtual ~CxxContextDecl();
|
||||||
virtual NameHierarchy getName();
|
virtual NameHierarchy getName();
|
||||||
const clang::NamedDecl* getDecl();
|
virtual const clang::NamedDecl* getDecl();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const clang::NamedDecl* m_decl;
|
const clang::NamedDecl* m_decl;
|
||||||
@@ -35,6 +36,7 @@ public:
|
|||||||
CxxContextType(const clang::Type* type, std::shared_ptr<TypeNameCache> nameCache);
|
CxxContextType(const clang::Type* type, std::shared_ptr<TypeNameCache> nameCache);
|
||||||
virtual ~CxxContextType();
|
virtual ~CxxContextType();
|
||||||
virtual NameHierarchy getName();
|
virtual NameHierarchy getName();
|
||||||
|
virtual const clang::NamedDecl* getDecl();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const clang::Type* m_type;
|
const clang::Type* m_type;
|
||||||
|
|||||||
Reference in New Issue
Block a user