[cfe-dev] Preprocessor parse #error
Robert Zimmermann
tsett at gmx.net
Mon Mar 31 09:09:17 PDT 2014
Hello,
as written in the subject I want to parse #error from a header-file.
I have the following structure for all my header-files and I want to
check it with a clangtool:
#ifndef _<name>_H_
#define _<name>_H_
<some code>
#else
#error <error message>
#endif
Now I manage to collect everything except of #error.
For this I use SourceFileCallback in newFrontendAction and on
beginSourceFile I add a PPCallback to the Preprocessor.
A callback exists in PPCallback for everything except of #error, so I
tried to overload the handle-function of Preprocessor but it is not
virtual and so it is not called.
In addition I tried to use the LookAhead-function of Preprocessor but he
just write the error and I don't receive the token.
Is there a better way to handle the preprocessor stuff and how can I
parse #error?
Kind regards,
Robert
More information about the cfe-dev
mailing list