Fix memory leak introduced by llvmorg-11-init-11960-gbab6df86aef.
authorRichard Smith <richard@metafoo.co.uk>
Thu, 16 Apr 2020 02:38:49 +0000 (19:38 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Thu, 16 Apr 2020 02:39:39 +0000 (19:39 -0700)
clang/lib/AST/DeclCXX.cpp

index 8857a71..6c611c2 100644 (file)
@@ -3246,6 +3246,9 @@ APValue &MSGuidDecl::getAsAPValue() const {
       Arr.getArrayInitializedElt(I) =
           APValue(APSInt(APInt(8, PartVal.Part4And5[I]), true));
     }
+    // Register this APValue to be destroyed if necessary. (Note that the
+    // MSGuidDecl destructor is never run.)
+    getASTContext().addDestruction(&APVal);
   }
 
   return APVal;