[PATCH] Fix memory leak for APValues that do memory allocation.

Manuel Klimek klimek at google.com
Fri May 10 13:51:54 PDT 2013



================
Comment at: lib/AST/APValue.cpp:235-240
@@ +234,8 @@
+    return getComplexFloatReal().needsCleanup();
+  case ComplexInt:
+    assert(!getComplexIntReal().needsCleanup() &&
+           "_Complex cannot be created with large enough real values.");
+    assert(!getComplexIntImag().needsCleanup() &&
+           "_Complex cannot be created with large enough real values.");
+    return false;
+  case LValue:
----------------
Richard Smith wrote:
> This seems likely to bite us in the future. Please implement this "properly" rather than asserting, even though it can't happen today.
So, do we need to check both here? Or is only one enough? Given how little I understand about the code I'm wary of implementing anything without being able to write any tests.
I'll give in eventually, but my gut feeling tells me that I'd want to know in the future when this changes, so I can go and write some test for it...


http://llvm-reviews.chandlerc.com/D736

BRANCH
  memory-leak

ARCANIST PROJECT
  clang



More information about the cfe-commits mailing list