[clang][NFC] Update CrossTranslationUnit.rst (#175730)

For PHC-based analysis, it's no longer necessary to manually edit the
file name in externalDefMap.txt.
This commit is contained in:
Davide Cunial 2026-01-16 18:08:39 +01:00 committed by GitHub
parent 6f69d68a9e
commit 5ab2df3469
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,21 +85,9 @@ source files in format `<USR-Length>:<USR> <File-Path>`:
.. code-block:: bash
$ clang-extdef-mapping -p . foo.cpp
9:c:@F@foo# /path/to/your/project/foo.cpp
$ clang-extdef-mapping -p . foo.cpp > externalDefMap.txt
We have to modify `externalDefMap.txt` to contain the name of the `.ast` files instead of the source files:
.. code-block:: bash
$ sed -i -e "s/.cpp/.cpp.ast/g" externalDefMap.txt
We still have to further modify the `externalDefMap.txt` file to contain relative paths:
.. code-block:: bash
$ sed -i -e "s|$(pwd)/||g" externalDefMap.txt
$ clang-extdef-mapping -p . foo.cpp.ast
9:c:@F@foo# /path/to/your/project/foo.cpp.ast
$ clang-extdef-mapping -p . foo.cpp.ast > externalDefMap.txt
Now everything is available for the CTU analysis.
We have to feed Clang with CTU specific extra arguments: