aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/Writer/ValueEnumerator.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-01-07 19:39:36 +0000
committerDevang Patel <dpatel@apple.com>2010-01-07 19:39:36 +0000
commit0386f01e061513094504bc11f8352a40173cada7 (patch)
tree94c2edcbcfba8906e22099dcf3a2c6ef2ebc8897 /lib/Bitcode/Writer/ValueEnumerator.cpp
parent3c37bb8dbe886993dcd8f37dec0d94762393f3d4 (diff)
Use separate namespace for named metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92931 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer/ValueEnumerator.cpp')
-rw-r--r--lib/Bitcode/Writer/ValueEnumerator.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp
index c409c2066d..54bf84d261 100644
--- a/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -74,9 +74,10 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
// Enumerate types used by the type symbol table.
EnumerateTypeSymbolTable(M->getTypeSymbolTable());
- // Insert constants that are named at module level into the slot pool so that
- // the module symbol table can refer to them...
+ // Insert constants and metadata that are named at module level into the slot
+ // pool so that the module symbol table can refer to them...
EnumerateValueSymbolTable(M->getValueSymbolTable());
+ EnumerateMDSymbolTable(M->getMDSymbolTable());
SmallVector<std::pair<unsigned, MDNode*>, 8> MDs;
@@ -196,6 +197,14 @@ void ValueEnumerator::EnumerateValueSymbolTable(const ValueSymbolTable &VST) {
EnumerateValue(VI->getValue());
}
+/// EnumerateMDSymbolTable - Insert all of the values in the specified metadata
+/// table.
+void ValueEnumerator::EnumerateMDSymbolTable(const MDSymbolTable &MST) {
+ for (MDSymbolTable::const_iterator MI = MST.begin(), ME = MST.end();
+ MI != ME; ++MI)
+ EnumerateValue(MI->getValue());
+}
+
void ValueEnumerator::EnumerateMetadata(const MetadataBase *MD) {
// Check to see if it's already in!
unsigned &MDValueID = MDValueMap[MD];