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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to