llvm.org GIT mirror llvm / d7b240a
[Kaleidoscope] Fix 'Error' name clashes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264426 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 3 years ago
5 changed file(s) with 103 addition(s) and 103 deletion(s). Raw diff Collapse all Expand all
175175
176176 switch (CurTok) {
177177 default:
178 return ErrorP("Expected function name in prototype");
178 return LogErrorP("Expected function name in prototype");
179179 case tok_identifier:
180180 FnName = IdentifierStr;
181181 Kind = 0;
184184 case tok_binary:
185185 getNextToken();
186186 if (!isascii(CurTok))
187 return ErrorP("Expected binary operator");
187 return LogErrorP("Expected binary operator");
188188 FnName = "binary";
189189 FnName += (char)CurTok;
190190 Kind = 2;
193193 // Read the precedence if present.
194194 if (CurTok == tok_number) {
195195 if (NumVal < 1 || NumVal > 100)
196 return ErrorP("Invalid precedecnce: must be 1..100");
196 return LogErrorP("Invalid precedecnce: must be 1..100");
197197 BinaryPrecedence = (unsigned)NumVal;
198198 getNextToken();
199199 }
201201 }
202202
203203 if (CurTok != '(')
204 return ErrorP("Expected '(' in prototype");
204 return LogErrorP("Expected '(' in prototype");
205205
206206 std::vector ArgNames;
207207 while (getNextToken() == tok_identifier)
208208 ArgNames.push_back(IdentifierStr);
209209 if (CurTok != ')')
210 return ErrorP("Expected ')' in prototype");
210 return LogErrorP("Expected ')' in prototype");
211211
212212 // success.
213213 getNextToken(); // eat ')'.
214214
215215 // Verify right number of names for operator.
216216 if (Kind && ArgNames.size() != Kind)
217 return ErrorP("Invalid number of operands for operator");
217 return LogErrorP("Invalid number of operands for operator");
218218
219219 return llvm::make_unique(FnName, std::move(ArgNames), Kind != 0,
220220 BinaryPrecedence);
402402
403403 switch (CurTok) {
404404 default:
405 return ErrorP("Expected function name in prototype");
405 return LogErrorP("Expected function name in prototype");
406406 case tok_identifier:
407407 FnName = IdentifierStr;
408408 Kind = 0;
411411 case tok_unary:
412412 getNextToken();
413413 if (!isascii(CurTok))
414 return ErrorP("Expected unary operator");
414 return LogErrorP("Expected unary operator");
415415 FnName = "unary";
416416 FnName += (char)CurTok;
417417 Kind = 1;
434434
435435 Function *F = TheModule->getFunction(std::string("unary")+Opcode);
436436 if (!F)
437 return ErrorV("Unknown unary operator");
437 return LogErrorV("Unknown unary operator");
438438
439439 return Builder.CreateCall(F, OperandV, "unop");
440440 }
358358 // Look this variable up in the function.
359359 Value *V = NamedValues[Name];
360360 if (!V)
361 return ErrorV("Unknown variable name");
361 return LogErrorV("Unknown variable name");
362362
363363 // Load the value.
364364 return Builder.CreateLoad(V, Name.c_str());
577577 // Assignment requires the LHS to be an identifier.
578578 VariableExprAST *LHSE = dynamic_cast(LHS.get());
579579 if (!LHSE)
580 return ErrorV("destination of '=' must be a variable");
580 return LogErrorV("destination of '=' must be a variable");
581581
582582 Unlike the rest of the binary operators, our assignment operator doesn't
583583 follow the "emit LHS, emit RHS, do computation" model. As such, it is
596596 // Look up the name.
597597 Value *Variable = NamedValues[LHSE->getName()];
598598 if (!Variable)
599 return ErrorV("Unknown variable name");
599 return LogErrorV("Unknown variable name");
600600
601601 Builder.CreateStore(Val, Variable);
602602 return Val;
702702 static std::unique_ptr ParsePrimary() {
703703 switch (CurTok) {
704704 default:
705 return Error("unknown token when expecting an expression");
705 return LogError("unknown token when expecting an expression");
706706 case tok_identifier:
707707 return ParseIdentifierExpr();
708708 case tok_number:
731731
732732 // At least one variable name is required.
733733 if (CurTok != tok_identifier)
734 return Error("expected identifier after var");
734 return LogError("expected identifier after var");
735735
736736 The first part of this code parses the list of identifier/expr pairs
737737 into the local ``VarNames`` vector.
758758 getNextToken(); // eat the ','.
759759
760760 if (CurTok != tok_identifier)
761 return Error("expected identifier list after var");
761 return LogError("expected identifier list after var");
762762 }
763763
764764 Once all the variables are parsed, we then parse the body and create the
768768
769769 // At this point, we have to have 'in'.
770770 if (CurTok != tok_in)
771 return Error("expected 'in' keyword after 'var'");
771 return LogError("expected 'in' keyword after 'var'");
772772 getNextToken(); // eat 'in'.
773773
774774 auto Body = ParseExpression();
271271 }
272272
273273 /// Error* - These are little helper functions for error handling.
274 std::unique_ptr Error(const char *Str) {
274 std::unique_ptr LogError(const char *Str) {
275275 fprintf(stderr, "Error: %s\n", Str);
276276 return nullptr;
277277 }
278278
279 std::unique_ptr ErrorP(const char *Str) {
280 Error(Str);
279 std::unique_ptr LogErrorP(const char *Str) {
280 LogError(Str);
281281 return nullptr;
282282 }
283283
298298 return nullptr;
299299
300300 if (CurTok != ')')
301 return Error("expected ')'");
301 return LogError("expected ')'");
302302 getNextToken(); // eat ).
303303 return V;
304304 }
328328 break;
329329
330330 if (CurTok != ',')
331 return Error("Expected ')' or ',' in argument list");
331 return LogError("Expected ')' or ',' in argument list");
332332 getNextToken();
333333 }
334334 }
349349 return nullptr;
350350
351351 if (CurTok != tok_then)
352 return Error("expected then");
352 return LogError("expected then");
353353 getNextToken(); // eat the then
354354
355355 auto Then = ParseExpression();
357357 return nullptr;
358358
359359 if (CurTok != tok_else)
360 return Error("expected else");
360 return LogError("expected else");
361361
362362 getNextToken();
363363
374374 getNextToken(); // eat the for.
375375
376376 if (CurTok != tok_identifier)
377 return Error("expected identifier after for");
377 return LogError("expected identifier after for");
378378
379379 std::string IdName = IdentifierStr;
380380 getNextToken(); // eat identifier.
381381
382382 if (CurTok != '=')
383 return Error("expected '=' after for");
383 return LogError("expected '=' after for");
384384 getNextToken(); // eat '='.
385385
386386 auto Start = ParseExpression();
387387 if (!Start)
388388 return nullptr;
389389 if (CurTok != ',')
390 return Error("expected ',' after for start value");
390 return LogError("expected ',' after for start value");
391391 getNextToken();
392392
393393 auto End = ParseExpression();
404404 }
405405
406406 if (CurTok != tok_in)
407 return Error("expected 'in' after for");
407 return LogError("expected 'in' after for");
408408 getNextToken(); // eat 'in'.
409409
410410 auto Body = ParseExpression();
424424 static std::unique_ptr ParsePrimary() {
425425 switch (CurTok) {
426426 default:
427 return Error("unknown token when expecting an expression");
427 return LogError("unknown token when expecting an expression");
428428 case tok_identifier:
429429 return ParseIdentifierExpr();
430430 case tok_number:
514514
515515 switch (CurTok) {
516516 default:
517 return ErrorP("Expected function name in prototype");
517 return LogErrorP("Expected function name in prototype");
518518 case tok_identifier:
519519 FnName = IdentifierStr;
520520 Kind = 0;
523523 case tok_unary:
524524 getNextToken();
525525 if (!isascii(CurTok))
526 return ErrorP("Expected unary operator");
526 return LogErrorP("Expected unary operator");
527527 FnName = "unary";
528528 FnName += (char)CurTok;
529529 Kind = 1;
532532 case tok_binary:
533533 getNextToken();
534534 if (!isascii(CurTok))
535 return ErrorP("Expected binary operator");
535 return LogErrorP("Expected binary operator");
536536 FnName = "binary";
537537 FnName += (char)CurTok;
538538 Kind = 2;
541541 // Read the precedence if present.
542542 if (CurTok == tok_number) {
543543 if (NumVal < 1 || NumVal > 100)
544 return ErrorP("Invalid precedecnce: must be 1..100");
544 return LogErrorP("Invalid precedecnce: must be 1..100");
545545 BinaryPrecedence = (unsigned)NumVal;
546546 getNextToken();
547547 }
549549 }
550550
551551 if (CurTok != '(')
552 return ErrorP("Expected '(' in prototype");
552 return LogErrorP("Expected '(' in prototype");
553553
554554 std::vector ArgNames;
555555 while (getNextToken() == tok_identifier)
556556 ArgNames.push_back(IdentifierStr);
557557 if (CurTok != ')')
558 return ErrorP("Expected ')' in prototype");
558 return LogErrorP("Expected ')' in prototype");
559559
560560 // success.
561561 getNextToken(); // eat ')'.
562562
563563 // Verify right number of names for operator.
564564 if (Kind && ArgNames.size() != Kind)
565 return ErrorP("Invalid number of operands for operator");
565 return LogErrorP("Invalid number of operands for operator");
566566
567567 return llvm::make_unique(FnName, ArgNames, Kind != 0,
568568 BinaryPrecedence);
608608 static std::unique_ptr TheJIT;
609609 static std::map> FunctionProtos;
610610
611 Value *ErrorV(const char *Str) {
612 Error(Str);
611 Value *LogErrorV(const char *Str) {
612 LogError(Str);
613613 return nullptr;
614614 }
615615
636636 // Look this variable up in the function.
637637 Value *V = NamedValues[Name];
638638 if (!V)
639 return ErrorV("Unknown variable name");
639 return LogErrorV("Unknown variable name");
640640 return V;
641641 }
642642
647647
648648 Function *F = getFunction(std::string("unary") + Opcode);
649649 if (!F)
650 return ErrorV("Unknown unary operator");
650 return LogErrorV("Unknown unary operator");
651651
652652 return Builder.CreateCall(F, OperandV, "unop");
653653 }
687687 // Look up the name in the global module table.
688688 Function *CalleeF = getFunction(Callee);
689689 if (!CalleeF)
690 return ErrorV("Unknown function referenced");
690 return LogErrorV("Unknown function referenced");
691691
692692 // If argument mismatch error.
693693 if (CalleeF->arg_size() != Args.size())
694 return ErrorV("Incorrect # arguments passed");
694 return LogErrorV("Incorrect # arguments passed");
695695
696696 std::vector ArgsV;
697697 for (unsigned i = 0, e = Args.size(); i != e; ++i) {
289289 return TokPrec;
290290 }
291291
292 /// Error* - These are little helper functions for error handling.
293 std::unique_ptr Error(const char *Str) {
292 /// LogError* - These are little helper functions for error handling.
293 std::unique_ptr LogError(const char *Str) {
294294 fprintf(stderr, "Error: %s\n", Str);
295295 return nullptr;
296296 }
297297
298 std::unique_ptr ErrorP(const char *Str) {
299 Error(Str);
298 std::unique_ptr LogErrorP(const char *Str) {
299 LogError(Str);
300300 return nullptr;
301301 }
302302
317317 return nullptr;
318318
319319 if (CurTok != ')')
320 return Error("expected ')'");
320 return LogError("expected ')'");
321321 getNextToken(); // eat ).
322322 return V;
323323 }
347347 break;
348348
349349 if (CurTok != ',')
350 return Error("Expected ')' or ',' in argument list");
350 return LogError("Expected ')' or ',' in argument list");
351351 getNextToken();
352352 }
353353 }
368368 return nullptr;
369369
370370 if (CurTok != tok_then)
371 return Error("expected then");
371 return LogError("expected then");
372372 getNextToken(); // eat the then
373373
374374 auto Then = ParseExpression();
376376 return nullptr;
377377
378378 if (CurTok != tok_else)
379 return Error("expected else");
379 return LogError("expected else");
380380
381381 getNextToken();
382382
393393 getNextToken(); // eat the for.
394394
395395 if (CurTok != tok_identifier)
396 return Error("expected identifier after for");
396 return LogError("expected identifier after for");
397397
398398 std::string IdName = IdentifierStr;
399399 getNextToken(); // eat identifier.
400400
401401 if (CurTok != '=')
402 return Error("expected '=' after for");
402 return LogError("expected '=' after for");
403403 getNextToken(); // eat '='.
404404
405405 auto Start = ParseExpression();
406406 if (!Start)
407407 return nullptr;
408408 if (CurTok != ',')
409 return Error("expected ',' after for start value");
409 return LogError("expected ',' after for start value");
410410 getNextToken();
411411
412412 auto End = ParseExpression();
423423 }
424424
425425 if (CurTok != tok_in)
426 return Error("expected 'in' after for");
426 return LogError("expected 'in' after for");
427427 getNextToken(); // eat 'in'.
428428
429429 auto Body = ParseExpression();
443443
444444 // At least one variable name is required.
445445 if (CurTok != tok_identifier)
446 return Error("expected identifier after var");
446 return LogError("expected identifier after var");
447447
448448 while (1) {
449449 std::string Name = IdentifierStr;
467467 getNextToken(); // eat the ','.
468468
469469 if (CurTok != tok_identifier)
470 return Error("expected identifier list after var");
470 return LogError("expected identifier list after var");
471471 }
472472
473473 // At this point, we have to have 'in'.
474474 if (CurTok != tok_in)
475 return Error("expected 'in' keyword after 'var'");
475 return LogError("expected 'in' keyword after 'var'");
476476 getNextToken(); // eat 'in'.
477477
478478 auto Body = ParseExpression();
492492 static std::unique_ptr ParsePrimary() {
493493 switch (CurTok) {
494494 default:
495 return Error("unknown token when expecting an expression");
495 return LogError("unknown token when expecting an expression");
496496 case tok_identifier:
497497 return ParseIdentifierExpr();
498498 case tok_number:
584584
585585 switch (CurTok) {
586586 default:
587 return ErrorP("Expected function name in prototype");
587 return LogErrorP("Expected function name in prototype");
588588 case tok_identifier:
589589 FnName = IdentifierStr;
590590 Kind = 0;
593593 case tok_unary:
594594 getNextToken();
595595 if (!isascii(CurTok))
596 return ErrorP("Expected unary operator");
596 return LogErrorP("Expected unary operator");
597597 FnName = "unary";
598598 FnName += (char)CurTok;
599599 Kind = 1;
602602 case tok_binary:
603603 getNextToken();
604604 if (!isascii(CurTok))
605 return ErrorP("Expected binary operator");
605 return LogErrorP("Expected binary operator");
606606 FnName = "binary";
607607 FnName += (char)CurTok;
608608 Kind = 2;
611611 // Read the precedence if present.
612612 if (CurTok == tok_number) {
613613 if (NumVal < 1 || NumVal > 100)
614 return ErrorP("Invalid precedecnce: must be 1..100");
614 return LogErrorP("Invalid precedecnce: must be 1..100");
615615 BinaryPrecedence = (unsigned)NumVal;
616616 getNextToken();
617617 }
619619 }
620620
621621 if (CurTok != '(')
622 return ErrorP("Expected '(' in prototype");
622 return LogErrorP("Expected '(' in prototype");
623623
624624 std::vector ArgNames;
625625 while (getNextToken() == tok_identifier)
626626 ArgNames.push_back(IdentifierStr);
627627 if (CurTok != ')')
628 return ErrorP("Expected ')' in prototype");
628 return LogErrorP("Expected ')' in prototype");
629629
630630 // success.
631631 getNextToken(); // eat ')'.
632632
633633 // Verify right number of names for operator.
634634 if (Kind && ArgNames.size() != Kind)
635 return ErrorP("Invalid number of operands for operator");
635 return LogErrorP("Invalid number of operands for operator");
636636
637637 return llvm::make_unique(FnName, ArgNames, Kind != 0,
638638 BinaryPrecedence);
678678 static std::unique_ptr TheJIT;
679679 static std::map> FunctionProtos;
680680
681 Value *ErrorV(const char *Str) {
682 Error(Str);
681 Value *LogErrorV(const char *Str) {
682 LogError(Str);
683683 return nullptr;
684684 }
685685
716716 // Look this variable up in the function.
717717 Value *V = NamedValues[Name];
718718 if (!V)
719 return ErrorV("Unknown variable name");
719 return LogErrorV("Unknown variable name");
720720
721721 // Load the value.
722722 return Builder.CreateLoad(V, Name.c_str());
729729
730730 Function *F = getFunction(std::string("unary") + Opcode);
731731 if (!F)
732 return ErrorV("Unknown unary operator");
732 return LogErrorV("Unknown unary operator");
733733
734734 return Builder.CreateCall(F, OperandV, "unop");
735735 }
743743 // dynamic_cast for automatic error checking.
744744 VariableExprAST *LHSE = static_cast(LHS.get());
745745 if (!LHSE)
746 return ErrorV("destination of '=' must be a variable");
746 return LogErrorV("destination of '=' must be a variable");
747747 // Codegen the RHS.
748748 Value *Val = RHS->codegen();
749749 if (!Val)
752752 // Look up the name.
753753 Value *Variable = NamedValues[LHSE->getName()];
754754 if (!Variable)
755 return ErrorV("Unknown variable name");
755 return LogErrorV("Unknown variable name");
756756
757757 Builder.CreateStore(Val, Variable);
758758 return Val;
792792 // Look up the name in the global module table.
793793 Function *CalleeF = getFunction(Callee);
794794 if (!CalleeF)
795 return ErrorV("Unknown function referenced");
795 return LogErrorV("Unknown function referenced");
796796
797797 // If argument mismatch error.
798798 if (CalleeF->arg_size() != Args.size())
799 return ErrorV("Incorrect # arguments passed");
799 return LogErrorV("Incorrect # arguments passed");
800800
801801 std::vector ArgsV;
802802 for (unsigned i = 0, e = Args.size(); i != e; ++i) {
425425 return TokPrec;
426426 }
427427
428 /// Error* - These are little helper functions for error handling.
429 std::unique_ptr Error(const char *Str) {
428 /// LogError* - These are little helper functions for error handling.
429 std::unique_ptr LogError(const char *Str) {
430430 fprintf(stderr, "Error: %s\n", Str);
431431 return nullptr;
432432 }
433433
434 std::unique_ptr ErrorP(const char *Str) {
435 Error(Str);
434 std::unique_ptr LogErrorP(const char *Str) {
435 LogError(Str);
436436 return nullptr;
437437 }
438438
453453 return nullptr;
454454
455455 if (CurTok != ')')
456 return Error("expected ')'");
456 return LogError("expected ')'");
457457 getNextToken(); // eat ).
458458 return V;
459459 }
485485 break;
486486
487487 if (CurTok != ',')
488 return Error("Expected ')' or ',' in argument list");
488 return LogError("Expected ')' or ',' in argument list");
489489 getNextToken();
490490 }
491491 }
508508 return nullptr;
509509
510510 if (CurTok != tok_then)
511 return Error("expected then");
511 return LogError("expected then");
512512 getNextToken(); // eat the then
513513
514514 auto Then = ParseExpression();
516516 return nullptr;
517517
518518 if (CurTok != tok_else)
519 return Error("expected else");
519 return LogError("expected else");
520520
521521 getNextToken();
522522
533533 getNextToken(); // eat the for.
534534
535535 if (CurTok != tok_identifier)
536 return Error("expected identifier after for");
536 return LogError("expected identifier after for");
537537
538538 std::string IdName = IdentifierStr;
539539 getNextToken(); // eat identifier.
540540
541541 if (CurTok != '=')
542 return Error("expected '=' after for");
542 return LogError("expected '=' after for");
543543 getNextToken(); // eat '='.
544544
545545 auto Start = ParseExpression();
546546 if (!Start)
547547 return nullptr;
548548 if (CurTok != ',')
549 return Error("expected ',' after for start value");
549 return LogError("expected ',' after for start value");
550550 getNextToken();
551551
552552 auto End = ParseExpression();
563563 }
564564
565565 if (CurTok != tok_in)
566 return Error("expected 'in' after for");
566 return LogError("expected 'in' after for");
567567 getNextToken(); // eat 'in'.
568568
569569 auto Body = ParseExpression();
583583
584584 // At least one variable name is required.
585585 if (CurTok != tok_identifier)
586 return Error("expected identifier after var");
586 return LogError("expected identifier after var");
587587
588588 while (1) {
589589 std::string Name = IdentifierStr;
607607 getNextToken(); // eat the ','.
608608
609609 if (CurTok != tok_identifier)
610 return Error("expected identifier list after var");
610 return LogError("expected identifier list after var");
611611 }
612612
613613 // At this point, we have to have 'in'.
614614 if (CurTok != tok_in)
615 return Error("expected 'in' keyword after 'var'");
615 return LogError("expected 'in' keyword after 'var'");
616616 getNextToken(); // eat 'in'.
617617
618618 auto Body = ParseExpression();
632632 static std::unique_ptr ParsePrimary() {
633633 switch (CurTok) {
634634 default:
635 return Error("unknown token when expecting an expression");
635 return LogError("unknown token when expecting an expression");
636636 case tok_identifier:
637637 return ParseIdentifierExpr();
638638 case tok_number:
727727
728728 switch (CurTok) {
729729 default:
730 return ErrorP("Expected function name in prototype");
730 return LogErrorP("Expected function name in prototype");
731731 case tok_identifier:
732732 FnName = IdentifierStr;
733733 Kind = 0;
736736 case tok_unary:
737737 getNextToken();
738738 if (!isascii(CurTok))
739 return ErrorP("Expected unary operator");
739 return LogErrorP("Expected unary operator");
740740 FnName = "unary";
741741 FnName += (char)CurTok;
742742 Kind = 1;
745745 case tok_binary:
746746 getNextToken();
747747 if (!isascii(CurTok))
748 return ErrorP("Expected binary operator");
748 return LogErrorP("Expected binary operator");
749749 FnName = "binary";
750750 FnName += (char)CurTok;
751751 Kind = 2;
754754 // Read the precedence if present.
755755 if (CurTok == tok_number) {
756756 if (NumVal < 1 || NumVal > 100)
757 return ErrorP("Invalid precedecnce: must be 1..100");
757 return LogErrorP("Invalid precedecnce: must be 1..100");
758758 BinaryPrecedence = (unsigned)NumVal;
759759 getNextToken();
760760 }
762762 }
763763
764764 if (CurTok != '(')
765 return ErrorP("Expected '(' in prototype");
765 return LogErrorP("Expected '(' in prototype");
766766
767767 std::vector ArgNames;
768768 while (getNextToken() == tok_identifier)
769769 ArgNames.push_back(IdentifierStr);
770770 if (CurTok != ')')
771 return ErrorP("Expected ')' in prototype");
771 return LogErrorP("Expected ')' in prototype");
772772
773773 // success.
774774 getNextToken(); // eat ')'.
775775
776776 // Verify right number of names for operator.
777777 if (Kind && ArgNames.size() != Kind)
778 return ErrorP("Invalid number of operands for operator");
778 return LogErrorP("Invalid number of operands for operator");
779779
780780 return llvm::make_unique(FnLoc, FnName, ArgNames, Kind != 0,
781781 BinaryPrecedence);
859859 static std::unique_ptr TheJIT;
860860 static std::map> FunctionProtos;
861861
862 Value *ErrorV(const char *Str) {
863 Error(Str);
862 Value *LogErrorV(const char *Str) {
863 LogError(Str);
864864 return nullptr;
865865 }
866866
898898 // Look this variable up in the function.
899899 Value *V = NamedValues[Name];
900900 if (!V)
901 return ErrorV("Unknown variable name");
901 return LogErrorV("Unknown variable name");
902902
903903 KSDbgInfo.emitLocation(this);
904904 // Load the value.
912912
913913 Function *F = getFunction(std::string("unary") + Opcode);
914914 if (!F)
915 return ErrorV("Unknown unary operator");
915 return LogErrorV("Unknown unary operator");
916916
917917 KSDbgInfo.emitLocation(this);
918918 return Builder.CreateCall(F, OperandV, "unop");
929929 // dynamic_cast for automatic error checking.
930930 VariableExprAST *LHSE = static_cast(LHS.get());
931931 if (!LHSE)
932 return ErrorV("destination of '=' must be a variable");
932 return LogErrorV("destination of '=' must be a variable");
933933 // Codegen the RHS.
934934 Value *Val = RHS->codegen();
935935 if (!Val)
938938 // Look up the name.
939939 Value *Variable = NamedValues[LHSE->getName()];
940940 if (!Variable)
941 return ErrorV("Unknown variable name");
941 return LogErrorV("Unknown variable name");
942942
943943 Builder.CreateStore(Val, Variable);
944944 return Val;
980980 // Look up the name in the global module table.
981981 Function *CalleeF = getFunction(Callee);
982982 if (!CalleeF)
983 return ErrorV("Unknown function referenced");
983 return LogErrorV("Unknown function referenced");
984984
985985 // If argument mismatch error.
986986 if (CalleeF->arg_size() != Args.size())
987 return ErrorV("Incorrect # arguments passed");
987 return LogErrorV("Incorrect # arguments passed");
988988
989989 std::vector ArgsV;
990990 for (unsigned i = 0, e = Args.size(); i != e; ++i) {