Use mutable instead of const_cast

This commit is contained in:
Martchus 2018-02-03 16:09:31 +01:00
parent 1f571549e7
commit d1fe76f322
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ void CodeGenerator::addDeclaration(clang::Decl *decl)
void CodeGenerator::lazyInitializeSourceManager() const
{
if (factory().compilerInstance()) {
const_cast<CodeGenerator *>(this)->m_sourceManager = &factory().compilerInstance()->getSourceManager();
m_sourceManager = &factory().compilerInstance()->getSourceManager();
}
}

View File

@ -36,7 +36,7 @@ protected:
private:
CodeFactory &m_factory;
const clang::SourceManager *m_sourceManager;
mutable const clang::SourceManager *m_sourceManager;
};
inline CodeGenerator::CodeGenerator(CodeFactory &factory)