diff --git a/.run/spice.run.xml b/.run/spice.run.xml index 13bbfd476..307ec2696 100644 --- a/.run/spice.run.xml +++ b/.run/spice.run.xml @@ -1,5 +1,5 @@ - + diff --git a/src/ast/ASTBuilder.cpp b/src/ast/ASTBuilder.cpp index 2b9dfa2c6..43e7b390c 100644 --- a/src/ast/ASTBuilder.cpp +++ b/src/ast/ASTBuilder.cpp @@ -791,7 +791,7 @@ std::any ASTBuilder::visitCastExpr(SpiceParser::CastExprContext *ctx) { auto castExprNode = createNode(ctx); // Enrich - castExprNode->isCasted = ctx->LPAREN(); + castExprNode->isCast = ctx->LPAREN(); // Visit children visitChildren(ctx); diff --git a/src/ast/ASTNodes.h b/src/ast/ASTNodes.h index b62e6e212..ef01be3f3 100644 --- a/src/ast/ASTNodes.h +++ b/src/ast/ASTNodes.h @@ -1581,7 +1581,7 @@ class CastExprNode : public ASTNode { [[nodiscard]] CompileTimeValue getCompileTimeValue() const override; // Public members - bool isCasted = false; + bool isCast = false; }; // ==================================================== PrefixUnaryExprNode ====================================================== diff --git a/src/irgenerator/GenExpressions.cpp b/src/irgenerator/GenExpressions.cpp index 08dca1c04..44e0cd149 100644 --- a/src/irgenerator/GenExpressions.cpp +++ b/src/irgenerator/GenExpressions.cpp @@ -500,7 +500,7 @@ std::any IRGenerator::visitCastExpr(const CastExprNode *node) { diGenerator.setSourceLocation(node); // Check if only one operand is present -> loop through - if (!node->isCasted) + if (!node->isCast) return visit(node->prefixUnaryExpr()); // It is a cast expression diff --git a/src/irgenerator/GenValues.cpp b/src/irgenerator/GenValues.cpp index bfed54d3c..d232c8f3d 100644 --- a/src/irgenerator/GenValues.cpp +++ b/src/irgenerator/GenValues.cpp @@ -136,10 +136,12 @@ std::any IRGenerator::visitFctCall(const FctCallNode *node) { if (node->hasArgs) { argValues.reserve(node->argLst()->args().size()); const std::vector args = node->argLst()->args(); + const std::vector paramSTypes = + data.isFctPtrCall() ? firstFragEntry->getType().getBaseType().getFunctionParamTypes() : spiceFunc->getParamTypes(); + assert(paramSTypes.size() == args.size()); for (size_t i = 0; i < args.size(); i++) { AssignExprNode *argNode = args.at(i); - SymbolType expectedSTy = data.isFctPtrCall() ? firstFragEntry->getType().getBaseType().getFunctionParamTypes().at(i) - : spiceFunc->paramList.at(i).type; + const SymbolType& expectedSTy = paramSTypes.at(i); const SymbolType &actualSTy = argNode->getEvaluatedSymbolType(manIdx); // If the arrays are both of size -1 or 0, they are both pointers and do not need to be cast implicitly diff --git a/src/irgenerator/OpRuleConversionManager.cpp b/src/irgenerator/OpRuleConversionManager.cpp index 9304fec92..02e54851b 100644 --- a/src/irgenerator/OpRuleConversionManager.cpp +++ b/src/irgenerator/OpRuleConversionManager.cpp @@ -1489,7 +1489,7 @@ LLVMExprResult OpRuleConversionManager::getPrefixBitwiseNotInst(const ASTNode *n case TY_INT: // fallthrough case TY_SHORT: // fallthrough case TY_LONG: - return {.value = builder.CreateNeg(lhsV())}; + return {.value = builder.CreateNot(lhsV())}; default: break; } diff --git a/src/typechecker/TypeChecker.cpp b/src/typechecker/TypeChecker.cpp index 65bd13117..2a70be99a 100644 --- a/src/typechecker/TypeChecker.cpp +++ b/src/typechecker/TypeChecker.cpp @@ -1051,7 +1051,7 @@ std::any TypeChecker::visitMultiplicativeExpr(MultiplicativeExprNode *node) { std::any TypeChecker::visitCastExpr(CastExprNode *node) { // Check if cast is applied - if (!node->isCasted) + if (!node->isCast) return visit(node->prefixUnaryExpr()); // Visit source type diff --git a/std/io/cli-subcommand.spice b/std/io/cli-subcommand.spice index 300ed3ed5..95d79f23d 100644 --- a/std/io/cli-subcommand.spice +++ b/std/io/cli-subcommand.spice @@ -63,7 +63,7 @@ public f CliSubcommand.parse(unsigned int argc, string[] argv, int layer = return EXIT_CODE_SUCCESS; } - // Check for flags + // Check for options foreach const CliOption& boolOption : iterate(this.boolOptions) { if arg == boolOption.getName() { bool value = true; @@ -72,8 +72,6 @@ public f CliSubcommand.parse(unsigned int argc, string[] argv, int layer = continue 2; // Continue with next argument } } - - // Check for other options foreach const CliOption& stringOption : iterate(this.stringOptions) { if arg == stringOption.getName() { // get the argument value diff --git a/test/test-files/irgenerator/lambdas/success-function-lambda/ir-code.ll b/test/test-files/irgenerator/lambdas/success-function-lambda/ir-code.ll index c03891984..5d7613af9 100644 --- a/test/test-files/irgenerator/lambdas/success-function-lambda/ir-code.ll +++ b/test/test-files/irgenerator/lambdas/success-function-lambda/ir-code.ll @@ -118,7 +118,7 @@ define private i16 @_Z15lambda.L13C49.018__rt_string.Strings(%struct.String %0, %7 = sext i16 %6 to i32 %8 = call i32 (ptr, ...) @printf(ptr noundef @printf.str.3, ptr %5, i32 %7) %9 = load i16, ptr %b, align 2 - %10 = sub i16 0, %9 + %10 = xor i16 %9, -1 store i16 %10, ptr %3, align 2 ret i16 %10 }