I\'m trying to work on a kind of code generator to help unit-testing an legacy C/C++ blended project. I don\'t find any kind of independent tool can generate stub code from decl
Our DMS Software Reengineering Toolkit can be obtained with a robust, full featured C++ parser. See http://www.semanticdesigns.com/Products/FrontEnds/CppFrontEnd.html This builds ASTs and symbol tables, and can infer the type of any expression. DMS enables one to carry out arbitrary analyses and transformations on the C++ code.
One "simple" transformation is instrumenting the code to collect test coverage data; we offer this as a COTS tool. See this paper to understand how DMS does it: http://www.semanticdesigns.com/Company/Publications/TestCoverage.pdf
EDIT September 2013 (This answer was getting a bit stale): DMS's C++ parser/name resolution/control flow analysis handles full C++11, in the ISO-, GNU- and Microsoft variants. It will also parse (and retain) source code containing most preprocessor conditionals. It has an explicit grammar driving the parsing process, unlike GCC or Clang.