summaryrefslogtreecommitdiffstats
path: root/lib/Bitcode
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bitcode')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp8
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp4
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 87c4fd7..a417c68 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -766,6 +766,7 @@ bool BitcodeReader::ParseMetadata() {
continue;
}
+ bool IsFunctionLocal = false;
// Read a record.
Record.clear();
switch (Stream.ReadRecord(Code, Record)) {
@@ -804,6 +805,9 @@ bool BitcodeReader::ParseMetadata() {
MDValueList.AssignValue(V, NextValueNo++);
break;
}
+ case bitc::METADATA_FN_NODE:
+ IsFunctionLocal = true;
+ // fall-through
case bitc::METADATA_NODE: {
if (Record.empty() || Record.size() % 2 == 1)
return Error("Invalid METADATA_NODE record");
@@ -819,7 +823,9 @@ bool BitcodeReader::ParseMetadata() {
else
Elts.push_back(NULL);
}
- Value *V = MDNode::get(Context, &Elts[0], Elts.size());
+ Value *V = MDNode::getWhenValsUnresolved(Context, &Elts[0], Elts.size(),
+ IsFunctionLocal);
+ IsFunctionLocal = false;
MDValueList.AssignValue(V, NextValueNo++);
break;
}
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index d34e24c..26c922a 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -484,7 +484,9 @@ static void WriteMDNode(const MDNode *N,
Record.push_back(0);
}
}
- Stream.EmitRecord(bitc::METADATA_NODE, Record, 0);
+ unsigned MDCode = N->isFunctionLocal() ? bitc::METADATA_FN_NODE :
+ bitc::METADATA_NODE;
+ Stream.EmitRecord(MDCode, Record, 0);
Record.clear();
}