forked from OSchip/llvm-project
Add workaround for false positive in -Wfree-nonheap-object
This commit is contained in:
parent
2554f99b55
commit
499571ea83
|
@ -237,7 +237,9 @@ detail::OperandStorage::~OperandStorage() {
|
|||
if (isDynamicStorage()) {
|
||||
TrailingOperandStorage &storage = getDynamicStorage();
|
||||
storage.~TrailingOperandStorage();
|
||||
free(&storage);
|
||||
// Workaround false positive in -Wfree-nonheap-object
|
||||
auto *mem = &storage;
|
||||
free(mem);
|
||||
} else {
|
||||
getInlineStorage().~TrailingOperandStorage();
|
||||
}
|
||||
|
@ -371,8 +373,11 @@ MutableArrayRef<OpOperand> detail::OperandStorage::resize(Operation *owner,
|
|||
new (&newOperands[numOperands]) OpOperand(owner);
|
||||
|
||||
// If the current storage is also dynamic, free it.
|
||||
if (isDynamicStorage())
|
||||
free(&storage);
|
||||
if (isDynamicStorage()) {
|
||||
// Workaround false positive in -Wfree-nonheap-object
|
||||
auto *mem = &storage;
|
||||
free(mem);
|
||||
}
|
||||
|
||||
// Update the storage representation to use the new dynamic storage.
|
||||
representation = reinterpret_cast<intptr_t>(newStorage);
|
||||
|
|
Loading…
Reference in New Issue