mirror of
https://github.com/intel/llvm.git
synced 2026-01-19 00:54:48 +08:00
Add UUID::SetFromOptionalStringRef, use it in DynamicLoaderDarwin
We use UUID::fromOptionalData to read UUID's from the Mach-O files, so UUID's of all 0's are invalid UUID's. We also get uuid's from debugserver, which need to match the file UUID's. So we need an API that treats "000000000" as invalid as well. Added that and use it. Differential Revision: https://reviews.llvm.org/D57195 llvm-svn: 352122
This commit is contained in:
@@ -109,3 +109,15 @@ size_t UUID::SetFromStringRef(llvm::StringRef str, uint32_t num_uuid_bytes) {
|
||||
// Else return zero to indicate we were not able to parse a UUID value
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t UUID::SetFromOptionalStringRef(llvm::StringRef str,
|
||||
uint32_t num_uuid_bytes) {
|
||||
size_t num_chars_consumed = SetFromStringRef(str, num_uuid_bytes);
|
||||
if (num_chars_consumed) {
|
||||
if (llvm::all_of(m_bytes, [](uint8_t b) { return b == 0; }))
|
||||
Clear();
|
||||
}
|
||||
|
||||
return num_chars_consumed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user