<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/114711>114711</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Are the tutorials up-to-date? (Clang version is 20.0.0git)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bobhairgrove
</td>
</tr>
</table>
<pre>
Nothing written here seems to work for me: https://clang.llvm.org/docs/LibASTMatchersTutorial.html
In my [previous post](https://github.com/llvm/llvm-project/issues/114498#issue-2628174550), I describe my frustrating experience building LLVM and Clang from latest sources. After having finally successfully built and installed everything after following a [different tutorial](https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm) found on the LLVM homepage, I went back to the LibASTMatcher tutorial to see if I could continue with the steps starting after the `ninja install` command (which should be `sudo ninja install`).
I didn't have `ccmake` installed (had to run `sudo apt install cmake-curses-gui`), so I did that. But I could not figure out where I needed to run this from since the tutorial installed everything immediately under `$HOME` and assumes that whoever is trying to use this tutorial would do the same. However, it seems that the step mentioned is to use `clang` to (re)compile LLVM using Clang, which isn't really necessary.
Then I went to [this tutorial](https://clang.llvm.org/docs/LibTooling.html) and tried to compile the very first example (using `TEST()` and `EXPECT_TRUE()`. It doesn't compile, unfortunately, but nothing written there gives me a hint about what is going on. Compiling with `g++` should work, but here is the output:
```
// contents of "main.cpp":
#include "clang/Tooling/Tooling.h"
TEST(runToolOnCode, CanSyntaxCheckCode) {
// runToolOnCode returns whether the action was correctly run over the
// given code.
EXPECT_TRUE(runToolOnCode(std::make_unique<clang::SyntaxOnlyAction>(), "class X {};"));
}
```
Output:
```
bob@bobs-laptop:~/code/LibToolingProject$ g++ -c main.cpp
main.cpp:3:5: error: expected constructor, destructor, or type conversion before ‘(’ token
3 | TEST(runToolOnCode, CanSyntaxCheckCode) {
| ^
```
I know that `TEST` and `EXPECT_TRUE` are macros defined by Google test framework, but assume that they are somehow pulled in by the `Tooling.h` header. But perhaps not?
Why do the tutorial writers assume that certain tools are already installed without even mentioning the dependencies? Since all of these tutorials are located on the official LLVM and Clang websites, one would assume that they would be better organized and tested...
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVs1y47gRfhr40iUVBer3oIMs27uumslsxU6yty0QaIpYkwADNKxRDnn2VIOkbM-69pCdco1IAv33dX_drWK0J4e4F6tbsbq7UYkaH_aVrxplwyn4V7ypvLns_-apse4E52CJ0EGDASEidhHIw9mHF6h9gA5FeYCGqI-iPAj5IOSDbpU7zdv2tZv7cBLywXgdhXz4YqvD0_NXRbrBEJ8T-WBVO2-oa0VxJ4rD8P-jg-4CYnXbB3y1PkXofSSxuhNy-9HQyVKTqrn2nZAPbG_8mfXB_46ahHywMSZk44vFcrnbClnmLzO5ltvFZrlaFULuhDzCIxiMOtgK2XodUqSgiBHA7z0Gi04jVMm2hr99-fLPr6CcgSPHCnXwHbSKMBJEn4LGOIdDTRigUa8sUFun2vYCMWmNMdaJX1gdZTXWRVJtiwbwFcNlgF5lBbVvW3_O7wyKsXWNAR0BjQB-hswfwf8JiaN5IhUIzQC6LE_D1xk1OBscn2lvcKacmU3BzgZkd1D75Ax4B9TggEDjO-zVCQcAz-xVpfQLV0i-8z7hV3_5NCKCreERtE-tAe0dWZcQzpaaLBoJ-wiRvX2Dgg_EunDW_a4myMS6AO27jlEUcnturG4gNlltla_HZDz8KCPkbv6h6MBY44TcEGcsy2ndqRdk_W_ZYaCV4QhCclflqqfpDmShmU4hYpydkh1sMUDRQ7YC1Ciaw22ia_zOE9T2lAKCTwTnTLZHcIgGr9aosXGotGi5GBmNK6afFpDtOjRWEbYXSM5ggOzN8udvX-85LsZMxZg6jNkpODeexcFGoHBhFeQhRRxsX42ds9NmSHJUHc7hZ39mSY7T0tQnWOWUTOjQkfUOTdY-qGWUmUDsDHlGN6CQO-273rZjjaXIfmSesfYhwTYOuQqYWeWQSaXC5UNOnxt0U1my9tXth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