aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/ExpressionGen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/ExpressionGen.cc')
-rw-r--r--lib/CodeGen/ExpressionGen.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/ExpressionGen.cc b/lib/CodeGen/ExpressionGen.cc
index 0a24c8d..9ea79d8 100644
--- a/lib/CodeGen/ExpressionGen.cc
+++ b/lib/CodeGen/ExpressionGen.cc
@@ -192,6 +192,13 @@ Value *CodeGen::emitCall(const std::string &Callee,
if (!Size) return nullptr;
return Memory->emitAllocate(Size, Line);
}
+ if (Name == "REALLOC") {
+ Value *Address = emitCoercedExpr(ArgExprs[0].get(), resolveType("C_TYPE(\"void*\")"));
+ if (!Address) return nullptr;
+ Value *Size = emitAllocationSize(ArgExprs[1].get());
+ if (!Size) return nullptr;
+ return Memory->emitResize(Address, Size, Line);
+ }
if (Name == "FREE") {
Value *Address = emitCoercedExpr(ArgExprs[0].get(), resolveType("C_TYPE(\"void*\")"));
if (!Address) return nullptr;