[cfe-dev] Search for specific code line

Anja Gerbes via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 28 23:27:14 PST 2021


Dear everyone,

Is it possible in LLVM/clang to search for a specific code line and print
out/extract the whole function/relevant code region where the code line was
found?

Here is an example. I would like to analyze the c file in
https://github.com/UoB-HPC/intro-hpc-jacobi.

Let's say the specific code line is line 62:
dot += A[row + col*N] * x[col];

In that case I would be interested in that code region:
// Perfom Jacobi iteration
for (row = 0; row < N; row++)
{
dot = 0.0;
for (col = 0; col < N; col++)
{
if (row != col)
dot += A[row + col*N] * x[col];
}
xtmp[row] = (b[row] - dot) / A[row + row*N];
}

How can I get this result via LLVM/clang?

Thank you very much for your ideas!

Best
Anja
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210129/0b105218/attachment.html>


More information about the cfe-dev mailing list