Clean up file, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89974 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky 2009-11-26 22:54:26 +00:00
parent 5bda3792b4
commit 2353122a3c

View File

@ -33,10 +33,8 @@ MDString *MDString::get(LLVMContext &Context, StringRef Str) {
StringMapEntry<MDString *> &Entry = StringMapEntry<MDString *> &Entry =
pImpl->MDStringCache.GetOrCreateValue(Str); pImpl->MDStringCache.GetOrCreateValue(Str);
MDString *&S = Entry.getValue(); MDString *&S = Entry.getValue();
if (S) return S; if (!S) S = new MDString(Context, Entry.getKey());
return S;
return S =
new MDString(Context, Entry.getKey());
} }
MDString *MDString::get(LLVMContext &Context, const char *Str) { MDString *MDString::get(LLVMContext &Context, const char *Str) {
@ -44,10 +42,8 @@ MDString *MDString::get(LLVMContext &Context, const char *Str) {
StringMapEntry<MDString *> &Entry = StringMapEntry<MDString *> &Entry =
pImpl->MDStringCache.GetOrCreateValue(Str ? StringRef(Str) : StringRef()); pImpl->MDStringCache.GetOrCreateValue(Str ? StringRef(Str) : StringRef());
MDString *&S = Entry.getValue(); MDString *&S = Entry.getValue();
if (S) return S; if (!S) new MDString(Context, Entry.getKey());
return S;
return S =
new MDString(Context, Entry.getKey());
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -74,28 +70,19 @@ MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals) {
ID.AddPointer(Vals[i]); ID.AddPointer(Vals[i]);
void *InsertPoint; void *InsertPoint;
MDNode *N; MDNode *N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
{
N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
}
if (N) return N;
N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
if (!N) { if (!N) {
// InsertPoint will have been set by the FindNodeOrInsertPos call. // InsertPoint will have been set by the FindNodeOrInsertPos call.
N = new MDNode(Context, Vals, NumVals); N = new MDNode(Context, Vals, NumVals);
pImpl->MDNodeSet.InsertNode(N, InsertPoint); pImpl->MDNodeSet.InsertNode(N, InsertPoint);
} }
return N; return N;
} }
/// ~MDNode - Destroy MDNode. /// ~MDNode - Destroy MDNode.
MDNode::~MDNode() { MDNode::~MDNode() {
{
LLVMContextImpl *pImpl = getType()->getContext().pImpl; LLVMContextImpl *pImpl = getType()->getContext().pImpl;
pImpl->MDNodeSet.RemoveNode(this); pImpl->MDNodeSet.RemoveNode(this);
}
delete [] Node; delete [] Node;
Node = NULL; Node = NULL;
} }
@ -241,7 +228,7 @@ public:
/// the same metadata to In2. /// the same metadata to In2.
void copyMD(Instruction *In1, Instruction *In2); void copyMD(Instruction *In1, Instruction *In2);
/// getHandlerNames - Populate client supplied smallvector using custome /// getHandlerNames - Populate client-supplied smallvector using custom
/// metadata name and ID. /// metadata name and ID.
void getHandlerNames(SmallVectorImpl<std::pair<unsigned, StringRef> >&) const; void getHandlerNames(SmallVectorImpl<std::pair<unsigned, StringRef> >&) const;