[PATCH] D5104: [analyzer] [proposal] Fix for PR20653

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 09:59:16 PDT 2015


NoQ added a subscriber: NoQ.
NoQ added a comment.

While investigating http://reviews.llvm.org/D12726 , i accidentally came up with a way to test this patch; with the extension of `ExprInspectionChecker` in the aforementioned review, which allows testing SymbolReaper directly, the following test passes as soon as the old (accepted) version of this diff is applied:

  void clang_analyzer_warnOnDeadSymbol(int);
  void clang_analyzer_warnIfReached(void);
  
  // SymbolRegionValue should live as long as its region is live but has no
  // direct bindings that override its value.
  void test_region_value_lifetime_after_binding(int x) {
    clang_analyzer_warnOnDeadSymbol(x);
    if (x) {}
    x = 0;
    (void)0; // expected-warning{{SYMBOL DEAD}}
    if (x) {
      clang_analyzer_warnIfReached(); // no-warning
    }
  } // no-warning


http://reviews.llvm.org/D5104





More information about the cfe-commits mailing list