So, you want to process C ++ code that uses MS headers, and you want to access the AST so you can generate the code. And Klang will not process MS headers. Therefore, Clang cannot be the answer unless it receives a radical update.
You asked for "any solution that can make this work."
Our DMS Software Reengineering Tookit with its C ++ 14 Front End can do this.
DMS provides general analysis, construction / verification / conversion / generation of AST and reverse analysis (converting AST back to compiled code), parameterized by language definitions.
The front end of C ++ provides a complete C ++ 14 analyzer, preprocessor processing, AST construction, and full name and type resolution. It has been tested with GCC and MS VS 2013 header files; we are currently testing header files 2015. (It also handles the syntax of MS VS 2013).
It fully handles hard cases of parsing, including the famous C ++ "most unpleasant syntax". You can see the parse trees in get humanoid AST from C ++ code .
DMS does not provide Python bindings, nor does it have a direct C ++ interface. Rather, it is a standalone tool designed to support the creation of custom tools (for example, your "small code generator"). It has its very extensive set of internal APIs encoded in the PARLANSE metaprogramming language, which is LISP -like. Other aspects of DMS are managed using DSL for lexers, grammars, and transforms. See below.
Warning: any tool that can handle C ++ is guaranteed to be complicated. DMS is correspondingly complex, and it takes some time to learn how to use it, so you won’t get instant answers. The good news is that some things are easier to do. The problem with creating the code is most likely to "read the skeleton file, and then replace the key entries in it with the code of the specific problem." If in this case the DMS tool with the following code (simplified for presentation here) is likely to do the trick:
... (= myAST (Registry:ParseFile (. filename) (. `CppVisualStudio2013') ...) (Registry:ApplyTransforms myAST (. `MyTransforms.rsl')) (Registry:PrettyPrint myAST (concat filename `.modified')) ...
with the transformation file MyTransforms.rsl containing the syntax of the source-source syntax (for example, C ++ syntax) of a conceptual form
rule rulename if_you_see THIS then replace_by ("-->") THAT
An actual C ++ rule might look like this (by doing this because I don’t know my actual goals of code generation)
rule replace_abstraction(s: STRING_LITERAL): " abstraction_place_holder(\s) " -> " my_DSL_library(\s,17); "
The ApplyTransforms call above will apply all the rules in this file until they are applied.
Writing surface syntax conversions where you can do this is easier than making calls in the procedure library (which, like Clang, DMS), break the tree.
You can write more complex metaprograms with PARLANSE to apply some rules in one place, other rules somewhere else, and you can mix source transforms with source code with procedural transformations that can be processed directly in the tree if you want.
If you need more information about what the transforms look like, ask and I have provided a link.