I've installed a pragma callback via Preprocessor::addPPCallbacks. The callback
function just stores the text of the pragma line. For this I use Preprocessor::Lex
and Preprocessor::getSpelling, which works fine.
Since the pragma line has to be handled normally afterwards, I start in my callback with
Preprocessor::EnableBacktrackAtThisPos and call Preprocessor::Backtrack before returning.
This works as long as the pragma is known and somehow parsed and handled at line 139.
If it is not handled there, then the parser has to move to Tok::eod, which is actually achieved at line 144.
However this doesn't work in my case, since EnableBacktrackAtThisPos enters the caching mode, but
Backtrack doesn't leave it. Then CurPPLexer is 0 and the next pragma token is lexed as part of the
program (and compilation will normally fail).
I guess that's a bug.
I've tried LookAhead instead of Lex and backtracking, but this fails too for the same reason. Now I am
out of ideas how to work around this bug.
Has anyone a hint?