Yeah, no, I mean, good text diagnostics for the static analyzer are less valuable than good text diagnostics for traditional compiler warnings. They’re still nice to have but the static analyzer itself has much fewer users (being treated as largely a separate tool), and most of the users of such tools are already using a better visualizer than anything that can ever be built on the command line.
So my point is, I think you should focus on individual traditional compiler warnings and their individual needs. Which may be more varied in requirements, but also more immediately useful to the larger user base. This isn’t what I have immediate ideas about, you probably already have more specific ideas than me. But I’m definitely generally excited about developing better ways to communicate with our users and making warnings more visual, more friendly. Many warnings are too nuanced to explain in a single statement of text. Attaching a picture, even if it’s just ASCII art is just so powerful. If you build anything that could be useful for a broader class of static analysis tools I’d be happy to integrate your solution into those tools, but it probably shouldn’t be a requirement on your project, or even your primary source of inspiration.
Another group of folks who may be interested in your work is the FlowSensitive
team (cc @ymand!) - they’re building a framework for Data Flow analysis, for use in compiler proper as well as in static analysis tools.
In the area of flow-sensitive analysis I actually have a specific suggestion that I’m running around with: as these flow-sensitive warnings become smarter, it may be a good idea to display them to the user all at once. I.e., instead of displaying 3 separate warnings:
warning: variable ‘x’ is uninitialized when used here
warning: this statement is never executed
warning: this if-condition is always false
…it may be a good idea to emit a single combined warning:
warning: variable ‘x’ is uninitialized when used here
note: …BECAUSE the statement that was supposed to initialize ‘x’ is never executed
note: …BECAUSE the if-condition that guards that statement is always false
(Assuming that these three warnings are actually in this kind of cause-and-effect relationship.)
This allows the developers of such warnings to find much deeper bugs without worrying that they’ll be too hard to for the user to understand. (This isn’t necessarily a visualization problem. A system of notes may do a sufficiently good job, just like in the static analyzer text output. But it definitely calls for something more than a simple text message. It’s likely that displaying a portion of code as-is and overlaying all these warnings on top of it, connected by arrows, would be as beneficial here as it already is in static analyzer world.)
Another somewhat interesting area is, some static analysis diagnostics require non-trivial “constraint solving” (read, SAT/SMT solving). I don’t think any existing compiler warnings do anything close to that level of complexity, but FlowSensitive
based warnings may potentially get pretty close to that, where even if they don’t ship a full-featured SAT solver they’d certainly look like they should have. Visualizing the system of constraints that are being fed to the solver, and maybe to some extent the solution (if the solver can explain it at all), could be valuable. It’s already a large-ish problem in the clang static analyzer world where we struggle to improve our ad-hoc constraint solver because any such improvements will unfortunately make diagnostics harder to understand. So this could be an interesting area to look into.
But again, I think any work done on basic compiler warnings is probably going to have a bigger impact on humanity’s well-being. So I think you can keep it in mind that the problems I describe exist, but don’t focus on them too much unless you independently discover them in your work on traditional compiler warnings.