[cfe-dev] libclang cancellation of long running tasks

David Chisnall David.Chisnall at cl.cam.ac.uk
Tue Jan 13 03:46:56 PST 2015


On 13 Jan 2015, at 11:17, Manuel Klimek <klimek at google.com> wrote:
> 
> On Tue Jan 13 2015 at 12:13:53 PM John Sully <john at csquare.ca> wrote:
> > The problem is that most of the time is spent throughout various functions of Sema in clang, so the only way I see is to have every function in Sema check for abortion, which sounds like it would horribly clutter the code...
> 
> I don't think it needs to be that extreme.  Once every 100ms would be sufficient for my purposes which would drastically reduce the number of checks needed.  My own profiles are also showing a fair amount of time in the Lex code as well.  I'm still learning the code but I suspect it would be feasible to check in-between major phases.
> 
> I suspect it won't, but feel free to give it a try - for really long TUs we see all of the time spent in Sema trying to parse C++, and it's basically a flat profile.

A check in Sema at the start of processing each FunctionDecl might be enough.  Even long functions with a lot of template instantiations probably don't take more than 100ms in most code.  Unless you're trying to use libclang with the raytracer written in C++ templates or something equally silly (boost, perhaps)...

David





More information about the cfe-dev mailing list