llvm-project/clang/test/Analysis/analysis-after-multiple-dtors.cpp
isuckatcs d65379c8d4 [analyzer] Remove the loop from the exploded graph caused by missing information in program points
This patch adds CFGElementRef to ProgramPoints
and helps the analyzer to differentiate between
two otherwise identically looking ProgramPoints.

Fixes #60412

Differential Revision: https://reviews.llvm.org/D143328
2023-03-04 02:01:45 +01:00

29 lines
478 B
C++

// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
#include "Inputs/system-header-simulator-cxx.h"
struct Test {
Test() {}
~Test();
};
int foo() {
struct a {
// The dtor invocation of 'b' and 'c' used to create
// a loop in the egraph and the analysis stopped after
// this point.
Test b, c;
} d;
return 1;
}
int main() {
if (foo()) {
}
int x;
int y = x;
// expected-warning@-1{{Assigned value is garbage or undefined}}
(void)y;
}