From 434859c97edb5bbbde3ceabbbfc266e7c6004757 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Sat, 23 Apr 2016 04:52:47 +0000 Subject: [PATCH] Avoid MSVC failure with default arguments in lambdas from r267270 http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11700 llvm-svn: 267277 --- lib/Bitcode/Reader/BitcodeReader.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 7cd95cc6c9a..734d317234b 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1998,17 +1998,21 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) { PlaceholderQueue Placeholders; bool IsDistinct; - auto getMD = [&](unsigned ID, bool AllowPlaceholders = true) -> Metadata * { - if (!IsDistinct || !AllowPlaceholders) + auto getMD = [&](unsigned ID) -> Metadata * { + if (!IsDistinct) return MetadataList.getMetadataFwdRef(ID); if (auto *MD = MetadataList.getMetadataIfResolved(ID)) return MD; return &Placeholders.getPlaceholderOp(ID); }; - auto getMDOrNull = [&](unsigned ID, - bool AllowPlaceholders = true) -> Metadata * { + auto getMDOrNull = [&](unsigned ID) -> Metadata * { if (ID) - return getMD(ID - 1, AllowPlaceholders); + return getMD(ID - 1); + return nullptr; + }; + auto getMDOrNullWithoutPlaceholders = [&](unsigned ID) -> Metadata * { + if (ID) + return MetadataList.getMetadataFwdRef(ID - 1); return nullptr; }; auto getMDString = [&](unsigned ID) -> MDString *{ @@ -2331,8 +2335,7 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) { MetadataList.assignValue(CU, NextMetadataNo++); // Move the Upgrade the list of subprograms. - if (Metadata *SPs = - getMDOrNull(Record[11], /* AllowPlaceholders = */ false)) + if (Metadata *SPs = getMDOrNullWithoutPlaceholders(Record[11])) CUSubprograms.push_back({CU, SPs}); break; }