On Tue, 10 Dec 2019, 22:45 henry ding via cfe-users, < cfe-users@lists.llvm.org> wrote:
> simple test.cpp: > void test(std::string xx,string bb,int aa){} > > clang usage: > int getFuncInfo(Rewriter* TheRewrite,clang::ASTContext *Context, const > FunctionDecl *func,FuncNode &node){ > clang::LangOptions LangOpts; > LangOpts.CPlusPlus = true; > Policy.FullyQualifiedName = 1; > ............................................................. > . .......................................................... > for(unsigned int i=0; i<func->getNumParams(); i++) > { > string t = > QualType::getAsString(func->getParamDecl(i)->getType().split(),Policy); > string n = > > func->getParamDecl(i)->getName();//func->parameters()[i]->getQualifiedNameAsString() > cout << t + "#" + n << endl; > } > } > > But,i got: > int#xx //should string#xx > int#bb //should string#bb > int#aa > > Has anyone encountered this situation ? 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. _______________________________________________ > cfe-users mailing list > cfe-users@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users >
_______________________________________________ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users