<div dir="ltr">Hi,<div><br></div><div>I am writing a code generator to generate language bindings in C# for an existing C++ API using clang libtooling.</div><div><br></div><div>Our C++ interface has platform specific code.  In order to handle this in the code generation, I see two possible approaches.</div><div><ol><li>Do a build such that all platforms are defined such that all possible code is included in the build</li><li>Run clang libtooling on each platform, and merge the resulting code.</li></ol></div><div>In either case, clang::PPCallbacks looks great for getting preprocessor information.</div><div>#if defined (WIN_32)</div><div>...</div><div>#endif</div><div><br></div><div>I have two questions</div><div><ol><li>It would be a lot easier to run the code generation on one platform, using approach #1 above, while enabling all the platform specific code.  The blocker to this issue is that one platform's specific definitions won't be available on another platform.  Is there a way to invoke clang such that it continues, without error, if it encounters types that it does not recognize?</li><li>While using the PPCallbacks interface, we are notified when a #if, #elif, #else, #endif is present and provided a sourceRange.  Is the correct way to determine what was inside these preprocessor definitions to compare the source ranges from the end of the #if to the start of the #endif?</li></ol></div><div><br></div><div>Thanks,</div><div>Justin</div></div>