<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi,<br></div><div class="gmail_quote"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-family:tahoma,sans-serif">I am a novice developer hacking around ways to use clang for parsing C/CPP code.</div><div style="font-family:tahoma,sans-serif"><br></div><div 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:</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif"><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">$ ./Main </span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">test.cpp:1:1: error: unknown type name 'template'</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">template<typename T></span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">^</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">test.cpp:1:9: error: expected identifier or '('</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">template<typename T></span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">        ^</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">test.cpp:6:19: error: expected expression</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">    float c = add<float>(a, b);</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">                  ^</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">test.cpp:6:15: error: use of undeclared identifier 'add'</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">    float c = add<float>(a, b);</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Monaco;color:rgb(235,235,235);background-color:rgb(38,44,53)"><span style="font-variant-ligatures:no-common-ligatures">              ^</span></p><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div></div><div style="font-family:tahoma,sans-serif"><br></div><div><div style="font-family:tahoma,sans-serif">Attached: Main.mk (to build test), Main.cpp (Clang 8.0 based libtooling source), test.cpp (test case)</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">Please let me know if I am doing anything bad or missing something.</div></div><div style="font-family:tahoma,sans-serif">The Makefile assumes that clang is installed in ~/llvm80</div><div dir="ltr" class="m_3233313563720498381gmail_signature"><div dir="ltr"><div><div><br></div></div></div></div></div></div></div>
</div><div><br></div></div>