[clang-format] [PR42014,PR52021] don't let clang-format assert/crash when file being...
authormydeveloperday <mydeveloperday@gmail.com>
Fri, 15 Oct 2021 08:46:35 +0000 (09:46 +0100)
committermydeveloperday <mydeveloperday@gmail.com>
Fri, 15 Oct 2021 08:46:35 +0000 (09:46 +0100)
commita92cf5a5a0cd01145f8db2ae09334a8b43a1271b
tree583c4f8b94ca88d2ae025e0259bcf70f77df02fd
parentb092dc0bb9e454720e37c562b2044c31b68f42f5
[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
clang/tools/clang-format/ClangFormat.cpp