[clang] [clang-format] Limit how much work guessLanguage() can do (PR #78925)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 12:38:57 PST 2024


HighCommander4 wrote:

> couldn't we just use the .clang-format-ignore file to say... hey don't bother with this file, we can't do it...

I think that's a good solution for avoiding the OOM when actually trying to format the file, in combination with this patch for avoiding the OOM in `guessLanguage()`.

The reason this is such a severe issue for clangd is that clangd calls into `guessLanguage()` whenever such a file is opened, thereby triggering the OOM for any downstream user of such a single-header library who happens to open the library in their editor, not just developers of the library itself.

https://github.com/llvm/llvm-project/pull/78925


More information about the cfe-commits mailing list