mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-19 19:45:40 -04:00

If not possible, use the last line of the declaration, as before. Differential Revision: https://reviews.llvm.org/D52326 llvm-svn: 342768
22 lines
476 B
C++
22 lines
476 B
C++
// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus.NewDelete -verify %s
|
|
|
|
#include "Inputs/system-header-simulator-cxx.h"
|
|
|
|
struct S {
|
|
S() : Data(new int) {}
|
|
~S() { delete Data; }
|
|
int *getData() { return Data; }
|
|
|
|
private:
|
|
int *Data;
|
|
};
|
|
|
|
int *freeAfterReturnTemp() {
|
|
return S().getData(); // expected-warning {{Use of memory after it is freed}}
|
|
}
|
|
|
|
int *freeAfterReturnLocal() {
|
|
S X;
|
|
return X.getData(); // expected-warning {{Use of memory after it is freed}}
|
|
}
|