Previously, llvm-cvtres crashes on .res files which are empty except for
the null header. This allows the library to simply pass over them.
Details
Diff Detail
- Build Status
Buildable 9585 Build 9585: arc lint + arc unit
Event Timeline
llvm/include/llvm/Object/WindowsResource.h | ||
---|---|---|
92 | What is ID? | |
llvm/lib/Object/WindowsResource.cpp | ||
68 | I'm not sure if I understand this code correctly. Does this swallow Err if a new error occurs? If you can change this part of code, a better approach to create an instance of some class whose constructor can fail is to provide a factory function and returns an Error or a new instance from the factory function. For example, instead of providing a ctor that can fail, you could provide a static member function: static ErrorOr<ResourceEntryRef> ResourceEntryRef::create(BinaryStreamRef Ref, const WindowsResource *Owner); which in turn call the ctor only when all conditions are met (thus the ctor is free from failure.) | |
136 | Does this ignore errors? Crash bug needs to be fixed, but I wonder if an empty file should be considered as a valid input. |
Make factory function instead of having constructor fail.
llvm/include/llvm/Object/WindowsResource.h | ||
---|---|---|
92 | Ah you're right it's not necessary. Normally subclasses of ErrorInfo need to have this defined or else the linker won't be happy but I guess that only applies to direct non-virtual subclasses. | |
llvm/lib/Object/WindowsResource.cpp | ||
136 | Not an empty file, it still contains PE header magic and an empty, null entry. So it's a valid .res file that just doesn't contain any records, which I could see being valid in some cases. Also, the original cvtres does not crash/throw error on empty .res. A completely empty file would fail upon WindowsResource::createWindowsResource(). |
What is ID?