Typo
[oota-llvm.git] / lib / VMCore / Metadata.cpp
1 //===-- Metadata.cpp - Implement Metadata classes -------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the Metadata classes.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/Metadata.h"
15 #include "llvm/Module.h"
16 #include "SymbolTableListTraitsImpl.h"
17 using namespace llvm;
18
19 //===----------------------------------------------------------------------===//
20 //MDNode implementation
21 //
22 MDNode::MDNode(Value*const* Vals, unsigned NumVals)
23   : MetadataBase(Type::MetadataTy, Value::MDNodeVal) {
24   for (unsigned i = 0; i != NumVals; ++i)
25     Node.push_back(WeakVH(Vals[i]));
26 }
27
28 void MDNode::Profile(FoldingSetNodeID &ID) const {
29   for (const_elem_iterator I = elem_begin(), E = elem_end(); I != E; ++I)
30     ID.AddPointer(*I);
31 }
32
33 //===----------------------------------------------------------------------===//
34 //NamedMDNode implementation
35 //
36 NamedMDNode::NamedMDNode(const Twine &N, MetadataBase*const* MDs, 
37                          unsigned NumMDs, Module *ParentModule)
38   : MetadataBase(Type::MetadataTy, Value::NamedMDNodeVal) {
39   setName(N);
40   for (unsigned i = 0; i != NumMDs; ++i)
41     Node.push_back(WeakMetadataVH(MDs[i]));
42   if (ParentModule)
43     ParentModule->getNamedMDList().push_back(this);
44 }