diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 15:02:01 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 15:02:01 +0000 |
| commit | a29cb23c5517fd4f8f5524fdf38b67ff5fe4a902 (patch) | |
| tree | a3bfa1a30a16c03f420cbe706fd42143d653064d /include/cps/FunctionAST.h | |
| parent | 4a34e970fb224be7640883f6b0dfa602157759f4 (diff) | |
feat(parser): parse EXTERN "C" declarations and INCLUDE_OBJ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'include/cps/FunctionAST.h')
| -rw-r--r-- | include/cps/FunctionAST.h | 13 |
1 files changed, 13 insertions, 0 deletions
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<std::unique_ptr<StmtAST>> &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<PrototypeAST> Proto; + +public: + explicit ExternDeclAST(std::unique_ptr<PrototypeAST> Proto) : Proto(std::move(Proto)) {} + PrototypeAST *getProto() const { return Proto.get(); } +}; + class CallExprAST : public ExprAST { std::string Callee; std::vector<std::unique_ptr<ExprAST>> Args; |
