[cfe-users] How to make #error or #warning work with libclang preprocessing?
Larry Gritz via cfe-users
cfe-users at lists.llvm.org
Fri Nov 6 16:51:34 PST 2020
I'm using clang libraries to implement the preprocessor for my language -- set up a CompilerInstance, setDiagnostics, ... DoPrintPreprocessedInput.
When I preprocess code that has a #error or #warning, it just gets reported as "invalid preprocessing directive" on the clang side, no different than if it were a "malformed" directive like "#foobar".
Can somebody point me in the right direction of how I can cause them to be treated as they are in C/C++ (print the error or warning as such, rather than complain about an unknown directive), or even better, to intercept #error or #warning preprocessor directives and pass them all the way to my compiler, just like #pragma gets passed along and I can handle it directly?
Thanks for any help you can give.
--
Larry Gritz
lg at larrygritz.com
More information about the cfe-users
mailing list