[llvm-dev] Search for specific code line

1 view
Skip to first unread message

Anja Gerbes via llvm-dev

unread,
Jan 29, 2021, 2:27:36 AM1/29/21
to llvm...@lists.llvm.org, cfe...@lists.llvm.org
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
Reply all
Reply to author
Forward
0 new messages