[clang] [clang-tools-extra] Fix OOM in FormatDiagnostic (PR #108187)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 10:07:13 PDT 2024


AaronBallman wrote:

> > Have you run your changes with address and ub sanitizers to see if there are some uncaught edge cases?
> 
> Not quire sure I get the point about UB-sanitizers. I tested this changes against my proprietary code which caused the issue with OOM/infinite-loop and it works just fine. I can and will build the `clangd` with assertions enabled and test it against my codebase to try catching other cases.

Thanks! Mostly just trying to verify correctness given the breadth of changes; I didn't spot any UB, but it's easy for that to creep in.

> I wonder there should be some tests like:
> 
>     input = some source files
>     output = expected it compiles well and has no assertions fired
> 
> but not sure yet where to find such a tests-folder. I'm just a newbie in clang development workflow, so I wonder is someone more experienced would point me that.

Welcome! Most of our test coverage lives in `clang/test/` and tests individual components of the compiler. It looks like there are some good reduced test cases in the linked issue, now that I look more closely at the conversations there. I would recommend taking https://github.com/llvm/llvm-project/issues/70930#issuecomment-2209872975 and adding it as a test case to `clang/test/PCH`

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


More information about the cfe-commits mailing list