<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 10 Dec 2019, 22:45 henry ding via cfe-users, <<a href="mailto:cfe-users@lists.llvm.org">cfe-users@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">simple test.cpp:<br>
void test(std::string xx,string bb,int aa){}<br>
<br>
clang usage:<br>
int getFuncInfo(Rewriter* TheRewrite,clang::ASTContext *Context, const<br>
FunctionDecl *func,FuncNode &node){<br>
clang::LangOptions LangOpts;<br>
LangOpts.CPlusPlus = true;<br>
Policy.FullyQualifiedName = 1;<br>
.............................................................<br>
. ..........................................................<br>
for(unsigned int i=0; i<func->getNumParams(); i++)<br>
{<br>
string t =<br>
QualType::getAsString(func->getParamDecl(i)->getType().split(),Policy);<br>
string n =<br>
func->getParamDecl(i)->getName();//func->parameters()[i]->getQualifiedNameAsString()<br>
cout << t + "#" + n << endl;<br>
}<br>
}<br>
<br>
But,i got:<br>
int#xx //should string#xx<br>
int#bb //should string#bb<br>
int#aa<br>
<br>
Has anyone encountered this situation ?</blockquote></div></div><div dir="auto"><br></div><div dir="auto">The bug is probably somewhere else. Make sure the proper language options are set up before parsing the source file, and that you're printing out any diagnostics. My guess would be that the source is failing to compile (wrong options, or can't find some standard header, or something), and the diagnostics are being discarded, and clang is replacing the parameter type with 'int' in error recovery.</div><div dir="auto"><br></div><div dir="auto"></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@lists.llvm.org" target="_blank" rel="noreferrer">cfe-users@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users</a><br>
</blockquote></div></div></div>