From e4e7e44765c27c788a2a679004f1f65e1fca8005 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 4 Mar 2020 14:12:54 -0800 Subject: Add an SDK attribute to DICompileUnit This is part of PR44213 https://bugs.llvm.org/show_bug.cgi?id=44213 When importing (system) Clang modules, LLDB needs to know which SDK (e.g., MacOSX, iPhoneSimulator, ...) they came from. While the sysroot attribute contains the absolute path to the SDK, this doesn't work well when the debugger is run on a different machine than the compiler, and the SDKs are installed in different directories. It thus makes sense to just store the name of the SDK instead of the absolute path, so it can be found relative to LLDB. rdar://problem/51645582 Differential Revision: https://reviews.llvm.org/D75646 --- llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/MetadataLoader.cpp') diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp index 9a78a2bbcb4f..17778e73f2f0 100644 --- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp +++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp @@ -1456,7 +1456,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( break; } case bitc::METADATA_COMPILE_UNIT: { - if (Record.size() < 14 || Record.size() > 21) + if (Record.size() < 14 || Record.size() > 22) return error("Invalid record"); // Ignore Record[0], which indicates whether this compile unit is @@ -1474,7 +1474,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( Record.size() <= 18 ? 0 : Record[18], false, // FIXME: https://reviews.llvm.org/rGc51b45e32ef7f35c11891f60871aa9c2c04cd991 // Record.size() <= 19 ? 0 : Record[19], - Record.size() <= 20 ? nullptr : getMDString(Record[20])); + Record.size() <= 20 ? nullptr : getMDString(Record[20]), + Record.size() <= 21 ? nullptr : getMDString(Record[21])); MetadataList.assignValue(CU, NextMetadataNo); NextMetadataNo++; -- cgit v1.2.3