The LLVM C API has a number of APIs that exist in two variants: One that works on a “global context” and one taking an explicit context argument.
The use of the global context APIs is discouraged, and we do not add any new APIs using the global context.
One of the most common mistakes when using the C API is to accidentally mix APIs using the global context and those using an explicit context. This results in seemingly nonsensical errors or silent misbehavior because types from multiple contexts are mixed. I regularly see confusion related to such issues on Discord.
I think at this point, these APIs are doing more damage than good. (They do make it marginally simpler to use the C API for very basic usage.)
I’d like to formally deprecate the functions working on the global context (with LLVM_ATTRIBUTE_C_DEPRECATED) and remove them after a few releases.
The implementation for the change can be found here: [llvm-c] Deprecate functions working on the global context by nikic · Pull Request #163979 · llvm/llvm-project · GitHub