[PATCH] D36083: [utils] Add a script that runs clang in LLDB and stops it when a specified diagnostic is emitted

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 31 11:10:11 PDT 2017


arphaman added a comment.

It might make sense to add a breakpoint at `PartialDiagnostic(unsigned DiagID, StorageAllocator &Allocator)`, I'll check how that works.

I reckon it should be possible to have a script that could find the name of all emitted diagnostics. Let's say we'd like to run clang with `-cc1 main.cpp`.
If we run it in LLDB and put a breakpoint at DiagnosticsEngine::Report, we could add a command to that breakpoint that would print a unique string and the diagnostic id.
The script would redirect the stdout from LLDB/Clang, but it would replace the occurrence of the unique string and diagnostic id with the name of the diagnostic by evaluating some `diagtool` that maps the id back to the diagnostic (If there are multiple same diagnostics it could also add an id and then we could extend this script to stop at the Nth specific diagnostic).


Repository:
  rL LLVM

https://reviews.llvm.org/D36083





More information about the cfe-commits mailing list