Page MenuHomePhabricator

Cleanup pragma handlers after DoPrintPreprocessedInput

Authored by teemperor on Apr 25 2017, 7:05 AM.



The UnknownPragmaHandlers added by t`DoPrintPreprocessedInput` conflict with the real PragmaHandlers from clang::Parser because they try to handle the same #pragma directives. This makes it impossible to use a Preprocessor (that was previously passed to DoPrintPreprocessedInput), as an Preprocessor for a clang::Parser instance which is what we currently do in cling. This patch removes the added UnknownPragmaHandler to avoid conflicts these conflicts and leave the PragmaHandlers of the Preprocessors in a the same state as before calling DoPrintPreprocessedInput.

Diff Detail

Event Timeline

teemperor created this revision.Apr 25 2017, 7:05 AM

Please move the =new out of the PP.AddPragmaHandler calls.
While at it, this code still (as the original) leaks the PragmaHandlers. These should be deleted after RemovePragmaHandler or instead, simply use std::unique_ptr.

teemperor updated this revision to Diff 96561.Apr 25 2017, 7:48 AM
  • Now using unique_ptr instead of raw pointers.
This revision is now accepted and ready to land.Apr 25 2017, 7:59 AM

Raphael , do you have commit access? should I commit this?

Yaron, I can take care of this. Thanks for asking. Raphael and I are working together.

v.g.vassilev closed this revision.Apr 27 2017, 10:12 AM

Landed in r301563.