From a5bb6eff8672f5a6e7ed1f885f69ca8434db6ce7 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sun, 27 Sep 2015 19:23:05 +0200 Subject: Return unique_ptr from AstExpression::eval_* functions ...generally, idlc leaks most memory, and e.g. trying to turn AstExpression::m_exprValue into a unique_ptr would fail because AstExpression::eval_symbol returns a pointer to an object "owned" elsewhere (but never actually deleted by its owner). So improvement of idlc ends here---for one, it does not improve anything to try and make idlc not leak memory, and for another, idlc is doomed to go away anyway. Change-Id: I36f54130c8bfd1933126ae7f8a982e50d9bc616e --- idlc/inc/idlc/astexpression.hxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'idlc/inc') diff --git a/idlc/inc/idlc/astexpression.hxx b/idlc/inc/idlc/astexpression.hxx index deb0da48d211..6723297e2551 100644 --- a/idlc/inc/idlc/astexpression.hxx +++ b/idlc/inc/idlc/astexpression.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_IDLC_INC_IDLC_ASTEXPRESSION_HXX #define INCLUDED_IDLC_INC_IDLC_ASTEXPRESSION_HXX +#include + +#include + #include // Enum to define all the different operators to combine expressions @@ -120,9 +124,9 @@ private: // Fill out the lineno, filename and definition scope details void fillDefinitionDetails(); // Evaluate different sets of operators - AstExprValue* eval_bin_op(); - AstExprValue* eval_bit_op(); - AstExprValue* eval_un_op(); + std::unique_ptr eval_bin_op(); + std::unique_ptr eval_bit_op(); + std::unique_ptr eval_un_op(); AstExprValue* eval_symbol(); AstScope* m_pScope; // scope defined in -- cgit