mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-21 12:35:47 -04:00

PreStmt<CXXNewExpr> was never called. Additionally, under c++-allocator-inlining=true, PostStmt<CXXNewExpr> was called twice when the allocator was inlined: once after evaluating the new-expression itself, once after evaluating the allocator call which, for the lack of better options, uses the new-expression as the call site. This patch fixes both problems. Differential Revision: https://reviews.llvm.org/D41934 rdar://problem/12180598 llvm-svn: 322797
30 lines
829 B
C++
30 lines
829 B
C++
// RUN: %clang_analyze_cc1 -analyzer-checker=debug.AnalysisOrder -analyzer-config c++-allocator-inlining=false,debug.AnalysisOrder:PreStmtCXXNewExpr=true,debug.AnalysisOrder:PostStmtCXXNewExpr=true,debug.AnalysisOrder:PreCall=true,debug.AnalysisOrder:PostCall=true,debug.AnalysisOrder:NewAllocator=true %s 2>&1 | FileCheck %s
|
|
|
|
#include "Inputs/system-header-simulator-cxx.h"
|
|
|
|
namespace std {
|
|
void *malloc(size_t);
|
|
}
|
|
|
|
void *operator new(size_t size) { return std::malloc(size); }
|
|
|
|
struct S {
|
|
S() {}
|
|
};
|
|
|
|
void foo();
|
|
|
|
void test() {
|
|
S *s = new S();
|
|
foo();
|
|
}
|
|
|
|
// CHECK: PreCall (S::S)
|
|
// CHECK-NEXT: PostCall (S::S)
|
|
// CHECK-NEXT: PreStmt<CXXNewExpr>
|
|
// CHECK-NEXT: PostStmt<CXXNewExpr>
|
|
// CHECK-NEXT: PreCall (foo)
|
|
// CHECK-NEXT: PostCall (foo)
|
|
// CHECK-NEXT: PreCall (std::malloc)
|
|
// CHECK-NEXT: PostCall (std::malloc)
|