Revert "Add workaround for false positive in -Wfree-nonheap-object"
authorChristopher Di Bella <cjdb@google.com>
Wed, 21 Jul 2021 21:29:24 +0000 (21:29 +0000)
committerChristopher Di Bella <cjdb@google.com>
Wed, 21 Jul 2021 21:30:17 +0000 (21:30 +0000)
This reverts commit 499571ea835daf786626a0db1e12f890b6cd8f8d.

mlir/lib/IR/OperationSupport.cpp

index 60910f7..b1feab3 100644 (file)
@@ -237,9 +237,7 @@ detail::OperandStorage::~OperandStorage() {
   if (isDynamicStorage()) {
     TrailingOperandStorage &storage = getDynamicStorage();
     storage.~TrailingOperandStorage();
-    // Workaround false positive in -Wfree-nonheap-object
-    auto *mem = &storage;
-    free(mem);
+    free(&storage);
   } else {
     getInlineStorage().~TrailingOperandStorage();
   }
@@ -373,11 +371,8 @@ MutableArrayRef<OpOperand> detail::OperandStorage::resize(Operation *owner,
     new (&newOperands[numOperands]) OpOperand(owner);
 
   // If the current storage is also dynamic, free it.
-  if (isDynamicStorage()) {
-    // Workaround false positive in -Wfree-nonheap-object
-    auto *mem = &storage;
-    free(mem);
-  }
+  if (isDynamicStorage())
+    free(&storage);
 
   // Update the storage representation to use the new dynamic storage.
   dynamicStorage.setPointerAndInt(newStorage, true);