Fangrui Song 97ccf6b8c1 compiler-rt: Rename .cc file in test/lsan to .cpp
Like r367463, but for test/lsan.

llvm-svn: 367803
2019-08-05 07:04:42 +00:00

24 lines
492 B
C++

// Test that leaks detected after forking without exec().
// RUN: %clangxx_lsan %s -o %t && not %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
int main() {
pid_t pid = fork();
assert(pid >= 0);
if (pid > 0) {
int status = 0;
waitpid(pid, &status, 0);
assert(WIFEXITED(status));
return WEXITSTATUS(status);
} else {
malloc(1337);
// CHECK: LeakSanitizer: detected memory leaks
}
return 0;
}