llvm.org GIT mirror llvm / e88f1b3
Object: support empty UID/GID fields Normal archives do not have empty UID/GID fields. However, the Microsoft Import library format is a customized archive (it just uses an alternate symbol index format). When the import library is constructed by lib.exe, the UID and GID fields are left empty. Do not abort on such an input. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274528 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 3 years ago
3 changed file(s) with 13 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
6868
6969 unsigned ArchiveMemberHeader::getUID() const {
7070 unsigned Ret;
71 if (StringRef(UID, sizeof(UID)).rtrim(' ').getAsInteger(10, Ret))
71 StringRef User = StringRef(UID, sizeof(UID)).rtrim(' ');
72 if (User.empty())
73 return 0;
74 if (User.getAsInteger(10, Ret))
7275 llvm_unreachable("UID time not a decimal number.");
7376 return Ret;
7477 }
7578
7679 unsigned ArchiveMemberHeader::getGID() const {
7780 unsigned Ret;
78 if (StringRef(GID, sizeof(GID)).rtrim(' ').getAsInteger(10, Ret))
81 StringRef Group = StringRef(GID, sizeof(GID)).rtrim(' ');
82 if (Group.empty())
83 return 0;
84 if (Group.getAsInteger(10, Ret))
7985 llvm_unreachable("GID time not a decimal number.");
8086 return Ret;
8187 }
0 !
1 library.dll/ 28800 0 0 `
0 RUN: llvm-ar tv %S/Inputs/msvc-import.lib | FileCheck %s
1
2 CHECK: --------- 0/0 0 1970-01-01 00:00:00.000000000 library.dll