[cfe-dev] Temporarily silence Parser diagnostics

Jan Korous via cfe-dev cfe-dev at lists.llvm.org
Wed Feb 14 10:27:39 PST 2018


Hi all,

Is there a mechanism how to temporarily silence Parser diagnostics in runtime?

The story is that I know there's a bug in input source code and would like to produce helpful error message (FixIt). I speculate what kind of bug it is and check if my guess is right by calling appropriate Parser method. I am using RevertingTentativeParsingAction but Parser methods are printing diagnostics whenever something doesn’t look right. This means that if my assumption about developer’s mistake is wrong I will output false diagnostics so I need a way how to silence diagnostics for the duration of speculative parse (I am interested only in bool result of the attempt).

AFAIK Parser::Diag() is used by all Parser methods to get output stream for diagnostics. So even if there’s nothing ready I might just add some private on/off switch to Parser. Does that make sense?

Thanks.

Best,

Jan


More information about the cfe-dev mailing list