3 ms·
If all you want is pure syntax with no semantics, check out tree sitter. You can get it past macros by pre-processing via alternative implementations in some ca
by dataflow 2y ago
If all you want is pure syntax with no semantics, check out tree sitter. You can get it past macros by pre-processing via alternative implementations in some cases.
But most likely you want some semantics.
The "one weird trick" you can pull here is that if all you want is syntactic manipulation, you mostly don't have to care about semantics and codegen, or anything past that (like linking or embedding resources) -- and you don't really have to care about most of the compiler flags, either. That takes out a fair bit of complexity. Moreover you can do the migration to Clang file-by-file, and you can do that with #ifndef __clang__ wherever you're certain the code is unaffected by your migration (which you can detect via compiling the file).
And on top of that you can use the most relaxed warnings possible in Clang - think MSVC compatibility flags and disabling all warnings and such.
I'm not suggesting it's trivial, but I've done it before, and it was not as daunting as I first imagined it. If you haven't tried these already, I would definitely give it a shot for a few files, and see how long it takes you on average per file.