<div dir="ltr">Hello,<div><br></div><div>I used intercept-build to generate the compilation database for an MPI program but I am not able to get the argument names.</div><div><br></div><div>This is the compile_commands.json file:</div><div><br></div><div><div>[</div><div>    {</div><div>        "command": "c++ -c -I/usr/include/mpi -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -pthread BasicMPIProgram.cpp", </div><div>        "directory": "/home/dhriti/Dropbox/CLANG_MPI_LLVM/MPI", </div><div>        "file": "/home/dhriti/Dropbox/CLANG_MPI_LLVM/MPI/BasicMPIProgram.cpp"</div><div>    }</div><div>]</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 9, 2016 at 12:24 AM, Alexander Droste <span dir="ltr"><<a href="mailto:alexander.ra.droste@googlemail.com" target="_blank">alexander.ra.droste@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Dhriti,<br>
<br>
when applying analysis scripts on an MPI project,<br>
I experienced problems in case mpicc|mpic++ is denoted<br>
as the used compiler in the compile_commands.json file.<br>
>From my experience this is what CMake does if<br>
-DCMAKE_EXPORT_COMPILE_COMMAND<wbr>S=1 is used for an MPI project.<br>
A possible workaround could be to use the scan-build intercept script<br>
as described here: <a href="https://github.com/0ax1/MPI-Checker/tree/master/examples" rel="noreferrer" target="_blank">https://github.com/0ax1/MPI-Ch<wbr>ecker/tree/master/examples</a>,<br>
to generate the compilation database.<br>
<br>
-Alex<span class=""><br>
<br>
<br>
On 08.08.16 20:34, Dhriti Khanna via cfe-dev wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
I am working with clang version 3.8. I have a MPI program which is causing the<br>
problem. Version 4.9.3 of mpiCC. I guess you will be able to reproduce the<br>
problem with a simple mpi program.<br>
<br>
Also, I use this compile_commands.json file:<br>
[<br>
{<br>
  "directory": "~/Dropbox/CLANG_MPI_LLVM/MPI"<wbr>,<br>
  "command": "mpiCC -I/usr/include/mpi BasicMPIProgram.cpp",<br>
  "file": "~/Dropbox/CLANG_MPI_LLVM/MPI/<wbr>BasicMPIProgram.cpp"<br>
}<br>
]<br>
<br>
And this to run the clang tool on a mpi source file: ./tool -p<br>
~/Dropbox/CLANG_MPI_LLVM/MPI BasicMPIProgram.cpp<br>
<br>
<br>
<br>
<br>
On Mon, Aug 8, 2016 at 12:52 AM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a><br></span><span class="">
<mailto:<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a><wbr>>> wrote:<br>
<br>
    On Sun, Aug 7, 2016 at 9:06 AM, Dhriti Khanna via cfe-dev<br></span><div><div class="h5">
    <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <mailto:<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><wbr>>> wrote:<br>
    > Hello,<br>
    ><br>
    > I want to print the arguments passed to a function. But clang returns<br>
    > Parameter names used in the function definition. Here is my code:<br>
    ><br>
    > if (CallExpr *call = dyn_cast<CallExpr>(st))<br>
    > {<br>
    >     LangOptions LangOpts;<br>
    >     LangOpts.CPlusPlus = true;<br>
    >     PrintingPolicy Policy(LangOpts);<br>
    ><br>
    >     for(int i=0, j=call->getNumArgs(); i<j; i++)<br>
    >     {<br>
    >         std::string TypeS;<br>
    >         raw_string_ostream raw(TypeS);<br>
    >         call->getArg(i)->printPretty(<wbr>raw, 0, Policy);<br>
    >         errs() << raw.str() << "\n";<br>
    >     }<br>
    > }<br>
    > Example:<br>
    > int iArgument = 123;<br>
    > char cArgument = 'c';<br>
    > foo(iArgument, cArgument);<br>
    > For this code, it should print iArgument and cArgument, but it is printing<br>
    > the names of the parameters given in function definition.<br>
    ><br>
    > Please tell what might be the problem.<br>
<br>
    I cannot reproduce this issue. Are you testing with ToT, or some other<br>
    version of Clang?<br>
<br>
    > Also, I am able to get the arguments' name when I am using a simple C++<br>
    > code. But when I start using another library's API (for that I am specifying<br>
    > compile_commands.json file), this presents problems.<br>
<br>
    Can you give some steps to reproduce? Is it possible that the other<br>
    library's API is what's causing the problem?<br>
<br>
    ~Aaron<br>
<br>
    ><br>
    > --<br>
    > Regards,<br>
    > Dhriti Khanna<br>
    > PhD Scholar<br>
    > IIIT Delhi<br>
    ><br>
    > ______________________________<wbr>_________________<br>
    > cfe-dev mailing list<br></div></div>
    > <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <mailto:<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><wbr>><br>
    > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><span class=""><br>
    <<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin<wbr>/mailman/listinfo/cfe-dev</a>><br>
    ><br>
<br>
<br>
<br>
<br>
--<br>
Regards,<br>
Dhriti Khanna<br>
PhD Scholar<br>
IIIT Delhi<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br>
</span></blockquote>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><font color="#f1c232">Regards,</font><div><font color="#f1c232">Dhriti Khanna</font></div><div><font color="#f1c232">PhD Scholar</font></div><div><font color="#f1c232">IIIT Delhi</font></div></div></div></div></div>
</div>