[cfe-dev] [analyzer] Pruning path diagnostic notes

via cfe-dev cfe-dev at lists.llvm.org
Sat Jun 20 20:13:17 PDT 2020

Hi list,

Is there any way to get a BugReporterVisitor to delete path diagnostic
notes that occur at program points that my plugin doesn't consider

For example,

void f() {
  if (!someResult())
  if (!otherResult())
  int foo = 3;

If I am checking that neverCallThisAPIWith3() is never called with 3, then
in this case there are a lot of irrelevant path diagnostic notes due to the
early returns. (e.g. we always see "note: Taking false branch" on the
if-statements, but if we took the true branch on either of them, then we
wouldn't get to the 'foo' part.) Really what I want to show in my
diagnostic is notes that concern the value of variable 'foo'. If possible,
I'd like to prune the notes that distinguish the path from other paths
where 'foo' is never even declared.

Is this possible? I don't see any method in the docs to delete a note from
a BugReport, in the first place. (Even disregarding the question of whether
the criterion that I mentioned for discarding path notes is possible)

Philip C
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200620/a4b45f6c/attachment-0001.html>

More information about the cfe-dev mailing list