aboutsummaryrefslogtreecommitdiff
path: root/include/cps
diff options
context:
space:
mode:
Diffstat (limited to 'include/cps')
-rw-r--r--include/cps/CodeGen.h7
-rw-r--r--include/cps/FunctionAST.h3
-rw-r--r--include/cps/FunctionGen.h1
-rw-r--r--include/cps/Lexer.h1
-rw-r--r--include/cps/Parser.h2
5 files changed, 12 insertions, 2 deletions
diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h
index c3a7b19..c0ae997 100644
--- a/include/cps/CodeGen.h
+++ b/include/cps/CodeGen.h
@@ -148,6 +148,11 @@ class CodeGen {
llvm::Value *emitCStringExpr(ExprAST *Expr);
llvm::Value *emitFileNameOperand(ExprAST *E, const char *Keyword);
bool containsString(const TypeInfo *Type) const;
+ const FuncSig *findImplicitConstructor(const TypeInfo *Source, const TypeInfo *Target);
+ bool canImplicitlyConvert(const TypeInfo *Source, const TypeInfo *Target);
+ llvm::Value *emitImplicitConstruct(const FuncSig &Constructor, const TypeInfo *Target,
+ llvm::Value *Argument,
+ const std::vector<size_t> &Transfers = {});
std::unique_ptr<TypeSystem> Types;
std::unique_ptr<ArrayHandler> Arrays;
@@ -230,7 +235,7 @@ class CodeGen {
llvm::Value *materializeOperatorReceiver(llvm::Value *Value, const TypeInfo *Type);
llvm::Value *emitOperatorCall(const FuncSig &Signature, ExprAST *Left, ExprAST *Right = nullptr);
llvm::Value *emitOperatorValues(const FuncSig &Signature, llvm::Value *Left,
- const TypeInfo *LeftType, llvm::Value *Right);
+ const TypeInfo *LeftType, llvm::Value *Right, const TypeInfo *RightType);
llvm::Value *emitVariadicArgument(ExprAST *Expr, const std::string &Callee, size_t Position,
const TypeInfo *&Promoted);
// Variadic, if given, receives the promoted type of each variadic argument.
diff --git a/include/cps/FunctionAST.h b/include/cps/FunctionAST.h
index 5280d58..d7fca1a 100644
--- a/include/cps/FunctionAST.h
+++ b/include/cps/FunctionAST.h
@@ -34,6 +34,7 @@ class PrototypeAST {
bool IsOverload;
std::string OwnerClass;
bool IsPublic;
+ bool IsImplicit = false;
bool IsVariadic = false;
bool IsDefaultReturn = false;
int Operator = 0;
@@ -50,6 +51,8 @@ public:
const std::vector<ParamDecl> &getParams() const { return Params; }
const std::string &getReturnType() const { return ReturnType; }
bool isOverload() const { return IsOverload; }
+ bool isImplicit() const { return IsImplicit; }
+ void setImplicit(bool V) { IsImplicit = V; }
bool isDefaultReturn() const { return IsDefaultReturn; }
void setDefaultReturn(bool V) { IsDefaultReturn = V; }
int getOperator() const { return Operator; }
diff --git a/include/cps/FunctionGen.h b/include/cps/FunctionGen.h
index 5e895fe..741d08b 100644
--- a/include/cps/FunctionGen.h
+++ b/include/cps/FunctionGen.h
@@ -42,6 +42,7 @@ struct FuncSig {
std::string ParamKey;
std::string ReturnKey;
bool IsOverload = false;
+ bool IsImplicit = false;
bool IsDefaultReturn = false;
const PrototypeAST *Prototype = nullptr;
std::string ReturnTypeName;
diff --git a/include/cps/Lexer.h b/include/cps/Lexer.h
index 1268582..9faa09f 100644
--- a/include/cps/Lexer.h
+++ b/include/cps/Lexer.h
@@ -80,6 +80,7 @@ enum Token {
tok_byref = -407,
tok_byval = -408,
tok_default = -409,
+ tok_implicit = -410,
tok_openfile = -500,
tok_readfile = -501,
diff --git a/include/cps/Parser.h b/include/cps/Parser.h
index e710150..aadf9a4 100644
--- a/include/cps/Parser.h
+++ b/include/cps/Parser.h
@@ -96,7 +96,7 @@ class Parser {
bool ParseRecordField(std::vector<RecordFieldDecl> &Out, bool IsPublic);
std::unique_ptr<FunctionDefAST> ParseFunction(const std::string &OwnerClass = {}, bool IsPublic = true, bool IsOverload = false);
- std::unique_ptr<FunctionDefAST> ParseProcedure(const std::string &OwnerClass = {}, bool IsPublic = true, bool IsOverload = false);
+ std::unique_ptr<FunctionDefAST> ParseProcedure(const std::string &OwnerClass = {}, bool IsPublic = true, bool IsOverload = false, bool IsImplicit = false);
std::unique_ptr<FunctionDefAST> ParseFunctionBody(
std::unique_ptr<PrototypeAST> Proto, int EndToken, const char *EndMessage, int Line);
std::unique_ptr<StmtAST> ParseExternDecl();