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 ++)
|
||||
{
|
||||
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;
|
||||
@@ -1179,7 +1180,6 @@ NameHierarchy CxxAstVisitor::getContextName(const size_t skip) const
|
||||
|
||||
bool CxxAstVisitor::checkIgnoresTypeLoc(const clang::TypeLoc& tl)
|
||||
{
|
||||
|
||||
if ((!tl.getAs<clang::TagTypeLoc>().isNull()) ||
|
||||
(!tl.getAs<clang::TypedefTypeLoc>().isNull()) ||
|
||||
(!tl.getAs<clang::TemplateTypeParmTypeLoc>().isNull()) ||
|
||||
|
||||
@@ -38,3 +38,8 @@ NameHierarchy CxxContextType::getName()
|
||||
{
|
||||
return m_nameCache->getValue(m_type);
|
||||
}
|
||||
|
||||
const clang::NamedDecl* CxxContextType::getDecl()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ class CxxContext
|
||||
public:
|
||||
virtual ~CxxContext();
|
||||
virtual NameHierarchy getName() = 0;
|
||||
virtual const clang::NamedDecl* getDecl() = 0;
|
||||
};
|
||||
|
||||
class CxxContextDecl: public CxxContext
|
||||
@@ -22,7 +23,7 @@ public:
|
||||
CxxContextDecl(const clang::NamedDecl* decl, std::shared_ptr<DeclNameCache> nameCache);
|
||||
virtual ~CxxContextDecl();
|
||||
virtual NameHierarchy getName();
|
||||
const clang::NamedDecl* getDecl();
|
||||
virtual const clang::NamedDecl* getDecl();
|
||||
|
||||
private:
|
||||
const clang::NamedDecl* m_decl;
|
||||
@@ -35,6 +36,7 @@ public:
|
||||
CxxContextType(const clang::Type* type, std::shared_ptr<TypeNameCache> nameCache);
|
||||
virtual ~CxxContextType();
|
||||
virtual NameHierarchy getName();
|
||||
virtual const clang::NamedDecl* getDecl();
|
||||
|
||||
private:
|
||||
const clang::Type* m_type;
|
||||
|
||||
Reference in New Issue
Block a user