From 8ae12039925631052e0da159782e7513b8e7d450 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 7 May 2014 06:21:57 +0000 Subject: [C++11] Use 'nullptr'. llvm-svn: 208163 --- clang/lib/Rewrite/Core/RewriteRope.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'clang/lib/Rewrite/Core/RewriteRope.cpp') diff --git a/clang/lib/Rewrite/Core/RewriteRope.cpp b/clang/lib/Rewrite/Core/RewriteRope.cpp index 135f42a207c..ef8abfcadc0 100644 --- a/clang/lib/Rewrite/Core/RewriteRope.cpp +++ b/clang/lib/Rewrite/Core/RewriteRope.cpp @@ -146,7 +146,7 @@ namespace { RopePieceBTreeLeaf **PrevLeaf, *NextLeaf; public: RopePieceBTreeLeaf() : RopePieceBTreeNode(true), NumPieces(0), - PrevLeaf(0), NextLeaf(0) {} + PrevLeaf(nullptr), NextLeaf(nullptr) {} ~RopePieceBTreeLeaf() { if (PrevLeaf || NextLeaf) removeFromLeafInOrder(); @@ -171,7 +171,7 @@ namespace { const RopePieceBTreeLeaf *getNextLeafInOrder() const { return NextLeaf; } void insertAfterLeafInOrder(RopePieceBTreeLeaf *Node) { - assert(PrevLeaf == 0 && NextLeaf == 0 && "Already in ordering"); + assert(!PrevLeaf && !NextLeaf && "Already in ordering"); NextLeaf = Node->NextLeaf; if (NextLeaf) @@ -186,7 +186,7 @@ namespace { if (NextLeaf) NextLeaf->PrevLeaf = PrevLeaf; } else if (NextLeaf) { - NextLeaf->PrevLeaf = 0; + NextLeaf->PrevLeaf = nullptr; } } @@ -236,7 +236,7 @@ RopePieceBTreeNode *RopePieceBTreeLeaf::split(unsigned Offset) { // specified offset so find it. if (Offset == 0 || Offset == size()) { // Fastpath for a common case. There is already a splitpoint at the end. - return 0; + return nullptr; } // Find the piece that this offset lands in. @@ -250,7 +250,7 @@ RopePieceBTreeNode *RopePieceBTreeLeaf::split(unsigned Offset) { // If there is already a split point at the specified offset, just return // success. if (PieceOffs == Offset) - return 0; + return nullptr; // Otherwise, we need to split piece 'i' at Offset-PieceOffs. Convert Offset // to being Piece relative. @@ -296,7 +296,7 @@ RopePieceBTreeNode *RopePieceBTreeLeaf::insert(unsigned Offset, Pieces[i] = R; ++NumPieces; Size += R.size(); - return 0; + return nullptr; } // Otherwise, if this is leaf is full, split it in two halves. Since this @@ -470,7 +470,7 @@ namespace { RopePieceBTreeNode *RopePieceBTreeInterior::split(unsigned Offset) { // Figure out which child to split. if (Offset == 0 || Offset == size()) - return 0; // If we have an exact offset, we're already split. + return nullptr; // If we have an exact offset, we're already split. unsigned ChildOffset = 0; unsigned i = 0; @@ -479,12 +479,12 @@ RopePieceBTreeNode *RopePieceBTreeInterior::split(unsigned Offset) { // If already split there, we're done. if (ChildOffset == Offset) - return 0; + return nullptr; // Otherwise, recursively split the child. if (RopePieceBTreeNode *RHS = getChild(i)->split(Offset-ChildOffset)) return HandleChildPiece(i, RHS); - return 0; // Done! + return nullptr; // Done! } /// insert - Insert the specified ropepiece into this tree node at the @@ -515,7 +515,7 @@ RopePieceBTreeNode *RopePieceBTreeInterior::insert(unsigned Offset, if (RopePieceBTreeNode *RHS = getChild(i)->insert(Offset-ChildOffs, R)) return HandleChildPiece(i, RHS); - return 0; + return nullptr; } /// HandleChildPiece - A child propagated an insertion result up to us. @@ -531,7 +531,7 @@ RopePieceBTreeInterior::HandleChildPiece(unsigned i, RopePieceBTreeNode *RHS) { (getNumChildren()-i-1)*sizeof(Children[0])); Children[i+1] = RHS; ++NumChildren; - return 0; + return nullptr; } // Okay, this node is full. Split it in half, moving WidthFactor children to @@ -678,10 +678,10 @@ RopePieceBTreeIterator::RopePieceBTreeIterator(const void *n) { while (CurNode && getCN(CurNode)->getNumPieces() == 0) CurNode = getCN(CurNode)->getNextLeafInOrder(); - if (CurNode != 0) + if (CurNode) CurPiece = &getCN(CurNode)->getPiece(0); else // Empty tree, this is an end() iterator. - CurPiece = 0; + CurPiece = nullptr; CurChar = 0; } @@ -697,10 +697,10 @@ void RopePieceBTreeIterator::MoveToNextPiece() { CurNode = getCN(CurNode)->getNextLeafInOrder(); while (CurNode && getCN(CurNode)->getNumPieces() == 0); - if (CurNode != 0) + if (CurNode) CurPiece = &getCN(CurNode)->getPiece(0); else // Hit end(). - CurPiece = 0; + CurPiece = nullptr; CurChar = 0; } -- cgit v1.2.3