[opengtl-commits] [399] unmark variables before cleaning them

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 399
Author:   cyrille
Date:     2008-09-20 11:57:09 +0200 (Sat, 20 Sep 2008)

Log Message:
-----------
unmark variables before cleaning them

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp


Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp	2008-09-20 09:47:34 UTC (rev 398)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/Statement.cpp	2008-09-20 09:57:09 UTC (rev 399)
@@ -239,10 +239,9 @@
   if( m_returnExpr )
   {
     ExpressionResult result = m_returnExpr->generateValue( _context, _bb);
-    if( result.functionResult() )
-    {
-      _bb = Visitor::getVisitorFor( m_returnExpr->type() )->mark( _context, _bb, result.value(), m_returnExpr->type(), CodeGenerator::integerToConstant( 1 ) );
-    }
+    const GTLCore::Type* returnType = m_returnExpr->type();
+    const Visitor* visitor = Visitor::getVisitorFor( returnType );
+    _bb = visitor->mark( _context, _bb, result.value(), returnType, CodeGenerator::integerToConstant( 1 ) );
     _bb = _context.flushDelayedStatement( _bb );
     _bb = m_garbageCollectionStatement->generateStatement( _context, _bb );
     llvm::Value* resultValue = result.value();
@@ -252,8 +251,6 @@
       resultValue = _context.codeGenerator()->convertValueTo(_bb, resultValue, m_returnExpr->type(), _context.function()->returnType() );
     }
     // Mark the return value
-    const GTLCore::Type* returnType = m_returnExpr->type();
-    const Visitor* visitor = Visitor::getVisitorFor( returnType );
     _bb = visitor->mark( _context, _bb, resultValue, returnType, CodeGenerator::integerToConstant( -1 ) );
     llvm::ReturnInst::Create( resultValue, _bb);
   } else {

Modified: trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp	2008-09-20 09:47:34 UTC (rev 398)
+++ trunk/OpenGTL/OpenGTL/GTLCore/VariableNG_p.cpp	2008-09-20 09:57:09 UTC (rev 399)
@@ -159,7 +159,9 @@
 {
   if( d->allocatedInMemory and not d->constantPointer )
   {
-    _currentBlock = d->visitor->cleanUp( _generationContext, _currentBlock, pointer( _currentBlock), d->type, _donttouch, d->allocatedInMemory, true, true );
+    llvm::Value* pointer_ = pointer( _currentBlock);
+    _currentBlock = d->visitor->mark( _generationContext, _currentBlock, pointer_, d->type, CodeGenerator::integerToConstant( -1 ) );
+    _currentBlock = d->visitor->cleanUp( _generationContext, _currentBlock, pointer_, d->type, _donttouch, d->allocatedInMemory, true, true );
   }
   return _currentBlock;
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/