[libc] Remove global constructors on File type
The `File` interface currently has a destructor to delete the buffer if it is owned by the file. This is problematic for the globally allocated `stdout`, `stdin`, and `stderr` files. This causes the file interface to have global constructors to initialize the destructors to use these. However, these never use the destructors because they don't own the buffer. This patch removes the destructor and calls in manually in the close implementation. The platform close should never need to access the buffer and it needs to be done before clearing the whole thing, so this should work. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D155762
Loading
Please sign in to comment