Re: Detection of function calls in C and C++ codes

Shigio YAMAGUCHI <[email protected]> Sat, 20 Aug 2016 07:58:23 +0900
Newsgroups gmane.comp.gnu.global.general
Message-ID <CADJmJYoJTFE-NPXCt_Sk5nfGrHUMWBEQX_GP+n0Rd1A=Tg_kVQ@mail.gmail.com>
--===============1928378108774084623==
Content-Type: multipart/alternative; boundary=001a114a7e12b3b3cb053a74a206

--001a114a7e12b3b3cb053a74a206
Content-Type: text/plain; charset=UTF-8

Hi,
> We can see, that the occurence found in SimulationMPI.cxx file
> on the line 32 is not a call, but a declaration.

The current C++ built-in parser considers a declaration as a reference.

> So, is there any way, how to detect only function calls?

There is no way except for rewriting the parser.

Regards,
Shigio


2016-08-19 21:03 GMT+09:00 Martin Beseda <[email protected]>:

> To whom it may concern,
>
> I need to detect function calls in C and C++. I need to detect calls
> exclusively (with line numbers), without functions' declarations etc.
>
>
>
> I've tried to use it like this:
>
> gtags -f fileList.txt
>
> global -r -x exchangeSizes
>
>
>
> But when I'm trying to parse some C++ codes, I'm encountering problems
> like this:
>
>
>
> /projects/p_readex/amt/ProxyApps/FOO/lassen_FOO> /projects/p_readex/amt/libraries/global-6.5.4/global/global -r -x exchangeSizes
> exchangeSizes      22 SimulationMPI.cxx void exchangeSizes( MPI_Comm comm,
> exchangeSizes      32 SimulationMPI.cxx void exchangeSizes( MPI_Comm comm,
> exchangeSizes     319 SimulationMPI.cxx    exchangeSizes( comm, overlapDomains, isFacetNeighbor, recvIsFacetNeighbor);
> exchangeSizes     519 SimulationMPI.cxx    exchangeSizes( comm, neighbors, sendSize, recvBufferSize );
> exchangeSizes     533 SimulationMPI.cxx    exchangeSizes( comm, neighbors, sendBuffer, recvSizes );
>
>
> SimulationMPI.cxx:
>
>  31 template<class T>
>  32 void exchangeSizes( MPI_Comm comm,
>  33                     const std::vector<int> &neighbors,
>  34                     const std::vector< std::vector<T> > &sendBuffer,
>  35                     std::vector<int> &recvBufferSize);
>  36
>  37
>
>
> We can see, that the occurence found in SimulationMPI.cxx file on the line 32 is not a call, but a declaration.
>
> So, is there any way, how to detect only function calls?
>
>
> Thank you very much.
>
> Best regards,
> Martin
>
> P.s.: The parsed project is attached.
>
>
>
> _______________________________________________
> Help-global mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/help-global
>
>


-- 
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3

--001a114a7e12b3b3cb053a74a206
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi,</div><div>&gt; We can see, that the occurence fou=
nd in SimulationMPI.cxx file</div><div>&gt; on the line 32 is not a call, b=
ut a declaration.</div><div><br></div><div>The current C++ built-in parser =
considers a declaration as a reference.</div><div><br></div><div>&gt; So, i=
s there any way, how to detect only function calls?</div><div><br></div><di=
v>There is no way except for rewriting the parser.</div><div><br></div><div=
>Regards,</div><div>Shigio</div><div><br></div></div><div class=3D"gmail_ex=
tra"><br><div class=3D"gmail_quote">2016-08-19 21:03 GMT+09:00 Martin Besed=
a <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_=
blank">[email protected]</a>&gt;</span>:<br><blockquote class=3D"gmail_q=
uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e=
x"><u></u>
<div style=3D"font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p><span style=3D"font-family:arial,helvetica,sans-serif">To whom it may co=
ncern,</span></p>
<p><span style=3D"font-family:arial,helvetica,sans-serif">I need to detect =
function calls in C and C++. I need to detect calls exclusively (with line =
numbers), without functions&#39; declarations etc.</span></p>
<p>=C2=A0</p>
<p>I&#39;ve tried to use it like this:</p>
<p><span style=3D"font-family:andale mono,times">gtags -f fileList.txt</spa=
n></p>
<p><span style=3D"font-family:andale mono,times">global -r -x exchangeSizes=
<br></span></p>
<p>=C2=A0</p>
<p><span style=3D"font-family:andale mono,times"><span style=3D"font-family=
:arial,helvetica,sans-serif">But when I&#39;m trying to parse some C++ code=
s, I&#39;m encountering problems</span> like this:</span></p>
<p>=C2=A0</p>
<pre><span style=3D"font-family:andale mono,times">/projects/p_readex/amt/<=
wbr>ProxyApps/FOO/lassen_FOO&gt; /projects/p_readex/amt/<wbr>libraries/glob=
al-6.5.4/global/<wbr>global -r -x exchangeSizes</span><br>
<span style=3D"font-family:andale mono,times">exchangeSizes      22 Simulat=
ionMPI.cxx void exchangeSizes( MPI_Comm comm,
exchangeSizes      32 SimulationMPI.cxx void exchangeSizes( MPI_Comm comm,
exchangeSizes     319 SimulationMPI.cxx    exchangeSizes( comm, overlapDoma=
ins, isFacetNeighbor, recvIsFacetNeighbor);
exchangeSizes     519 SimulationMPI.cxx    exchangeSizes( comm, neighbors, =
sendSize, recvBufferSize );
exchangeSizes     533 SimulationMPI.cxx    exchangeSizes( comm, neighbors, =
sendBuffer, recvSizes );<br><br></span></pre>
<pre><br><span style=3D"font-family:andale mono,times"><span style=3D"font-=
family:arial,helvetica,sans-serif">SimulationMPI.cxx:</span>

 31 template&lt;class T&gt;
 32 void exchangeSizes( MPI_Comm comm,
 33                     const std::vector&lt;int&gt; &amp;neighbors,
 34                     const std::vector&lt; std::vector&lt;T&gt; &gt; &am=
p;sendBuffer,
 35                     std::vector&lt;int&gt; &amp;recvBufferSize);
 36
 37</span></pre>
<pre><span style=3D"font-family:andale mono,times"><br><span style=3D"font-=
family:arial,helvetica,sans-serif">We can see, that the occurence found in =
SimulationMPI.cxx file on the line 32 is not a call, but a declaration.</sp=
an><br><br><span style=3D"font-family:arial,helvetica,sans-serif">So, is th=
ere any way, how to detect only function calls?</span><br><br><br><span sty=
le=3D"font-family:arial,helvetica,sans-serif">Thank you very much.<br><br>B=
est regards,</span><br><span style=3D"font-family:arial,helvetica,sans-seri=
f">Martin</span><br><br><span style=3D"font-family:arial,helvetica,sans-ser=
if">P.s.: The parsed project is attached.</span></span><br><br><br></pre>
<p><span style=3D"font-family:andale mono,times"></span></p>
</div>
<br>______________________________<wbr>_________________<br>
Help-global mailing list<br>
<a href=3D"mailto:[email protected]">[email protected]</a><br>
<a href=3D"https://lists.gnu.org/mailman/listinfo/help-global" rel=3D"noref=
errer" target=3D"_blank">https://lists.gnu.org/mailman/<wbr>listinfo/help-g=
lobal</a><br>
<br></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div cla=
ss=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr">=
Shigio YAMAGUCHI &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">sh=
[email protected]</a>&gt;<div>PGP fingerprint: D1CB 0B89 B346 4AB6 5663 =C2=A0C4=
B6 3CA5 BBB3 57BE DDA3<br></div></div></div>
</div>

--001a114a7e12b3b3cb053a74a206--


--===============1928378108774084623==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Help-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-global

--===============1928378108774084623==--