aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/FunctionGen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/FunctionGen.cc')
-rw-r--r--lib/CodeGen/FunctionGen.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/FunctionGen.cc b/lib/CodeGen/FunctionGen.cc
index 77a37ec..99c6a1e 100644
--- a/lib/CodeGen/FunctionGen.cc
+++ b/lib/CodeGen/FunctionGen.cc
@@ -38,6 +38,10 @@ void FunctionGen::createArgumentAllocas(Function *F, const std::vector<ParamDecl
fprintf(stderr, "Error: parameter '%s' collides with an enum value\n", P.Name.c_str());
HadError = true;
}
+ if (Types.resolve(P.Name)) {
+ fprintf(stderr, "Error: parameter '%s' collides with a type name\n", P.Name.c_str());
+ HadError = true;
+ }
Value *ArgVal = &(*AI);
++AI;
ArgVal->setName(P.Name);
@@ -98,6 +102,12 @@ Function *FunctionGen::emitPrototype(PrototypeAST *Proto) {
HadError = true;
return nullptr;
}
+ if (Types.resolve(Proto->getName())) {
+ fprintf(stderr, "Error: '%s' is a type name and cannot be a FUNCTION/PROCEDURE name\n",
+ Proto->getName().c_str());
+ HadError = true;
+ return nullptr;
+ }
FuncSig Sig;
Sig.ReturnTypeName = Proto->getReturnType();