[clang] [clang-format] Limit how much work guessLanguage() can do (PR #78925)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 22 01:02:59 PST 2024
HighCommander4 wrote:
> If we add a `bool GuessObjC` parameter to `guessLanguage()`, would that solve the problem?
I assume you mean making it so that when clangd calls into `guessLanguage()`, the ObjC guessing algorithm is skipped entirely.
I had a similar idea originally (discussed around [here](https://github.com/clangd/clangd/issues/719#issuecomment-1790284919)) but I realized that this introduces the possibility that a `.h` file is treated as one language when formatted by clangd, and a different language when formatted by clang-format (and so you could get e.g. a user's editor (which uses clangd) fighting back and forth with e.g. a post-commit hook (which uses clang-format)).
So, I don't think this is a viable approach; we'd be trading a crash affecting a small number of `.h` files, for a less severe but annoying issue potentially affecting a much larger set of `.h` files.
https://github.com/llvm/llvm-project/pull/78925
More information about the cfe-commits
mailing list