Exemplo n.º 1
0
 virtual void HandleTopLevelDecl(DeclGroupRef DG) {
     for (DeclGroupRef::iterator i = DG.begin(), e = DG.end(); i != e; ++i) {
         const Decl *D = *i;
         const FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
         if (!FD || !FD->hasPrototype() || !FD->isExternC() || !FD->isGlobal()) return;
         cout << FD->getResultType().getAsString() << " ";
         cout << FD->getNameAsString() << "(";
         bool printComma = false;
         FunctionDecl::param_const_iterator I = FD->param_begin(),
                                            E = FD->param_end();
         while (I != E) {
             ParmVarDecl *PVD = *I++;
             if (printComma) cout << ", ";
             cout << PVD->getOriginalType().getAsString();
             printComma = true;
         }
         cout << ");\n";
     }
 }