aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-02-11 22:32:29 +0000
committerBill Wendling <isanbard@gmail.com>2013-02-11 22:32:29 +0000
commit04ef4be048934f8acf15c4ed6e3ebdd410c252bb (patch)
tree0cdb9246af54364823db06430c6cc0ba13c473fb /lib/Bitcode
parente3db2048ea2ce2743acce76a6bb22214a197c364 (diff)
downloadexternal_llvm-04ef4be048934f8acf15c4ed6e3ebdd410c252bb.zip
external_llvm-04ef4be048934f8acf15c4ed6e3ebdd410c252bb.tar.gz
external_llvm-04ef4be048934f8acf15c4ed6e3ebdd410c252bb.tar.bz2
Use a std::map so that we record the group ID.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174910 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp13
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.h2
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 30ba85e..476c68a 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -531,8 +531,7 @@ bool BitcodeReader::ParseAttributeGroupBlock() {
if (Record.size() < 3)
return Error("Invalid ENTRY record");
- // FIXME: Record[0] is the 'group ID'. What should we do with it here?
-
+ uint64_t GrpID = Record[0];
uint64_t Idx = Record[1]; // Index of the object this attribute refers to.
AttrBuilder B;
@@ -545,27 +544,29 @@ bool BitcodeReader::ParseAttributeGroupBlock() {
else
B.addStackAlignmentAttr(Record[++i]);
} else { // String attribute
+ assert((Record[i] == 3 || Record[i] == 4) &&
+ "Invalid attribute group entry");
bool HasValue = (Record[i++] == 4);
SmallString<64> KindStr;
SmallString<64> ValStr;
while (Record[i] != 0 && i != e)
KindStr += Record[i++];
- assert(Record[i] == 0 && "Kind string not terminated with 0");
+ assert(Record[i] == 0 && "Kind string not null terminated");
if (HasValue) {
// Has a value associated with it.
- ++i; // Skip the '0' that terminates the kind string.
+ ++i; // Skip the '0' that terminates the "kind" string.
while (Record[i] != 0 && i != e)
ValStr += Record[i++];
- assert(Record[i] == 0 && "Value string not terminated with 0");
+ assert(Record[i] == 0 && "Value string not null terminated");
}
B.addAttribute(KindStr.str(), ValStr.str());
}
}
- MAttributeGroups.push_back(AttributeSet::get(Context, Idx, B));
+ MAttributeGroups[GrpID] = AttributeSet::get(Context, Idx, B);
break;
}
}
diff --git a/lib/Bitcode/Reader/BitcodeReader.h b/lib/Bitcode/Reader/BitcodeReader.h
index 8d36e67..28674eb 100644
--- a/lib/Bitcode/Reader/BitcodeReader.h
+++ b/lib/Bitcode/Reader/BitcodeReader.h
@@ -149,7 +149,7 @@ class BitcodeReader : public GVMaterializer {
std::vector<AttributeSet> MAttributes;
/// \brief The set of attribute groups.
- std::vector<AttributeSet> MAttributeGroups;
+ std::map<unsigned, AttributeSet> MAttributeGroups;
/// FunctionBBs - While parsing a function body, this is a list of the basic
/// blocks for the function.