summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-13 21:10:44 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-13 21:10:44 +0000
commit6a4848324bc8ed9789e3d9d99e8715b1667547d3 (patch)
tree0d7be7c5469f3d78cc75b980930e1f0c72c2d674 /llvm/lib/Bitcode/Reader
parenta4f2925bd10233f143ef92a4df18a5f2457df0dd (diff)
downloadbcm5719-llvm-6a4848324bc8ed9789e3d9d99e8715b1667547d3.tar.gz
bcm5719-llvm-6a4848324bc8ed9789e3d9d99e8715b1667547d3.zip
AsmParser/Bitcode: Add support for MDLocation
This adds assembly and bitcode support for `MDLocation`. The assembly side is rather big, since this is the first `MDNode` subclass (that isn't `MDTuple`). Part of PR21433. (If you're wondering where the mountains of testcase updates are, we don't need them until I update `DILocation` and `DebugLoc` to actually use this class.) llvm-svn: 225830
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 6f58f2241a6..60a380d5d26 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1267,6 +1267,20 @@ std::error_code BitcodeReader::ParseMetadata() {
NextMDValueNo++);
break;
}
+ case bitc::METADATA_LOCATION: {
+ if (Record.size() != 5)
+ return Error("Invalid record");
+
+ auto get = Record[0] ? MDLocation::getDistinct : MDLocation::get;
+ unsigned Line = Record[1];
+ unsigned Column = Record[2];
+ MDNode *Scope = cast<MDNode>(MDValueList.getValueFwdRef(Record[3]));
+ Metadata *InlinedAt =
+ Record[4] ? MDValueList.getValueFwdRef(Record[4] - 1) : nullptr;
+ MDValueList.AssignValue(get(Context, Line, Column, Scope, InlinedAt),
+ NextMDValueNo++);
+ break;
+ }
case bitc::METADATA_STRING: {
std::string String(Record.begin(), Record.end());
llvm::UpgradeMDStringConstant(String);
OpenPOWER on IntegriCloud