mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
b092c4f505
This library provides a thin locking wrapper around clang::tooling invocations. It should be used instead of performing direct clang::tooling invocations by all programs that use revng-c and may run more than one ClangTool concurrently. This is necessary because clang::tooling internally uses llvm's cl::opt for parsing command line options. cl::opt uses a global variable for the parser under the hood so parsing two command lines concurrently is not safe. Similarly, cl::opt typically uses global variables to hold options, so it is not safe to execute a ClangTool concurrently to another tool that is parsing a new set of options, because there might be race conditions between threads reading and writing the same options at the same time. The new library introduces a thin locking layer so that the end-user does not need to know or worry about these details.