LLVMTargetMachineEmitToFile takes non-const char*

Any reason why LLVMTargetMachineEmitToFile takes char *Filename and not const char *Filename? It looks to me like it just converts it to a StringRef, which doesn’t require it to be mutable, and it’s annoying to cast away a const, or to copy it to an array on stack before calling the function.

Would a PR to make it const be acceptable?

In isolation no but remember that this is part of the C API (LLVM Developer Policy — LLVM 15.0.0git documentation).

I’m not sure where the bar is for a small change to the API like this. You can pass non-const to const so at least existing code would continue to work.

Submit a patch and see what the reviewers say. If you don’t know already - Contributing to LLVM — LLVM 15.0.0git documentation