diff options
Diffstat (limited to 'idlc')
-rw-r--r-- | idlc/inc/astexpression.hxx | 2 | ||||
-rw-r--r-- | idlc/source/astexpression.cxx | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/idlc/inc/astexpression.hxx b/idlc/inc/astexpression.hxx index eec117379b6f..e9e92600bad8 100644 --- a/idlc/inc/astexpression.hxx +++ b/idlc/inc/astexpression.hxx @@ -122,7 +122,7 @@ private: std::unique_ptr<AstExprValue> eval_bin_op(); std::unique_ptr<AstExprValue> eval_bit_op(); std::unique_ptr<AstExprValue> eval_un_op(); - AstExprValue* eval_symbol(); + std::unique_ptr<AstExprValue> eval_symbol(); OString m_fileName; // fileName defined in diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx index 0840ccf756d9..8ec1f63b49df 100644 --- a/idlc/source/astexpression.cxx +++ b/idlc/source/astexpression.cxx @@ -23,6 +23,7 @@ #include <astscope.hxx> #include <errorhandler.hxx> +#include <o3tl/make_unique.hxx> #include <osl/diagnose.h> #include <limits.h> @@ -817,7 +818,7 @@ void AstExpression::evaluate() m_exprValue = eval_un_op(); break; case ExprComb::Symbol: - m_exprValue.reset( eval_symbol() ); + m_exprValue = eval_symbol(); break; case ExprComb::NONE: break; @@ -945,7 +946,7 @@ std::unique_ptr<AstExprValue> AstExpression::eval_un_op() return retval; } -AstExprValue* AstExpression::eval_symbol() +std::unique_ptr<AstExprValue> AstExpression::eval_symbol() { AstScope *pScope = nullptr; AstDeclaration *pDecl; @@ -996,7 +997,8 @@ AstExprValue* AstExpression::eval_symbol() */ pConst = static_cast< AstConstant* >(pDecl); pConst->getConstValue()->evaluate(); - return pConst->getConstValue()->getExprValue(); + auto const val = pConst->getConstValue()->getExprValue(); + return val == nullptr ? nullptr : o3tl::make_unique<AstExprValue>(*val); } OString AstExpression::toString() |