Refactor Type::toCBuffer* and helpers into a visitor class in hdrgen.c

- Move the main function Type::toCBuffer2 into the visitor class
- Move TypeQualified::toCBuffer2Helper into an internal helper function
- Remove one-caller function attributesToCBuffer into caller
- Factor out repeated safety and linkage printing
- Rename functionToCBuffer2 to functionToBufferWithIdent
- Rename toCBufferWithAttributes to functionToBufferFull
- Do special-case checking in Type::toCBuffer instead of overriding in TypeFunction::toCBuffer and TypeError::toCBuffer
- Move Type::toCBuffer3 into internal helper visitWithMask
- Rename toCBuffer2 to toBufferShort and make it a free function
- Move Type::toCBuffer into a free function
Clean up errors in implicitCastTo refactoring not caught by the C++ compiler.
Merge pull request #3248 from yebblies/implicitcasttofixup

Clean up errors in implicitCastTo refactoring not caught by the C++ compiler
Merge pull request #3238 from yebblies/typetocbuffer

[DMDD] [refactor] Move Type::toCBuffer into a visitor class
Move Expression::castTo to a visitor class