[libTooling] Is a CodeGenAction safe to use with a libTooling Executor?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[libTooling] Is a CodeGenAction safe to use with a libTooling Executor?

Kristóf Umann via cfe-dev
I've been prototyping a standalone tool that uses libTooling's executor (specifically the AllTUs executor) to run over a compile_commands.json. 

My diagnostics come from the LLVM backend, so using a CodeGenAction seems like it should be the right choice, however I'm running into a number of memory corruption bugs that don't seem to be present either in my code or in other clang tools. I suspect this is due to my use of the LLVM backend with the executor's thread pool.

Running under TSAN shows a number of races occurring after the executor starts, some occur within libTooling, some inside LLVM passes. These races span a number of  data types, most commonly strings, vectors, and streams. I'm fairly confident that the memory corruption stems from these data races.

Other frontend actions don't seem to suffer this issue, and I don't see anything in the executor documentation restricting it from being used with a CodeGenAction.

Is this a known issue? or is this the intended design of the executors? 

Ideally I would like to be able to take advantage of any concurrency available, but right now that seems like it won't be possible without some significant changes to either libTooling or the LLVM backend.

Thoughts or suggestions on how to best proceed with this are appreciated.

--
Paul Kirth

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev