<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi Keane,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Exactly my thoughts. But, how to do it?</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jan 11, 2019 at 1:05 PM Keane, Erich via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_-935037018428394354WordSection1">
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Those are typical of attempting to compile C++ code as C. I’m not sure what the right way to set the LangOpts on CompilerInstance in libclang is, but you likely
need to update those to set LangOpts correctly for the version of C++ you intend to support..<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_-935037018428394354__MailEndCompose"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></a></p>
<p class="MsoNormal"><a name="m_-935037018428394354______replyseparator"></a><b><span style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:Calibri,sans-serif"> cfe-dev [mailto:<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank">cfe-dev-bounces@lists.llvm.org</a>]
<b>On Behalf Of </b>Aditya Atluri via cfe-dev<br>
<b>Sent:</b> Friday, January 11, 2019 11:02 AM<br>
<b>To:</b> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<b>Subject:</b> [cfe-dev] Fwd: [LibTooling] Unable to parse cpp code when using libtooling feature<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif">Hi,<u></u><u></u></span></p>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif">I am a novice developer hacking around ways to use clang for parsing C/CPP code.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif">I am able to parse C code with clangs libtooling feature properly. But, when I use the code to parse CPP test code, I am getting the following error:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif"><u></u> <u></u></span></p>
</div>
<div>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)">$ ./Main <u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)">test.cpp:1:1: error: unknown type name 'template'<u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)">template<typename T><u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)">^<u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)">test.cpp:1:9: error: expected identifier or '('<u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)">template<typename T><u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)"> ^<u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)">test.cpp:6:19: error: expected expression<u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)"> float c = add<float>(a, b);<u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)"> ^<u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)">test.cpp:6:15: error: use of undeclared identifier 'add'<u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)"> float c = add<float>(a, b);<u></u><u></u></span></p>
<p style="margin:0in 0in 0.0001pt;background-color:rgb(38,44,53);font-stretch:normal;background-position:initial initial;background-repeat:initial initial">
<span style="font-size:8.5pt;font-family:Monaco,serif;color:rgb(235,235,235)"> ^<u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif"><u></u> <u></u></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif"><u></u> <u></u></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif">Attached: Main.mk (to build test), Main.cpp (Clang 8.0 based libtooling source), test.cpp (test case)<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif">Please let me know if I am doing anything bad or missing something.<u></u><u></u></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Tahoma,sans-serif">The Makefile assumes that clang is installed in ~/llvm80<u></u><u></u></span></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
_______________________________________________<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/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div><span style="font-family:tahoma,sans-serif">- Aditya Atluri</span><br></div></div></div></div>