[opengtl-commits] [277] if the return type is void: don' t give to the return inst the call to the default function

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


Revision: 277
Author:   cyrille
Date:     2008-06-30 23:02:54 +0200 (Mon, 30 Jun 2008)

Log Message:
-----------
if the return type is void: don't give to the return inst the call to the default function

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp


Modified: trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp	2008-06-30 20:54:23 UTC (rev 276)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AST/FunctionDeclaration.cpp	2008-06-30 21:02:54 UTC (rev 277)
@@ -145,7 +145,12 @@
     // Make the call
     llvm::CallInst *callPrevious = llvm::CallInst::Create(previousFunction, arguments.begin(), arguments.end(), "", BB);
     callPrevious->setTailCall(true);
-    llvm::ReturnInst::Create( callPrevious , BB);
+    if( m_function->returnType()->dataType() == Type::VOID )
+    {
+      llvm::ReturnInst::Create( BB );
+    } else {
+      llvm::ReturnInst::Create( callPrevious , BB);
+    }
     previousFunction = function;
     functions[ params.size() ] = function;
   }


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