<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62411>62411</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Inconsistency in Kaleidoscope tutorial
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
perlun
</td>
</tr>
</table>
<pre>
Hi,
In [the Kaleidoscope tutorial](https://llvm.org/docs/tutorial/MyFirstLanguageFrontend), there is a slight inconsistency e.g. on https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.html.
I.e. this (old form, seems to work with e.g. LVVM 14):
```c++
// 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();
fprintf(stderr, "Evaluated to %f\n", FP());
```
vs this (new form):
```c++
// 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)() = ExprSymbol.getAddress().toPtr<double (*)()>();
fprintf(stderr, "Evaluated to %f\n", FP());
```
I looked into this and this seems to be a consequence of the changes in 8b1771bd9f304be39d4dcbdcccedb6d3bcd18200; that patch edited the `toy.cpp` files, but not the associated files (https://github.com/llvm/llvm-project/edit/main/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst and others).
This would be a "good first issue" since its a quite simple change, merely requiring to go through the relevant `LangImplxx.rst` files and compare with the changes in 8b1771bd9f304be39d4dcbdcccedb6d3bcd18200. Since the fix was non-trivial (=more than editing a single file) I am not planning to look into it myself, so feel free to pick this up if anyone feels like fixing it. :+1:
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVk-P27YT_TT0ZRBBouQ_Ovjg3Y1-v0UTIECKXAuKHEnsUqSWHNnrb1-Qsp3dJg3QoL1UEGxBHM28eW9mSBGC7i3inq3v2PphJWYanN9P6M1sV61T5_3_NeP3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