Update to r245397.

`ast_transformer` could be null, in which case we should initialize
`m_code_generator` with the ASTContext.

llvm-svn: 245398
This commit is contained in:
Chaoren Lin 2015-08-19 01:24:57 +00:00
parent 453930d7c3
commit 57998de165
1 changed files with 7 additions and 2 deletions

View File

@ -410,15 +410,20 @@ ClangExpressionParser::Parse (Stream &stream)
diag_buf->BeginSourceFile(m_compiler->getLangOpts(), &m_compiler->getPreprocessor());
ASTConsumer *ast_transformer = m_expr.ASTTransformer(m_code_generator.get());
ast_transformer->Initialize(m_compiler->getASTContext());
if (ClangExpressionDeclMap *decl_map = m_expr.DeclMap())
decl_map->InstallCodeGenerator(m_code_generator.get());
if (ast_transformer)
{
ast_transformer->Initialize(m_compiler->getASTContext());
ParseAST(m_compiler->getPreprocessor(), ast_transformer, m_compiler->getASTContext());
}
else
{
m_code_generator->Initialize(m_compiler->getASTContext());
ParseAST(m_compiler->getPreprocessor(), m_code_generator.get(), m_compiler->getASTContext());
}
diag_buf->EndSourceFile();