IR: Remove MDMapTy and MDPairTy typedefs, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 24 Apr 2015 20:19:13 +0000 (20:19 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 24 Apr 2015 20:19:13 +0000 (20:19 +0000)
Remove some typedefs in preparation for factoring out attachment logic
from `Instruction`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235764 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/LLVMContextImpl.h
lib/IR/Metadata.cpp

index aa4c697455bb23c18dd03a005380608da8e1c665..0ca8e3548087de97f9a0dffcc37697ebb335346c 100644 (file)
@@ -951,11 +951,10 @@ public:
   /// CustomMDKindNames - Map to hold the metadata string to ID mapping.
   StringMap<unsigned> CustomMDKindNames;
 
-  typedef std::pair<unsigned, TrackingMDNodeRef> MDPairTy;
-  typedef SmallVector<MDPairTy, 2> MDMapTy;
-
   /// Collection of per-instruction metadata used in this context.
-  DenseMap<const Instruction *, MDMapTy> InstructionMetadata;
+  DenseMap<const Instruction *,
+           SmallVector<std::pair<unsigned, TrackingMDNodeRef>, 2>>
+      InstructionMetadata;
 
   /// DiscriminatorTable - This table maps file:line locations to an
   /// integer representing the next DWARF path discriminator to assign to
index 886c084fb99fddcda691c5d209a6df6fbd268cbb..6e54fa918b3c86ddb05e17667b7334622b94eba6 100644 (file)
@@ -997,8 +997,7 @@ void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) {
   if (!hasMetadataHashEntry())
     return; // Nothing to remove!
 
-  DenseMap<const Instruction *, LLVMContextImpl::MDMapTy> &InstructionMetadata =
-      getContext().pImpl->InstructionMetadata;
+  auto &InstructionMetadata = getContext().pImpl->InstructionMetadata;
 
   if (KnownSet.empty()) {
     // Just drop our entry at the store.
@@ -1007,7 +1006,7 @@ void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) {
     return;
   }
 
-  LLVMContextImpl::MDMapTy &Info = InstructionMetadata[this];
+  auto &Info = InstructionMetadata[this];
   unsigned I;
   unsigned E;
   // Walk the array and drop any metadata we don't know.
@@ -1045,8 +1044,7 @@ void Instruction::setMetadata(unsigned KindID, MDNode *Node) {
   
   // Handle the case when we're adding/updating metadata on an instruction.
   if (Node) {
-    LLVMContextImpl::MDMapTy &Info =
-        getContext().pImpl->InstructionMetadata[this];
+    auto &Info = getContext().pImpl->InstructionMetadata[this];
     assert(!Info.empty() == hasMetadataHashEntry() &&
            "HasMetadata bit is wonked");
     if (Info.empty()) {
@@ -1072,8 +1070,7 @@ void Instruction::setMetadata(unsigned KindID, MDNode *Node) {
          "HasMetadata bit out of date!");
   if (!hasMetadataHashEntry())
     return;  // Nothing to remove!
-  LLVMContextImpl::MDMapTy &Info =
-      getContext().pImpl->InstructionMetadata[this];
+  auto &Info = getContext().pImpl->InstructionMetadata[this];
 
   // Common case is removing the only entry.
   if (Info.size() == 1 && Info[0].first == KindID) {
@@ -1106,8 +1103,7 @@ MDNode *Instruction::getMetadataImpl(unsigned KindID) const {
 
   if (!hasMetadataHashEntry()) return nullptr;
 
-  LLVMContextImpl::MDMapTy &Info =
-      getContext().pImpl->InstructionMetadata[this];
+  auto &Info = getContext().pImpl->InstructionMetadata[this];
   assert(!Info.empty() && "bit out of sync with hash table");
 
   for (const auto &I : Info)
@@ -1130,8 +1126,7 @@ void Instruction::getAllMetadataImpl(
   assert(hasMetadataHashEntry() &&
          getContext().pImpl->InstructionMetadata.count(this) &&
          "Shouldn't have called this");
-  const LLVMContextImpl::MDMapTy &Info =
-      getContext().pImpl->InstructionMetadata.find(this)->second;
+  const auto &Info = getContext().pImpl->InstructionMetadata.find(this)->second;
   assert(!Info.empty() && "Shouldn't have called this");
 
   Result.reserve(Result.size() + Info.size());
@@ -1149,8 +1144,7 @@ void Instruction::getAllMetadataOtherThanDebugLocImpl(
   assert(hasMetadataHashEntry() &&
          getContext().pImpl->InstructionMetadata.count(this) &&
          "Shouldn't have called this");
-  const LLVMContextImpl::MDMapTy &Info =
-      getContext().pImpl->InstructionMetadata.find(this)->second;
+  const auto &Info = getContext().pImpl->InstructionMetadata.find(this)->second;
   assert(!Info.empty() && "Shouldn't have called this");
   Result.reserve(Result.size() + Info.size());
   for (auto &I : Info)