[cfe-dev] adding FileSkipped() to PPCallbacks

Chris Lattner clattner at apple.com
Fri Apr 16 13:34:46 PDT 2010


On Apr 16, 2010, at 11:48 AM, Zhanyong Wan (λx.x x) wrote:

> Hi Doug,
> 
> Per our IRC chat yesterday, I'm extending PPCallbacks with a new
> method FileSkipped() to notify a listener when a #include is skipped
> due to header guard optimization.  Please see the attached patch and
> let me know if this is the right direction.  (I verified that it works
> for my use case.)  Also, how should I add a test for this?

The .h file change look fine to me, but it isn't good to sink the check below SourceMgr.createFileID.  Skipping headers is a fairly hot path, so we don't want it to do additional work when ppcallbacks aren't being used.

Please change the callback to take the FileEntry or some other information that doesn't require sinking the check below the potentially expensive work.

-Chris



More information about the cfe-dev mailing list