<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/135587>135587</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang-doc] invalid implementation file reference
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hulxv
</td>
</tr>
</table>
<pre>
After generating the documentation, `clang-doc` generates some references that link to the definition and implementation of each function/method. But, it generates an implementation reference in this way
```html
<h3 id="180C359AB8E98A663762001FF59A0FA5F0D9240B">add</h3>
<p>public int add(int a, int b)</p>
<p>
Defined at line
<a href="Inputs/basic-project/src/Calculator.cpp#3">3</a>
of file
<a href="Inputs/basic-project/src/Calculator.cpp">Calculator.cpp</a>
</p>
```
So, when hosting it using an HTTP server or directly from the browser and clicking on the link, the browser will redirect it as a child for the current path (`docs/GlobalNamespace/` in our case), and this path doesn't refer to the correct path of the definition/implementation file.
## Showcase
https://github.com/user-attachments/assets/c4cb5df5-654d-40b3-a0d5-3f5798f716b2
## Possible Solution
I think by converting this path into the absolute path from the root. The output will be similar to this:
```html
<h3 id="180C359AB8E98A663762001FF59A0FA5F0D9240B">add</h3>
<p>public int add(int a, int b)</p>
<p>
Defined at line
<a href="/home/USER/<parent-directory>/Inputs/basic-project/src/Calculator.cpp#3">3</a>
of file
<a href="/home/USER/<parent-directory>/Inputs/basic-project/src/Calculator.cpp">Calculator.cpp</a>
</p>
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUVcFu4zYQ_Rr6MrBBkZJsHXRw7KjdS7Fo0g-gqJHJhiIFkrKbvy9IJWnWBfZQbA8LCDBNke-9mXmjESHoi0VsSfVAqvNGLFE536rF_HXd9G54bY9jRA8XtOhF1PYCUSEMTi4T2iiidpawE5CaSiPsZTs4SWr6fh4DBDcheBzRo5UYICoRwWj7AtGtWDhqqxMQCDuAnmaDH9jgRkAhFYyLl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