[PATCH] D150458: [ORC] Use ExecutorAddr::toPtr() in documentation
Lang Hames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 31 15:16:04 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2addaeda18ad: [docs] Use ExecutorAddr::toPtr() in ORC documentation. (authored by vadorovsky, committed by lhames).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150458/new/
https://reviews.llvm.org/D150458
Files:
llvm/docs/ORCv2.rst
llvm/docs/tutorial/BuildingAJIT1.rst
llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
Index: llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
===================================================================
--- llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
+++ llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
@@ -317,7 +317,7 @@
// Get the symbol's address and cast it to the right type (takes no
// arguments, returns a double) so we can call it as a native function.
- double (*FP)() = (double (*)())(intptr_t)ExprSymbol.getAddress();
+ double (*FP)() = ExprSymbol.getAddress().toPtr<double (*)()>();
fprintf(stderr, "Evaluated to %f\n", FP());
// Delete the anonymous expression module from the JIT.
Index: llvm/docs/tutorial/BuildingAJIT1.rst
===================================================================
--- llvm/docs/tutorial/BuildingAJIT1.rst
+++ llvm/docs/tutorial/BuildingAJIT1.rst
@@ -77,7 +77,7 @@
JIT J;
J.addModule(buildModule());
- auto *Main = (int(*)(int, char*[]))J.lookup("main").getAddress();
+ auto *Main = J.lookup("main").getAddress().toPtr<int(*)(int, char *[])>();
int Result = Main();
The APIs that we build in these tutorials will all be variations on this simple
Index: llvm/docs/ORCv2.rst
===================================================================
--- llvm/docs/ORCv2.rst
+++ llvm/docs/ORCv2.rst
@@ -124,7 +124,7 @@
return EntrySym.takeError();
// Cast the entry point address to a function pointer.
- auto *Entry = (void(*)())EntrySym.getAddress();
+ auto *Entry = EntrySym.getAddress().toPtr<void(*)()>();
// Call into JIT'd code.
Entry();
@@ -204,7 +204,7 @@
// Look up the JIT'd main, cast it to a function pointer, then call it.
auto MainSym = ExitOnErr(ES.lookup({&MainJD}, "main"));
- auto *Main = (int(*)(int, char*[]))MainSym.getAddress();
+ auto *Main = MainSym.getAddress().toPtr<int(*)(int, char *[])>();
int Result = Main(...);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150458.527209.patch
Type: text/x-patch
Size: 1951 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230531/720b9f1c/attachment.bin>
More information about the llvm-commits
mailing list