Support generating sync_call entry point function

This commit is contained in:
Lin Huang
2025-05-07 19:52:09 -04:00
parent b86434da3d
commit 2b2c838390
3 changed files with 17 additions and 0 deletions
+1
View File
@@ -1926,6 +1926,7 @@ public:
bool isEosioWasmEntry()const;
bool isEosioWasmImport()const;
bool isEosioWasmAction()const;
bool isEosioWasmCall()const;
std::string getEosioWasmAction()const;
std::string getEosioWasmCall()const;
bool isEosioWasmNotify()const;
+1
View File
@@ -4582,6 +4582,7 @@ std::string FunctionDecl::getWasmABI()const { return getAttr<EosioWasmABIAttr>()
bool FunctionDecl::isEosioWasmEntry()const { return hasAttr<EosioWasmEntryAttr>(); }
bool FunctionDecl::isEosioWasmImport()const { return hasAttr<EosioWasmImportAttr>(); }
bool FunctionDecl::isEosioWasmAction()const { return hasAttr<EosioWasmActionAttr>(); }
bool FunctionDecl::isEosioWasmCall()const { return hasAttr<EosioWasmCallAttr>(); }
std::string FunctionDecl::getEosioWasmAction()const { return getAttr<EosioWasmActionAttr>()->getName(); }
std::string FunctionDecl::getEosioWasmCall()const { return getAttr<EosioWasmCallAttr>()->getName(); }
bool FunctionDecl::isEosioWasmNotify()const { return hasAttr<EosioWasmNotifyAttr>(); }
+15
View File
@@ -453,6 +453,18 @@ static void handleEosioWasmActionAttribute(Sema &S, Decl *D, const ParsedAttr &A
AL.getAttributeSpellingListIndex()));
}
static void handleEosioWasmCallAttribute(Sema &S, Decl *D, const ParsedAttr &AL) {
// Handle the cases where the attribute has a text message.
StringRef Str;
if (AL.isArgExpr(0) && AL.getArgAsExpr(0) &&
!S.checkStringLiteralArgumentAttr(AL, 0, Str))
return;
D->addAttr(::new (S.Context)
EosioWasmCallAttr(AL.getRange(), S.Context, Str,
AL.getAttributeSpellingListIndex()));
}
static void handleEosioWasmNotifyAttribute(Sema &S, Decl *D, const ParsedAttr &AL) {
// Handle the cases where the attribute has a text message.
StringRef Str;
@@ -6776,6 +6788,9 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
case ParsedAttr::AT_EosioWasmAction:
handleEosioWasmActionAttribute(S, D, AL);
break;
case ParsedAttr::AT_EosioWasmCall:
handleEosioWasmCallAttribute(S, D, AL);
break;
case ParsedAttr::AT_EosioWasmNotify:
handleEosioWasmNotifyAttribute(S, D, AL);
break;