This is an archive of the discontinued LLVM Phabricator instance.

[libc] Handle allocation failures in the dirent API gracefully.
ClosedPublic

Authored by sivachandra on Dec 14 2022, 5:36 PM.

Details

Summary

Along the way, setting of errno has been moved out of the internal code.

Diff Detail

Event Timeline

sivachandra created this revision.Dec 14 2022, 5:36 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 14 2022, 5:36 PM
sivachandra requested review of this revision.Dec 14 2022, 5:36 PM
lntue added inline comments.Dec 15 2022, 6:53 AM
libc/src/__support/CPP/CMakeLists.txt
105

Maybe change the name to new_and_delete or new_delete?

libc/src/__support/CPP/new.h
72

Why are these delete operators defined differently compared to new?

Add a comment explaining why operator delete is not implemented inline and why
we assign them special linkage names.

libc/src/__support/CPP/CMakeLists.txt
105

The target names here reflect the header file name. So, I am inclined to keep it as is for the sake of consistency.

libc/src/__support/CPP/new.h
72

Thanks for asking - I have added a comment now explaining that aspect.

lntue added inline comments.Dec 15 2022, 11:59 AM
libc/src/__support/CPP/CMakeLists.txt
105

Yes, that's actually what I meant, since in this patch, the header new.h defines both new and delete operators, and new.cpp only implements delete operators. It's probably better to rename both the header and the cpp files also.

sivachandra added inline comments.Dec 15 2022, 12:05 PM
libc/src/__support/CPP/CMakeLists.txt
105

Ah - we try to keep the header file names in sync with C++ standard header file names: https://eel.is/c++draft/new.syn

lntue accepted this revision.Dec 15 2022, 12:54 PM
This revision is now accepted and ready to land.Dec 15 2022, 12:54 PM
This revision was landed with ongoing or failed builds.Dec 15 2022, 1:05 PM
This revision was automatically updated to reflect the committed changes.