diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-21 21:01:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-21 21:01:47 +0000 |
commit | d3a6d90da74a59150ad781feb7cae0406c13e324 (patch) | |
tree | 0883d3158d017c6a2852269474dc010b03ebb242 /lib/VMCore/Metadata.cpp | |
parent | 717ce2b8d81f0c12145248e92c37ee7547276ce2 (diff) | |
download | llvm-d3a6d90da74a59150ad781feb7cae0406c13e324.tar.gz llvm-d3a6d90da74a59150ad781feb7cae0406c13e324.tar.bz2 llvm-d3a6d90da74a59150ad781feb7cae0406c13e324.tar.xz |
tidy up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94100 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Metadata.cpp')
-rw-r--r-- | lib/VMCore/Metadata.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index acc3b8ee5e..7141fbd843 100644 --- a/lib/VMCore/Metadata.cpp +++ b/lib/VMCore/Metadata.cpp @@ -126,23 +126,29 @@ static const Function *getFunctionForValue(Value *V) { if (!V) return NULL; if (Instruction *I = dyn_cast<Instruction>(V)) return I->getParent()->getParent(); - if (BasicBlock *BB = dyn_cast<BasicBlock>(V)) return BB->getParent(); - if (Argument *A = dyn_cast<Argument>(V)) return A->getParent(); + if (BasicBlock *BB = dyn_cast<BasicBlock>(V)) + return BB->getParent(); + if (Argument *A = dyn_cast<Argument>(V)) + return A->getParent(); return NULL; } #ifndef NDEBUG static const Function *assertLocalFunction(const MDNode *N) { - if (!N->isFunctionLocal()) return NULL; + if (!N->isFunctionLocal()) return 0; - const Function *F = NULL, *NewF = NULL; + const Function *F = 0, *NewF = 0; for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) { if (Value *V = N->getOperand(i)) { - if (MDNode *MD = dyn_cast<MDNode>(V)) NewF = assertLocalFunction(MD); - else NewF = getFunctionForValue(V); + if (MDNode *MD = dyn_cast<MDNode>(V)) + NewF = assertLocalFunction(MD); + else + NewF = getFunctionForValue(V); } - if (F && NewF) assert(F == NewF && "inconsistent function-local metadata"); - else if (!F) F = NewF; + if (F == 0) + F = NewF; + else + assert((NewF == 0 || F == NewF) &&"inconsistent function-local metadata"); } return F; } @@ -161,7 +167,8 @@ const Function *MDNode::getFunction() const { for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { if (Value *V = getOperand(i)) { if (MDNode *MD = dyn_cast<MDNode>(V)) { - if (const Function *F = MD->getFunction()) return F; + if (const Function *F = MD->getFunction()) + return F; } else { return getFunctionForValue(V); } |