Move Module::toCBuffer and genhdrfile into free functions
Merge pull request #3290 from yebblies/hdrgen

[DDMD] [refactor] Move Module::toCBuffer and genhdrfile into free functions