NoQ added a comment.

In D105637#2864684 <https://reviews.llvm.org/D105637#2864684>, @balazske wrote:

> Could not make a simple test for the change. This file F17831281: 
> BugReportInterestingnessTest.cpp <https://reviews.llvm.org/F17831281> is what 
> I could do, but it prints the needed text to the console. Is it possible to 
> get the note texts in the program?

You could define your own diagnostic consumer in the unittest and intercept all 
the notes. But at this point i'd rather turn this into a LIT test by turning 
your checker mock into a `debug.ExprInspection` item and using 
`-analyzer-output=text` to test notes:

  void foo(x) {
    clang_analyzer_noteIfInteresting(x); // no-note
    clang_analyzer_markNotInteresting(x);
    clang_analyzer_noteIfInteresting(x); // expected-note{{INTERESTING}}
    clang_analyzer_markInteresting(x);
    clang_analyzer_warnIfReached(); // expected-warning{{TRUE}}
  }                                 // expected-note@-1{{TRUE}}


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105637/new/

https://reviews.llvm.org/D105637

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to