[clang-format] [PR42014,PR52021] don't let clang-format assert/crash when file being formatted is read-only/locked

This is a bug which gets reported from time to time and we've had multiple attempts to fix it, but don't want to fix it by adding frontEnd to the mix.

This patch aim to find a trivial, but not that sophisticated way of emitting the error without the additional impact of adding libFrontEnd to clang-format.
See {D90121} for analysis of why we don't want those previous attempts

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D111815

GitOrigin-RevId: a92cf5a5a0cd01145f8db2ae09334a8b43a1271b
1 file changed