From ce99a6e49ee5f849c33aa1a989b4cc08c71c3c9b Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 20 Sep 2009 04:03:34 +0000 Subject: [PATCH] Strip trailing whitespace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82359 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Value.cpp | 82 ++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index dcac01ce47a..773623b8bb4 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -64,11 +64,11 @@ Value::~Value() { LLVMContext &Context = getContext(); Context.pImpl->TheMetadata.ValueIsDeleted(this); } - + // Notify all ValueHandles (if present) that this value is going away. if (HasValueHandle) ValueHandleBase::ValueIsDeleted(this); - + #ifndef NDEBUG // Only in -g mode... // Check to make sure that there are no uses of this value that are still // around when the value is destroyed. If there are, then we have a dangling @@ -89,7 +89,7 @@ Value::~Value() { // at this point. if (Name) Name->Destroy(); - + // There should be no uses of this object anymore, remove it. LeakDetector::removeGarbageObject(this); } @@ -142,13 +142,13 @@ static bool getSymTab(Value *V, ValueSymbolTable *&ST) { if (Function *PP = P->getParent()) ST = &PP->getValueSymbolTable(); } else if (BasicBlock *BB = dyn_cast(V)) { - if (Function *P = BB->getParent()) + if (Function *P = BB->getParent()) ST = &P->getValueSymbolTable(); } else if (GlobalValue *GV = dyn_cast(V)) { - if (Module *P = GV->getParent()) + if (Module *P = GV->getParent()) ST = &P->getValueSymbolTable(); } else if (Argument *A = dyn_cast(V)) { - if (Function *P = A->getParent()) + if (Function *P = A->getParent()) ST = &P->getValueSymbolTable(); } else if (NamedMDNode *N = dyn_cast(V)) { if (Module *P = N->getParent()) { @@ -192,7 +192,7 @@ void Value::setName(const Twine &NewName) { assert(getType() != Type::getVoidTy(getContext()) && "Cannot assign a name to void values!"); - + // Get the symbol table to update for this object. ValueSymbolTable *ST; if (getSymTab(this, ST)) @@ -205,19 +205,19 @@ void Value::setName(const Twine &NewName) { Name = 0; return; } - + if (Name) Name->Destroy(); - + // NOTE: Could optimize for the case the name is shrinking to not deallocate // then reallocated. - + // Create the new name. Name = ValueName::Create(NameStr, NameStr+NameLen); Name->setValue(this); return; } - + // NOTE: Could optimize for the case the name is shrinking to not deallocate // then reallocated. if (hasName()) { @@ -236,7 +236,7 @@ void Value::setName(const Twine &NewName) { /// takeName - transfer the name from V to this value, setting V's name to -/// empty. It is an error to call V->takeName(V). +/// empty. It is an error to call V->takeName(V). void Value::takeName(Value *V) { ValueSymbolTable *ST = 0; // If this value has a name, drop it. @@ -248,19 +248,19 @@ void Value::takeName(Value *V) { if (V->hasName()) V->setName(""); return; // Cannot set a name on this value (e.g. constant). } - + // Remove old name. if (ST) ST->removeValueName(Name); Name->Destroy(); Name = 0; - } - + } + // Now we know that this has no name. - + // If V has no name either, we're done. if (!V->hasName()) return; - + // Get this's symtab if we didn't before. if (!ST) { if (getSymTab(this, ST)) { @@ -269,12 +269,12 @@ void Value::takeName(Value *V) { return; // Cannot set a name on this value (e.g. constant). } } - + // Get V's ST, this should always succed, because V has a name. ValueSymbolTable *VST; bool Failure = getSymTab(V, VST); assert(!Failure && "V has a name, so it should have a ST!"); Failure=Failure; - + // If these values are both in the same symtab, we can do this very fast. // This works even if both values have no symtab yet. if (ST == VST) { @@ -284,16 +284,16 @@ void Value::takeName(Value *V) { Name->setValue(this); return; } - + // Otherwise, things are slightly more complex. Remove V's name from VST and // then reinsert it into ST. - + if (VST) VST->removeValueName(V->Name); Name = V->Name; V->Name = 0; Name->setValue(this); - + if (ST) ST->reinsertValue(this); } @@ -309,7 +309,7 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) { // Notify all ValueHandles (if present) that this value is going away. if (HasValueHandle) ValueHandleBase::ValueIsRAUWd(this, New); - + while (!use_empty()) { Use &U = *UseList; // Must handle Constants specially, we cannot call replaceUsesOfWith on a @@ -320,7 +320,7 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) { continue; } } - + U.set(New); } } @@ -382,7 +382,7 @@ Value *Value::getUnderlyingObject() { /// return the value in the PHI node corresponding to PredBB. If not, return /// ourself. This is useful if you want to know the value something has in a /// predecessor block. -Value *Value::DoPHITranslation(const BasicBlock *CurBB, +Value *Value::DoPHITranslation(const BasicBlock *CurBB, const BasicBlock *PredBB) { PHINode *PN = dyn_cast(this); if (PN && PN->getParent() == CurBB) @@ -400,7 +400,7 @@ LLVMContext &Value::getContext() const { return VTy->getContext(); } /// List is known to point into the existing use list. void ValueHandleBase::AddToExistingUseList(ValueHandleBase **List) { assert(List && "Handle list is null?"); - + // Splice ourselves into the list. Next = *List; *List = this; @@ -414,9 +414,9 @@ void ValueHandleBase::AddToExistingUseList(ValueHandleBase **List) { /// AddToUseList - Add this ValueHandle to the use list for VP. void ValueHandleBase::AddToUseList() { assert(VP && "Null pointer doesn't have a use list!"); - + LLVMContextImpl *pImpl = VP->getContext().pImpl; - + if (VP->HasValueHandle) { // If this value already has a ValueHandle, then it must be in the // ValueHandles map already. @@ -425,7 +425,7 @@ void ValueHandleBase::AddToUseList() { AddToExistingUseList(&Entry); return; } - + // Ok, it doesn't have any handles yet, so we must insert it into the // DenseMap. However, doing this insertion could cause the DenseMap to // reallocate itself, which would invalidate all of the PrevP pointers that @@ -433,19 +433,19 @@ void ValueHandleBase::AddToUseList() { // updating the stale pointers only if needed. DenseMap &Handles = pImpl->ValueHandles; const void *OldBucketPtr = Handles.getPointerIntoBucketsArray(); - + ValueHandleBase *&Entry = Handles[VP]; assert(Entry == 0 && "Value really did already have handles?"); AddToExistingUseList(&Entry); VP->HasValueHandle = true; - + // If reallocation didn't happen or if this was the first insertion, don't // walk the table. - if (Handles.isPointerIntoBucketsArray(OldBucketPtr) || + if (Handles.isPointerIntoBucketsArray(OldBucketPtr) || Handles.size() == 1) { return; } - + // Okay, reallocation did happen. Fix the Prev Pointers. for (DenseMap::iterator I = Handles.begin(), E = Handles.end(); I != E; ++I) { @@ -461,14 +461,14 @@ void ValueHandleBase::RemoveFromUseList() { // Unlink this from its use list. ValueHandleBase **PrevPtr = getPrevPtr(); assert(*PrevPtr == this && "List invariant broken"); - + *PrevPtr = Next; if (Next) { assert(Next->getPrevPtr() == &Next && "List invariant broken"); Next->setPrevPtr(PrevPtr); return; } - + // If the Next pointer was null, then it is possible that this was the last // ValueHandle watching VP. If so, delete its entry from the ValueHandles // map. @@ -489,12 +489,12 @@ void ValueHandleBase::ValueIsDeleted(Value *V) { LLVMContextImpl *pImpl = V->getContext().pImpl; ValueHandleBase *Entry = pImpl->ValueHandles[V]; assert(Entry && "Value bit set but no entries exist"); - + while (Entry) { // Advance pointer to avoid invalidation. ValueHandleBase *ThisNode = Entry; Entry = Entry->Next; - + switch (ThisNode->getKind()) { case Assert: #ifndef NDEBUG // Only in -g mode... @@ -513,7 +513,7 @@ void ValueHandleBase::ValueIsDeleted(Value *V) { break; } } - + // All callbacks and weak references should be dropped by now. assert(!V->HasValueHandle && "All references to V were not removed?"); } @@ -522,19 +522,19 @@ void ValueHandleBase::ValueIsDeleted(Value *V) { void ValueHandleBase::ValueIsRAUWd(Value *Old, Value *New) { assert(Old->HasValueHandle &&"Should only be called if ValueHandles present"); assert(Old != New && "Changing value into itself!"); - + // Get the linked list base, which is guaranteed to exist since the // HasValueHandle flag is set. LLVMContextImpl *pImpl = Old->getContext().pImpl; ValueHandleBase *Entry = pImpl->ValueHandles[Old]; assert(Entry && "Value bit set but no entries exist"); - + while (Entry) { // Advance pointer to avoid invalidation. ValueHandleBase *ThisNode = Entry; Entry = Entry->Next; - + switch (ThisNode->getKind()) { case Assert: // Asserting handle does not follow RAUW implicitly. -- 2.11.0