From a29cb23c5517fd4f8f5524fdf38b67ff5fe4a902 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 15:02:01 +0000 Subject: feat(parser): parse EXTERN "C" declarations and INCLUDE_OBJ Co-Authored-By: Claude Opus 5.5 --- include/cps/FunctionAST.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/cps/FunctionAST.h') diff --git a/include/cps/FunctionAST.h b/include/cps/FunctionAST.h index 9995a4c..716f004 100644 --- a/include/cps/FunctionAST.h +++ b/include/cps/FunctionAST.h @@ -33,6 +33,7 @@ class PrototypeAST { bool IsOverload; std::string OwnerClass; bool IsPublic; + bool IsVariadic = false; public: PrototypeAST(const std::string &Name, @@ -47,6 +48,8 @@ public: const std::string &getReturnType() const { return ReturnType; } bool isOverload() const { return IsOverload; } bool isExternal() const { return IsExternal; } + bool isVariadic() const { return IsVariadic; } + void setVariadic(bool V) { IsVariadic = V; } const std::string &getOwnerClass() const { return OwnerClass; } bool isPublic() const { return IsPublic; } std::string getLinkName() const { @@ -68,6 +71,16 @@ public: const std::vector> &getBody() const { return Body; } }; +// EXTERN "C" EXTERN_FUNCTION/EXTERN_PROCEDURE: a body-less C prototype whose +// name is the exact C symbol. +class ExternDeclAST : public StmtAST { + std::unique_ptr Proto; + +public: + explicit ExternDeclAST(std::unique_ptr Proto) : Proto(std::move(Proto)) {} + PrototypeAST *getProto() const { return Proto.get(); } +}; + class CallExprAST : public ExprAST { std::string Callee; std::vector> Args; -- cgit v1.3.1-4-g156e