got wrong parameter type using clang

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 ?

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; igetNumParams(); 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.

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