l found there were a typedecl which typedef string as int, this may be the reason
std::string|int|/usr/include/c++/4.8.5/bits/stringfwd.h 2019-12-12 2:13 GMT+08:00, Richard Smith <rich...@metafoo.co.uk>: > 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