From d0cf5b2de355cb5ec6ec90a7057f60a4d2a10169 Mon Sep 17 00:00:00 2001 From: Manuel Klimek Date: Mon, 3 Jun 2013 13:03:05 +0000 Subject: Introduce needsCleanup() for APFloat and APInt. This is needed in clang so one can check if the object needs the destructor called after its memory was freed. This is useful when creating many APInt/APFloat objects with placement new, where the overhead of tracking the pointers for cleanup is significant. llvm-svn: 183100 --- llvm/lib/Support/APFloat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Support/APFloat.cpp') diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 16586fbc9e8..2ad66c5687c 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -580,7 +580,7 @@ APFloat::initialize(const fltSemantics *ourSemantics) void APFloat::freeSignificand() { - if (partCount() > 1) + if (needsCleanup()) delete [] significand.parts; } -- cgit v1.2.3