diff options
author | Craig Topper <craig.topper@gmail.com> | 2014-05-21 05:09:00 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2014-05-21 05:09:00 +0000 |
commit | 8a13c4180e1a50fd4458ad522e2c271ce8ceb3d6 (patch) | |
tree | be98b83ca922b4a9f79937f9166969913f2edcb8 /clang/lib/CodeGen/CGStmt.cpp | |
parent | 5c35c8c9abc2a830c912c70d51c72197917470c7 (diff) | |
download | bcm5719-llvm-8a13c4180e1a50fd4458ad522e2c271ce8ceb3d6.tar.gz bcm5719-llvm-8a13c4180e1a50fd4458ad522e2c271ce8ceb3d6.zip |
[C++11] Use 'nullptr'. CodeGen edition.
llvm-svn: 209272
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 44142300165..d30781f22f0 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -221,7 +221,7 @@ CodeGenFunction::EmitCompoundStmtWithoutScope(const CompoundStmt &S, E = S.body_end()-GetLast; I != E; ++I) EmitStmt(*I); - llvm::Value *RetAlloca = 0; + llvm::Value *RetAlloca = nullptr; if (GetLast) { // We have to special case labels here. They are statements, but when put // at the end of a statement expression, they yield the value of their @@ -850,7 +850,7 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) { // for side effects. if (RV) EmitAnyExpr(RV); - } else if (RV == 0) { + } else if (!RV) { // Do nothing (return value is left uninitialized) } else if (FnRetTy->isReferenceType()) { // If this function returns a reference, take the address of the expression @@ -880,7 +880,7 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) { } ++NumReturnExprs; - if (RV == 0 || RV->isEvaluatable(getContext())) + if (!RV || RV->isEvaluatable(getContext())) ++NumSimpleReturnExprs; cleanupScope.ForceCleanup(); @@ -984,7 +984,7 @@ void CodeGenFunction::EmitCaseStmtRange(const CaseStmt &S) { llvm::Value *Cond = Builder.CreateICmpULE(Diff, Builder.getInt(Range), "inbounds"); - llvm::MDNode *Weights = 0; + llvm::MDNode *Weights = nullptr; if (SwitchWeights) { uint64_t ThisCount = CaseCnt.getCount(); uint64_t DefaultCount = (*SwitchWeights)[0]; @@ -1068,7 +1068,7 @@ void CodeGenFunction::EmitCaseStmt(const CaseStmt &S) { const CaseStmt *NextCase = dyn_cast<CaseStmt>(S.getSubStmt()); // Otherwise, iteratively add consecutive cases to this switch stmt. - while (NextCase && NextCase->getRHS() == 0) { + while (NextCase && NextCase->getRHS() == nullptr) { CurCase = NextCase; llvm::ConstantInt *CaseVal = Builder.getInt(CurCase->getLHS()->EvaluateKnownConstInt(getContext())); @@ -1129,7 +1129,7 @@ static CSFC_Result CollectStatementsForCase(const Stmt *S, bool &FoundCase, SmallVectorImpl<const Stmt*> &ResultStmts) { // If this is a null statement, just succeed. - if (S == 0) + if (!S) return Case ? CSFC_Success : CSFC_FallThrough; // If this is the switchcase (case 4: or default) that we're looking for, then @@ -1137,7 +1137,7 @@ static CSFC_Result CollectStatementsForCase(const Stmt *S, if (const SwitchCase *SC = dyn_cast<SwitchCase>(S)) { if (S == Case) { FoundCase = true; - return CollectStatementsForCase(SC->getSubStmt(), 0, FoundCase, + return CollectStatementsForCase(SC->getSubStmt(), nullptr, FoundCase, ResultStmts); } @@ -1148,7 +1148,7 @@ static CSFC_Result CollectStatementsForCase(const Stmt *S, // If we are in the live part of the code and we found our break statement, // return a success! - if (Case == 0 && isa<BreakStmt>(S)) + if (!Case && isa<BreakStmt>(S)) return CSFC_Success; // If this is a switch statement, then it might contain the SwitchCase, the @@ -1193,7 +1193,7 @@ static CSFC_Result CollectStatementsForCase(const Stmt *S, // statements in the compound statement as candidates for inclusion. assert(FoundCase && "Didn't find case but returned fallthrough?"); // We recursively found Case, so we're not looking for it anymore. - Case = 0; + Case = nullptr; // If we found the case and skipped declarations, we can't do the // optimization. @@ -1207,7 +1207,7 @@ static CSFC_Result CollectStatementsForCase(const Stmt *S, // If we have statements in our range, then we know that the statements are // live and need to be added to the set of statements we're tracking. for (; I != E; ++I) { - switch (CollectStatementsForCase(*I, 0, FoundCase, ResultStmts)) { + switch (CollectStatementsForCase(*I, nullptr, FoundCase, ResultStmts)) { case CSFC_Failure: return CSFC_Failure; case CSFC_FallThrough: // A fallthrough result means that the statement was simple and just @@ -1258,7 +1258,7 @@ static bool FindCaseStatementsForValue(const SwitchStmt &S, // First step, find the switch case that is being branched to. We can do this // efficiently by scanning the SwitchCase list. const SwitchCase *Case = S.getSwitchCaseList(); - const DefaultStmt *DefaultCase = 0; + const DefaultStmt *DefaultCase = nullptr; for (; Case; Case = Case->getNextSwitchCase()) { // It's either a default or case. Just remember the default statement in @@ -1280,10 +1280,10 @@ static bool FindCaseStatementsForValue(const SwitchStmt &S, // If we didn't find a matching case, we use a default if it exists, or we // elide the whole switch body! - if (Case == 0) { + if (!Case) { // It is safe to elide the body of the switch if it doesn't contain labels // etc. If it is safe, return successfully with an empty ResultStmts list. - if (DefaultCase == 0) + if (!DefaultCase) return !CodeGenFunction::ContainsLabel(&S); Case = DefaultCase; } @@ -1314,7 +1314,7 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { llvm::APSInt ConstantCondValue; if (ConstantFoldsToSimpleInteger(S.getCond(), ConstantCondValue)) { SmallVector<const Stmt*, 4> CaseStmts; - const SwitchCase *Case = 0; + const SwitchCase *Case = nullptr; if (FindCaseStatementsForValue(S, ConstantCondValue, CaseStmts, getContext(), Case)) { if (Case) { @@ -1331,7 +1331,7 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { // At this point, we are no longer "within" a switch instance, so // we can temporarily enforce this to ensure that any embedded case // statements are not emitted. - SwitchInsn = 0; + SwitchInsn = nullptr; // Okay, we can dead code eliminate everything except this case. Emit the // specified series of statements and we're good. @@ -1437,7 +1437,7 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { static std::string SimplifyConstraint(const char *Constraint, const TargetInfo &Target, - SmallVectorImpl<TargetInfo::ConstraintInfo> *OutCons=0) { + SmallVectorImpl<TargetInfo::ConstraintInfo> *OutCons=nullptr) { std::string Result; while (*Constraint) { |