Index: include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h =================================================================== --- include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h +++ include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h @@ -161,6 +161,12 @@ /// Visitor that tries to report interesting diagnostics from conditions. class ConditionBRVisitor final : public BugReporterVisitor { + typedef llvm::DenseMap ConstraintMap; + ConstraintMap Constraints; + + typedef llvm::DenseMap CondMessageMap; + CondMessageMap CondMessages; + // FIXME: constexpr initialization isn't supported by MSVC2013. static const char *const GenericTrueMessage; static const char *const GenericFalseMessage; @@ -215,6 +221,15 @@ Optional &prunable); static bool isPieceMessageGeneric(const PathDiagnosticPiece *Piece); + + bool isCondMessageChanged(const Stmt *Cond, StringRef Message); + + bool isConstraintChanged(const Expr *CondVarExpr, const ExplodedNode *N); + + bool isZeroInRange(const Expr *CondVarExpr); + + void finalizeVisitor(BugReporterContext &BRC, const ExplodedNode *EndPathNode, + BugReport &BR) override; }; /// Suppress reports that might lead to known false positives. Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -82,6 +82,121 @@ return nullptr; } +static const Expr *peelOffCondVarExpr(const Expr *Cond, bool &tookTrue) { + while (true) { + Cond = Cond->IgnoreParenCasts(); + switch (Cond->getStmtClass()) { + default: + break; + case Stmt::BinaryOperatorClass: + case Stmt::DeclRefExprClass: + return Cond; + case Stmt::UnaryOperatorClass: { + const auto *UO = cast(Cond); + if (UO->getOpcode() == UO_LNot) { + tookTrue = !tookTrue; + Cond = UO->getSubExpr(); + continue; + } + break; + } + } + break; + } + + return nullptr; +} + +static const Expr *peelOffCondVarExpr(const Expr *Cond) { + bool HelperBoolean = false; + return peelOffCondVarExpr(Cond, HelperBoolean); +} + +static const VarDecl *getCondVarVD(const Expr *CondVarExpr) { + const auto *DRE = dyn_cast_or_null(CondVarExpr); + const auto *BExpr = dyn_cast_or_null(CondVarExpr); + + if (BExpr && !DRE) + DRE = dyn_cast_or_null(BExpr->getLHS()->IgnoreParenImpCasts()); + + if (BExpr && !DRE) + DRE = dyn_cast_or_null(BExpr->getRHS()->IgnoreParenImpCasts()); + + if (!DRE) + return nullptr; + + return dyn_cast_or_null(DRE->getDecl()); +} + +static const RangeSet *getRangeSet(const Expr *CondVarExpr, + const ExplodedNode *N) { + const VarDecl *CondVarVD = getCondVarVD(CondVarExpr); + if (!CondVarVD) + return nullptr; + + ProgramStateRef State = N->getState(); + const LocationContext *LCtx = N->getLocationContext(); + + // The declaration of the value may rely on a pointer so take its l-value. + const auto DeclSVal = State->getSVal(State->getLValue(CondVarVD, LCtx)); + + // The value may inline. + const auto InlineSVal = State->getSVal(CondVarExpr, LCtx); + + const ConstraintRangeTy Ranges = State->get(); + for (auto I = Ranges.begin(); I != Ranges.end(); ++I) { + if (I.getKey() == DeclSVal.getAsSymExpr() || + I.getKey() == InlineSVal.getAsSymExpr()) { + return &I.getData(); + } + } + + return nullptr; +} + +static bool isConcreteIntegerValue(const Expr *CondVarExpr, + const ExplodedNode *N) { + const ProgramState *State = N->getState().get(); + + // If there is no value. + if (!State->getStore()) + return false; + + // If symbolic range of the SVal is found that means the value is unknown. + if (getRangeSet(CondVarExpr, N)) + return false; + + const VarDecl *CondVarVD = getCondVarVD(CondVarExpr); + if (!CondVarVD) + return false; + + const LocationContext *LCtx = N->getLocationContext(); + + // The declaration of the value may rely on a pointer so take its l-value. + const auto DeclSVal = State->getSVal(State->getLValue(CondVarVD, LCtx)); + + // The value may inline. + const auto InlineSVal = State->getSVal(CondVarExpr, LCtx); + + if (const auto *DeclRegion = DeclSVal.getAsRegion()) { + const auto DeclValue = State->getRawSVal(loc::MemRegionVal(DeclRegion), + CondVarExpr->getType()); + auto &SVB = State->getStateManager().getSValBuilder(); + if (SVB.getKnownValue(State, DeclValue)) + return true; + } + + if (const auto InlineRegion = InlineSVal.getAsRegion()) { + const auto InlineValue = State->getRawSVal(loc::MemRegionVal(InlineRegion), + CondVarExpr->getType()); + auto &SVB = State->getStateManager().getSValBuilder(); + if (SVB.getKnownValue(State, InlineValue)) + return true; + } + + return false; +} + /// Given that expression S represents a pointer that would be dereferenced, /// try to find a sub-expression from which the pointer came from. /// This is used for tracking down origins of a null or undefined value: @@ -1798,22 +1913,25 @@ ConditionBRVisitor::VisitNodeImpl(const ExplodedNode *N, BugReporterContext &BRC, BugReport &BR) { ProgramPoint progPoint = N->getLocation(); - ProgramStateRef CurrentState = N->getState(); - ProgramStateRef PrevState = N->getFirstPred()->getState(); - - // Compare the GDMs of the state, because that is where constraints - // are managed. Note that ensure that we only look at nodes that - // were generated by the analyzer engine proper, not checkers. - if (CurrentState->getGDM().getRoot() == - PrevState->getGDM().getRoot()) - return nullptr; + ProgramStateRef State = N->getState(); // If an assumption was made on a branch, it should be caught // here by looking at the state transition. if (Optional BE = progPoint.getAs()) { const CFGBlock *srcBlk = BE->getSrc(); - if (const Stmt *term = srcBlk->getTerminator()) - return VisitTerminator(term, N, srcBlk, BE->getDst(), BR, BRC); + if (const Stmt *term = srcBlk->getTerminator()) { + + auto Piece = VisitTerminator(term, N, srcBlk, BE->getDst(), BR, BRC); + if (!Piece) + return nullptr; + + const Stmt *Cond = srcBlk->getTerminatorCondition(); + if (isCondMessageChanged(Cond, Piece->getString())) + return Piece; + + return nullptr; + } + return nullptr; } @@ -1822,12 +1940,18 @@ ExprEngine::geteagerlyAssumeBinOpBifurcationTags(); const ProgramPointTag *tag = PS->getTag(); - if (tag == tags.first) - return VisitTrueTest(cast(PS->getStmt()), true, - BRC, BR, N); - if (tag == tags.second) - return VisitTrueTest(cast(PS->getStmt()), false, - BRC, BR, N); + if (tag != tags.first && tag != tags.second) + return nullptr; + + const auto *Cond = cast(PS->getStmt()); + bool TookTrue = tag == tags.first; + + auto Piece = VisitTrueTest(Cond, TookTrue, BRC, BR, N); + if (!Piece) + return nullptr; + + if (isCondMessageChanged(Cond, Piece->getString())) + return Piece; return nullptr; } @@ -1894,38 +2018,47 @@ ConditionBRVisitor::VisitTrueTest(const Expr *Cond, bool tookTrue, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N) { - // These will be modified in code below, but we need to preserve the original - // values in case we want to throw the generic message. - const Expr *CondTmp = Cond; + // 'tookTrueTmp' will be modified in 'peelOffCondVarExpr', but we need to + // preserve the original values in case we want to throw the generic message. bool tookTrueTmp = tookTrue; - - while (true) { - CondTmp = CondTmp->IgnoreParenCasts(); - switch (CondTmp->getStmtClass()) { - default: - break; - case Stmt::BinaryOperatorClass: - if (auto P = VisitTrueTest(Cond, cast(CondTmp), - tookTrueTmp, BRC, R, N)) - return P; - break; - case Stmt::DeclRefExprClass: - if (auto P = VisitTrueTest(Cond, cast(CondTmp), - tookTrueTmp, BRC, R, N)) - return P; - break; - case Stmt::UnaryOperatorClass: { - const auto *UO = cast(CondTmp); - if (UO->getOpcode() == UO_LNot) { - tookTrueTmp = !tookTrueTmp; - CondTmp = UO->getSubExpr(); - continue; - } - break; - } + const Expr *CondVarExpr = peelOffCondVarExpr(Cond, tookTrueTmp); + if (CondVarExpr) + switch (CondVarExpr->getStmtClass()) { + default: + break; + case Stmt::BinaryOperatorClass: + if (auto P = VisitTrueTest(Cond, cast(CondVarExpr), + tookTrueTmp, BRC, R, N)) + return P; + break; + case Stmt::DeclRefExprClass: + if (auto P = VisitTrueTest(Cond, cast(CondVarExpr), + tookTrueTmp, BRC, R, N)) + return P; + break; } - break; - } + + // There is no assumption if we know the value is a concrete integer. + if (isConcreteIntegerValue(CondVarExpr, N)) + return nullptr; + + // There is no assumption if the constraint information is not changed. + if (!isConstraintChanged(CondVarExpr, N)) + return nullptr; + + + // There is no assumption if zero is cannot be the value when we 'tookTrue'. + // (e.g. We know the standard operator new never returns null in + // 'NewDelete-path-notes.cpp/test') + // + // But there is an assumption if the VarDecl is *ParmVarDecl or has global + // storage so we cannot rely on range information. + // *Note: at this point we know ParmVarDecl cannot be a concrete value. + // (e.g. 'Assuming' the unknown value in 'MisusedMovedObject.cpp/uniqueTest') + if (const VarDecl *VD = getCondVarVD(CondVarExpr)) + if (tookTrueTmp && !isa(VD) && !VD->hasGlobalStorage() && + !isZeroInRange(CondVarExpr)) + return nullptr; // Condition too complex to explain? Just say something so that the user // knew we've made some path decision at this point. @@ -2067,11 +2200,6 @@ !BinaryOperator::isComparisonOp(Op) || Op == BO_Cmp) return nullptr; - // Should we invert the strings if the LHS is not a variable name? - SmallString<256> buf; - llvm::raw_svector_ostream Out(buf); - Out << "Assuming " << (shouldInvert ? RhsString : LhsString) << " is "; - // Do we need to invert the opcode? if (shouldInvert) switch (Op) { @@ -2094,19 +2222,31 @@ return nullptr; } + // There is no assumption if the constraint information is not changed. + // Do we take the proper 'CondVarVD'? + if (!isConstraintChanged(BExpr, N)) + return nullptr; + + // Should we invert the strings if the LHS is not a variable name? + SmallString<256> buf; + llvm::raw_svector_ostream Out(buf); + + Out << "Assuming " << (shouldInvert ? RhsString : LhsString) << " is "; + switch (Op) { - case BO_EQ: - Out << "equal to "; - break; - case BO_NE: - Out << "not equal to "; - break; - default: - Out << BinaryOperator::getOpcodeStr(Op) << ' '; - break; + case BO_EQ: + Out << "equal to "; + break; + case BO_NE: + Out << "not equal to "; + break; + default: + Out << BinaryOperator::getOpcodeStr(Op) << ' '; + break; } Out << (shouldInvert ? LhsString : RhsString); + const LocationContext *LCtx = N->getLocationContext(); PathDiagnosticLocation Loc(Cond, BRC.getSourceManager(), LCtx); auto event = std::make_shared(Loc, Out.str()); @@ -2156,25 +2296,44 @@ } std::shared_ptr -ConditionBRVisitor::VisitTrueTest(const Expr *Cond, const DeclRefExpr *DR, +ConditionBRVisitor::VisitTrueTest(const Expr *Cond, const DeclRefExpr *DRE, const bool tookTrue, BugReporterContext &BRC, BugReport &report, const ExplodedNode *N) { - const auto *VD = dyn_cast(DR->getDecl()); + const auto *VD = dyn_cast(DRE->getDecl()); if (!VD) return nullptr; + // There is no assumption if the constraint information is not changed. + if (!isConstraintChanged(DRE, N)) + return nullptr; + + // There is no assumption if zero is cannot be the value when we 'tookTrue'. + // (e.g. We know the standard operator new never returns null in + // 'NewDelete-path-notes.cpp/test') + // + // But there is an assumption if the VarDecl is *ParmVarDecl or has global + // storage so we cannot rely on range information. + // *Note: at this point we know ParmVarDecl cannot be a concrete value. + // (e.g. 'Assuming' the unknown value in 'MisusedMovedObject.cpp/uniqueTest') + if (tookTrue && !isa(VD) && !VD->hasGlobalStorage() && + !isZeroInRange(DRE)) + return nullptr; + + // There is no assumption if we know the value is a concrete integer. + if (isConcreteIntegerValue(DRE, N)) + return nullptr; + SmallString<256> Buf; llvm::raw_svector_ostream Out(Buf); + QualType Ty = VD->getType(); Out << "Assuming '" << VD->getDeclName() << "' is "; - QualType VDTy = VD->getType(); - - if (VDTy->isPointerType()) + if (Ty->isPointerType()) Out << (tookTrue ? "non-null" : "null"); - else if (VDTy->isObjCObjectPointerType()) + else if (Ty->isObjCObjectPointerType()) Out << (tookTrue ? "non-nil" : "nil"); - else if (VDTy->isScalarType()) + else if (Ty->isScalarType()) Out << (tookTrue ? "not equal to 0" : "0"); else return nullptr; @@ -2196,6 +2355,76 @@ return std::move(event); } +bool ConditionBRVisitor::isConstraintChanged(const Expr *CondVarExpr, + const ExplodedNode *N) { + const VarDecl *CondVarVD = getCondVarVD(CondVarExpr); + const RangeSet *CurrentRanges = getRangeSet(CondVarExpr, N); + + // If there is no comparable information we assume the constraint changed. + // (e.g. 'macros.cpp/testDoubleMacro' as we cannot handle doubles.) + if (!CondVarVD || !CurrentRanges) + return true; + + // Store or update the range information. + Constraints[CondVarVD] = CurrentRanges; + + // If we find the constraint on previous conditions it has not changed. + const ExplodedNode *Pred = N; + while (Pred) { + Pred = Pred->getFirstPred(); + if (!Pred) + break; + + if (Optional BE = Pred->getLocationAs()) + if (const Stmt *TermStmt = BE->getSrc()->getTerminatorCondition()) + if (const Expr *Cond = dyn_cast_or_null(TermStmt)) + if (const Expr *condVarExpr = peelOffCondVarExpr(Cond)) + if (const RangeSet *currentRanges = getRangeSet(condVarExpr, Pred)) + if (const VarDecl *condVarVD = getCondVarVD(condVarExpr)) + if (condVarVD == CondVarVD && currentRanges == CurrentRanges) + return false; + } + + return true; +} + +bool ConditionBRVisitor::isCondMessageChanged(const Stmt *Cond, + StringRef Message) { + CondMessageMap::iterator I = CondMessages.find(Cond); + + // Insert new condition or if the message has changed update the message. + if (I == CondMessages.end() || !Message.equals(I->second)) { + CondMessages[Cond] = Message; + return true; + } + + return false; +} + +bool ConditionBRVisitor::isZeroInRange(const Expr *CondVarExpr) { + const VarDecl *CondVarVD = getCondVarVD(CondVarExpr); + if (!CondVarVD) + return false; + + ConstraintMap::iterator CIt = Constraints.find(CondVarVD); + if (CIt == Constraints.end()) + return false; + + const RangeSet *Ranges = CIt->getSecond(); + for (RangeSet::iterator I = Ranges->begin(); I != Ranges->end(); ++I) + if ((I->From() <= 0 && 0 <= I->To()) || (I->From() >= 0 && 0 >= I->To())) + return true; + + return false; +} + +void ConditionBRVisitor::finalizeVisitor(BugReporterContext &BRC, + const ExplodedNode *EndPathNode, + BugReport &BR) { + Constraints.clear(); + CondMessages.clear(); +} + const char *const ConditionBRVisitor::GenericTrueMessage = "Assuming the condition is true"; const char *const ConditionBRVisitor::GenericFalseMessage = Index: test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist =================================================================== --- test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist +++ test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist @@ -161,6 +161,69 @@ end + line11 + col9 + file0 + + + line11 + col9 + file0 + + + + + + + kindevent + location + + line11 + col9 + file0 + + ranges + + + + line11 + col9 + file0 + + + line11 + col14 + file0 + + + + depth0 + extended_message + Assuming 'y' is not equal to 2 + message + Assuming 'y' is not equal to 2 + + + kindcontrol + edges + + + start + + + line11 + col9 + file0 + + + line11 + col9 + file0 + + + end + + line13 col5 file0 @@ -423,6 +486,69 @@ end + line11 + col9 + file0 + + + line11 + col9 + file0 + + + + + + + kindevent + location + + line11 + col9 + file0 + + ranges + + + + line11 + col9 + file0 + + + line11 + col14 + file0 + + + + depth0 + extended_message + Assuming 'y' is equal to 2 + message + Assuming 'y' is equal to 2 + + + kindcontrol + edges + + + start + + + line11 + col9 + file0 + + + line11 + col9 + file0 + + + end + + line12 col7 file0 Index: test/Analysis/Inputs/expected-plists/edges-new.mm.plist =================================================================== --- test/Analysis/Inputs/expected-plists/edges-new.mm.plist +++ test/Analysis/Inputs/expected-plists/edges-new.mm.plist @@ -2711,6 +2711,35 @@ + kindevent + location + + line146 + col8 + file0 + + ranges + + + + line146 + col8 + file0 + + + line146 + col13 + file0 + + + + depth0 + extended_message + Assuming 'i' is not equal to 1 + message + Assuming 'i' is not equal to 1 + + kindcontrol edges @@ -2891,6 +2920,69 @@ end + line146 + col8 + file0 + + + line146 + col8 + file0 + + + + + + + kindevent + location + + line146 + col8 + file0 + + ranges + + + + line146 + col8 + file0 + + + line146 + col13 + file0 + + + + depth0 + extended_message + Assuming 'i' is equal to 1 + message + Assuming 'i' is equal to 1 + + + kindcontrol + edges + + + start + + + line146 + col8 + file0 + + + line146 + col8 + file0 + + + end + + line147 col5 file0 @@ -3809,6 +3901,69 @@ end + line178 + col9 + file0 + + + line178 + col9 + file0 + + + + + + + kindevent + location + + line178 + col9 + file0 + + ranges + + + + line178 + col9 + file0 + + + line178 + col14 + file0 + + + + depth0 + extended_message + Assuming 'i' is equal to 0 + message + Assuming 'i' is equal to 0 + + + kindcontrol + edges + + + start + + + line178 + col9 + file0 + + + line178 + col9 + file0 + + + end + + line179 col7 file0 @@ -4003,6 +4158,69 @@ end + line178 + col9 + file0 + + + line178 + col9 + file0 + + + + + + + kindevent + location + + line178 + col9 + file0 + + ranges + + + + line178 + col9 + file0 + + + line178 + col14 + file0 + + + + depth0 + extended_message + Assuming 'i' is not equal to 0 + message + Assuming 'i' is not equal to 0 + + + kindcontrol + edges + + + start + + + line178 + col9 + file0 + + + line178 + col9 + file0 + + + end + + line181 col5 file0 @@ -4037,6 +4255,69 @@ end + line181 + col9 + file0 + + + line181 + col9 + file0 + + + + + + + kindevent + location + + line181 + col9 + file0 + + ranges + + + + line181 + col9 + file0 + + + line181 + col14 + file0 + + + + depth0 + extended_message + Assuming 'i' is equal to 1 + message + Assuming 'i' is equal to 1 + + + kindcontrol + edges + + + start + + + line181 + col9 + file0 + + + line181 + col9 + file0 + + + end + + line183 col7 file0 @@ -6417,6 +6698,35 @@ + kindevent + location + + line240 + col7 + file0 + + ranges + + + + line240 + col7 + file0 + + + line240 + col7 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + kindcontrol edges @@ -6451,6 +6761,35 @@ + kindevent + location + + line240 + col12 + file0 + + ranges + + + + line240 + col12 + file0 + + + line240 + col12 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + kindcontrol edges @@ -6675,6 +7014,35 @@ + kindevent + location + + line247 + col7 + file0 + + ranges + + + + line247 + col7 + file0 + + + line247 + col7 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -6709,6 +7077,35 @@ + kindevent + location + + line247 + col12 + file0 + + ranges + + + + line247 + col12 + file0 + + + line247 + col12 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + kindcontrol edges @@ -6933,6 +7330,35 @@ + kindevent + location + + line255 + col12 + file0 + + ranges + + + + line255 + col12 + file0 + + + line255 + col12 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -7254,6 +7680,35 @@ + kindevent + location + + line263 + col8 + file0 + + ranges + + + + line263 + col8 + file0 + + + line263 + col8 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -7309,6 +7764,69 @@ line263 + col7 + file0 + + + line263 + col7 + file0 + + + + + + + kindevent + location + + line263 + col7 + file0 + + ranges + + + + line263 + col7 + file0 + + + line263 + col14 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + + kindcontrol + edges + + + start + + + line263 + col7 + file0 + + + line263 + col7 + file0 + + + end + + + line263 col19 file0 @@ -7575,6 +8093,35 @@ + kindevent + location + + line263 + col8 + file0 + + ranges + + + + line263 + col8 + file0 + + + line263 + col8 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -7630,6 +8177,69 @@ line263 + col7 + file0 + + + line263 + col7 + file0 + + + + + + + kindevent + location + + line263 + col7 + file0 + + ranges + + + + line263 + col7 + file0 + + + line263 + col14 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + + kindcontrol + edges + + + start + + + line263 + col7 + file0 + + + line263 + col7 + file0 + + + end + + + line263 col19 file0 @@ -7740,6 +8350,35 @@ + kindevent + location + + line267 + col7 + file0 + + ranges + + + + line267 + col7 + file0 + + + line267 + col7 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -7774,6 +8413,35 @@ + kindevent + location + + line267 + col13 + file0 + + ranges + + + + line267 + col13 + file0 + + + line267 + col13 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -8033,6 +8701,35 @@ + kindevent + location + + line276 + col8 + file0 + + ranges + + + + line276 + col8 + file0 + + + line276 + col8 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -8067,6 +8764,132 @@ + kindevent + location + + line276 + col14 + file0 + + ranges + + + + line276 + col14 + file0 + + + line276 + col14 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + + kindcontrol + edges + + + start + + + line276 + col14 + file0 + + + line276 + col14 + file0 + + + end + + + line276 + col19 + file0 + + + line276 + col19 + file0 + + + + + + + kindcontrol + edges + + + start + + + line276 + col19 + file0 + + + line276 + col19 + file0 + + + end + + + line276 + col7 + file0 + + + line276 + col7 + file0 + + + + + + + kindevent + location + + line276 + col7 + file0 + + ranges + + + + line276 + col7 + file0 + + + line276 + col21 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -8075,12 +8898,12 @@ line276 - col14 + col7 file0 line276 - col14 + col7 file0 @@ -8088,12 +8911,12 @@ line276 - col19 + col30 file0 line276 - col19 + col30 file0 @@ -8101,6 +8924,35 @@ + kindevent + location + + line276 + col31 + file0 + + ranges + + + + line276 + col31 + file0 + + + line276 + col31 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -8109,12 +8961,12 @@ line276 - col19 + col31 file0 line276 - col19 + col31 file0 @@ -8122,12 +8974,12 @@ line276 - col30 + col36 file0 line276 - col30 + col36 file0 @@ -8143,12 +8995,12 @@ line276 - col31 + col36 file0 line276 - col31 + col36 file0 @@ -8156,12 +9008,12 @@ line276 - col36 + col30 file0 line276 - col36 + col30 file0 @@ -8169,6 +9021,35 @@ + kindevent + location + + line276 + col30 + file0 + + ranges + + + + line276 + col30 + file0 + + + line276 + col37 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + kindcontrol edges @@ -8177,12 +9058,12 @@ line276 - col36 + col30 file0 line276 - col36 + col30 file0 @@ -8203,6 +9084,35 @@ + kindevent + location + + line276 + col46 + file0 + + ranges + + + + line276 + col46 + file0 + + + line276 + col46 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + kindcontrol edges @@ -12135,69 +13045,6 @@ - kindcontrol - edges - - - start - - - line462 - col3 - file0 - - - line462 - col5 - file0 - - - end - - - line462 - col19 - file0 - - - line462 - col19 - file0 - - - - - - - kindevent - location - - line462 - col19 - file0 - - ranges - - - - line462 - col19 - file0 - - - line462 - col26 - file0 - - - - depth0 - extended_message - Assuming the condition is true - message - Assuming the condition is true - - kindevent location @@ -12235,12 +13082,12 @@ line462 - col19 + col3 file0 line462 - col19 + col5 file0 @@ -14010,70 +14857,7 @@ line493 - col6 - file0 - - - end - - - line493 - col9 - file0 - - - line493 - col9 - file0 - - - - - - - kindevent - location - - line493 - col9 - file0 - - ranges - - - - line493 - col9 - file0 - - - line493 - col16 - file0 - - - - depth0 - extended_message - Assuming the condition is true - message - Assuming the condition is true - - - kindcontrol - edges - - - start - - - line493 - col9 - file0 - - - line493 - col9 + col6 file0 @@ -14162,69 +14946,6 @@ - kindcontrol - edges - - - start - - - line498 - col3 - file0 - - - line498 - col5 - file0 - - - end - - - line498 - col15 - file0 - - - line498 - col15 - file0 - - - - - - - kindevent - location - - line498 - col15 - file0 - - ranges - - - - line498 - col15 - file0 - - - line498 - col22 - file0 - - - - depth0 - extended_message - Assuming the condition is true - message - Assuming the condition is true - - kindevent location @@ -14262,12 +14983,12 @@ line498 - col15 + col3 file0 line498 - col15 + col5 file0 @@ -15498,69 +16219,6 @@ end - line493 - col9 - file0 - - - line493 - col9 - file0 - - - - - - - kindevent - location - - line493 - col9 - file0 - - ranges - - - - line493 - col9 - file0 - - - line493 - col16 - file0 - - - - depth0 - extended_message - Assuming the condition is true - message - Assuming the condition is true - - - kindcontrol - edges - - - start - - - line493 - col9 - file0 - - - line493 - col9 - file0 - - - end - - line494 col7 file0 @@ -15769,69 +16427,6 @@ - kindcontrol - edges - - - start - - - line503 - col3 - file0 - - - line503 - col5 - file0 - - - end - - - line503 - col10 - file0 - - - line503 - col10 - file0 - - - - - - - kindevent - location - - line503 - col10 - file0 - - ranges - - - - line503 - col10 - file0 - - - line503 - col17 - file0 - - - - depth0 - extended_message - Assuming the condition is true - message - Assuming the condition is true - - kindevent location @@ -15869,12 +16464,12 @@ line503 - col10 + col3 file0 line503 - col10 + col5 file0 @@ -17099,70 +17694,7 @@ line493 - col6 - file0 - - - end - - - line493 - col9 - file0 - - - line493 - col9 - file0 - - - - - - - kindevent - location - - line493 - col9 - file0 - - ranges - - - - line493 - col9 - file0 - - - line493 - col16 - file0 - - - - depth0 - extended_message - Assuming the condition is true - message - Assuming the condition is true - - - kindcontrol - edges - - - start - - - line493 - col9 - file0 - - - line493 - col9 + col6 file0 @@ -17503,69 +18035,6 @@ - kindcontrol - edges - - - start - - - line508 - col3 - file0 - - - line508 - col5 - file0 - - - end - - - line508 - col10 - file0 - - - line508 - col10 - file0 - - - - - - - kindevent - location - - line508 - col10 - file0 - - ranges - - - - line508 - col10 - file0 - - - line508 - col17 - file0 - - - - depth0 - extended_message - Assuming the condition is true - message - Assuming the condition is true - - kindevent location @@ -17603,12 +18072,12 @@ line508 - col10 + col3 file0 line508 - col10 + col5 file0 @@ -18939,69 +19408,6 @@ end - line493 - col9 - file0 - - - line493 - col9 - file0 - - - - - - - kindevent - location - - line493 - col9 - file0 - - ranges - - - - line493 - col9 - file0 - - - line493 - col16 - file0 - - - - depth0 - extended_message - Assuming the condition is true - message - Assuming the condition is true - - - kindcontrol - edges - - - start - - - line493 - col9 - file0 - - - line493 - col9 - file0 - - - end - - line494 col7 file0 @@ -19579,69 +19985,6 @@ end - line517 - col9 - file0 - - - line517 - col9 - file0 - - - - - - - kindevent - location - - line517 - col9 - file0 - - ranges - - - - line517 - col9 - file0 - - - line517 - col16 - file0 - - - - depth0 - extended_message - Assuming the condition is true - message - Assuming the condition is true - - - kindcontrol - edges - - - start - - - line517 - col9 - file0 - - - line517 - col9 - file0 - - - end - - line518 col7 file0 @@ -19997,9 +20340,9 @@ depth0 extended_message - Assuming 'tmp' is null + Reallocation failed message - Assuming 'tmp' is null + Reallocation failed kindevent @@ -20026,9 +20369,9 @@ depth0 extended_message - Reallocation failed + Assuming 'tmp' is null message - Reallocation failed + Assuming 'tmp' is null kindcontrol @@ -21341,6 +21684,69 @@ end + line587 + col11 + file0 + + + line587 + col11 + file0 + + + + + + + kindevent + location + + line587 + col11 + file0 + + ranges + + + + line587 + col11 + file0 + + + line587 + col16 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + + kindcontrol + edges + + + start + + + line587 + col11 + file0 + + + line587 + col11 + file0 + + + end + + line588 col9 file0 Index: test/Analysis/Inputs/expected-plists/malloc-plist.c.plist =================================================================== --- test/Analysis/Inputs/expected-plists/malloc-plist.c.plist +++ test/Analysis/Inputs/expected-plists/malloc-plist.c.plist @@ -942,69 +942,6 @@ end - line39 - col7 - file0 - - - line39 - col7 - file0 - - - - - - - kindevent - location - - line39 - col7 - file0 - - ranges - - - - line39 - col7 - file0 - - - line39 - col7 - file0 - - - - depth1 - extended_message - Assuming 'x' is non-null - message - Assuming 'x' is non-null - - - kindcontrol - edges - - - start - - - line39 - col7 - file0 - - - line39 - col7 - file0 - - - end - - line40 col5 file0 Index: test/Analysis/Inputs/expected-plists/model-file.cpp.plist =================================================================== --- test/Analysis/Inputs/expected-plists/model-file.cpp.plist +++ test/Analysis/Inputs/expected-plists/model-file.cpp.plist @@ -127,6 +127,69 @@ end + line25 + col7 + file0 + + + line25 + col13 + file0 + + + + + + + kindevent + location + + line25 + col7 + file0 + + ranges + + + + line25 + col7 + file0 + + + line25 + col16 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + + kindcontrol + edges + + + start + + + line25 + col7 + file0 + + + line25 + col13 + file0 + + + end + + line31 col3 file0 Index: test/Analysis/Inputs/expected-plists/plist-macros.cpp.plist =================================================================== --- test/Analysis/Inputs/expected-plists/plist-macros.cpp.plist +++ test/Analysis/Inputs/expected-plists/plist-macros.cpp.plist @@ -1365,35 +1365,6 @@ - kindevent - location - - line69 - col3 - file0 - - ranges - - - - line69 - col3 - file0 - - - line69 - col16 - file0 - - - - depth0 - extended_message - Assuming 'y' is 0 - message - Assuming 'y' is 0 - - kindcontrol edges @@ -1755,7 +1726,7 @@ files - /clang/test/Analysis/plist-macros.cpp + /clang/test/Analysis/plist-macros.cpp Index: test/Analysis/Inputs/expected-plists/plist-output.m.plist =================================================================== --- test/Analysis/Inputs/expected-plists/plist-output.m.plist +++ test/Analysis/Inputs/expected-plists/plist-output.m.plist @@ -2497,6 +2497,35 @@ + kindevent + location + + line96 + col8 + file0 + + ranges + + + + line96 + col8 + file0 + + + line96 + col13 + file0 + + + + depth0 + extended_message + Assuming 'i' is not equal to 1 + message + Assuming 'i' is not equal to 1 + + kindcontrol edges @@ -2677,6 +2706,69 @@ end + line96 + col8 + file0 + + + line96 + col8 + file0 + + + + + + + kindevent + location + + line96 + col8 + file0 + + ranges + + + + line96 + col8 + file0 + + + line96 + col13 + file0 + + + + depth0 + extended_message + Assuming 'i' is equal to 1 + message + Assuming 'i' is equal to 1 + + + kindcontrol + edges + + + start + + + line96 + col8 + file0 + + + line96 + col8 + file0 + + + end + + line97 col5 file0 @@ -3448,6 +3540,35 @@ + kindevent + location + + line127 + col9 + file0 + + ranges + + + + line127 + col9 + file0 + + + line127 + col14 + file0 + + + + depth0 + extended_message + Assuming 'i' is not equal to 1 + message + Assuming 'i' is not equal to 1 + + kindcontrol edges @@ -3628,6 +3749,69 @@ end + line127 + col9 + file0 + + + line127 + col9 + file0 + + + + + + + kindevent + location + + line127 + col9 + file0 + + ranges + + + + line127 + col9 + file0 + + + line127 + col14 + file0 + + + + depth0 + extended_message + Assuming 'i' is equal to 1 + message + Assuming 'i' is equal to 1 + + + kindcontrol + edges + + + start + + + line127 + col9 + file0 + + + line127 + col9 + file0 + + + end + + line128 col7 file0 @@ -6214,7 +6398,7 @@ files - /clang/test/Analysis/plist-output.m + /clang/test/Analysis/plist-output.m Index: test/Analysis/Inputs/expected-plists/unix-fns.c.plist =================================================================== --- test/Analysis/Inputs/expected-plists/unix-fns.c.plist +++ test/Analysis/Inputs/expected-plists/unix-fns.c.plist @@ -64,69 +64,6 @@ end - line84 - col7 - file0 - - - line84 - col7 - file0 - - - - - - - kindevent - location - - line84 - col7 - file0 - - ranges - - - - line84 - col7 - file0 - - - line84 - col9 - file0 - - - - depth0 - extended_message - Assuming 'fd' is not equal to 0 - message - Assuming 'fd' is not equal to 0 - - - kindcontrol - edges - - - start - - - line84 - col7 - file0 - - - line84 - col7 - file0 - - - end - - line87 col3 file0 @@ -289,69 +226,6 @@ end - line95 - col7 - file0 - - - line95 - col7 - file0 - - - - - - - kindevent - location - - line95 - col7 - file0 - - ranges - - - - line95 - col7 - file0 - - - line95 - col9 - file0 - - - - depth0 - extended_message - Assuming 'fd' is not equal to 0 - message - Assuming 'fd' is not equal to 0 - - - kindcontrol - edges - - - start - - - line95 - col7 - file0 - - - line95 - col7 - file0 - - - end - - line98 col3 file0 @@ -515,6 +389,69 @@ line105 + col12 + file0 + + + line105 + col27 + file0 + + + + + + + kindevent + location + + line105 + col12 + file0 + + ranges + + + + line105 + col12 + file0 + + + line105 + col49 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + + kindcontrol + edges + + + start + + + line105 + col12 + file0 + + + line105 + col27 + file0 + + + end + + + line105 col52 file0 @@ -2244,6 +2181,69 @@ end + line60 + col6 + file0 + + + line60 + col21 + file0 + + + + + + + kindevent + location + + line60 + col6 + file0 + + ranges + + + + line60 + col6 + file0 + + + line60 + col49 + file0 + + + + depth1 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + + kindcontrol + edges + + + start + + + line60 + col6 + file0 + + + line60 + col21 + file0 + + + end + + line61 col3 file0 @@ -2601,6 +2601,69 @@ end + line60 + col6 + file0 + + + line60 + col21 + file0 + + + + + + + kindevent + location + + line60 + col6 + file0 + + ranges + + + + line60 + col6 + file0 + + + line60 + col49 + file0 + + + + depth1 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + + kindcontrol + edges + + + start + + + line60 + col6 + file0 + + + line60 + col21 + file0 + + + end + + line61 col3 file0 Index: test/Analysis/MisusedMovedObject.cpp =================================================================== --- test/Analysis/MisusedMovedObject.cpp +++ test/Analysis/MisusedMovedObject.cpp @@ -577,7 +577,8 @@ A a; if (a.foo() > 0 && A(std::move(a)).foo() > 0) { // expected-note {{Assuming the condition is false}} expected-note {{Assuming the condition is false}} // expected-note@-1 {{Left side of '&&' is false}} expected-note@-1 {{Left side of '&&' is false}} - //expected-note@-2 {{Taking false branch}} expected-note@-2 {{Taking false branch}} + // expected-note@-2 {{Assuming the condition is false}} expected-note@-2 {{Assuming the condition is false}} + // expected-note@-3 {{Taking false branch}} expected-note@-3 {{Taking false branch}} A().bar(); } } @@ -587,7 +588,8 @@ A a; if (!(a.foo() > 0 && A(std::move(a)).foo() > 0)) { // expected-note {{Assuming the condition is false}} expected-note {{Assuming the condition is false}} // expected-note@-1 {{Left side of '&&' is false}} expected-note@-1 {{Left side of '&&' is false}} - // expected-note@-2 {{Taking true branch}} expected-note@-2 {{Taking true branch}} + // expected-note@-2 {{Assuming the condition is true}} expected-note@-2 {{Assuming the condition is true}} + // expected-note@-3 {{Taking true branch}} expected-note@-3 {{Taking true branch}} A().bar(); } } @@ -596,7 +598,8 @@ if (A(std::move(a)).foo() > 0 && a.foo() > 0) { // expected-warning {{Method call on a 'moved-from' object 'a'}} expected-note {{Method call on a 'moved-from' object 'a'}} // expected-note@-1 {{'a' became 'moved-from' here}} expected-note@-1 {{Assuming the condition is true}} expected-note@-1 {{Assuming the condition is false}} // expected-note@-2 {{Left side of '&&' is false}} expected-note@-2 {{Left side of '&&' is true}} - // expected-note@-3 {{Taking false branch}} + // expected-note@-3 {{Assuming the condition is false}} + // expected-note@-4 {{Taking false branch}} A().bar(); } } @@ -604,7 +607,8 @@ A a; if (a.foo() > 0 || A(std::move(a)).foo() > 0) { // expected-note {{Assuming the condition is true}} //expected-note@-1 {{Left side of '||' is true}} - //expected-note@-2 {{Taking true branch}} + //expected-note@-2 {{Assuming the condition is true}} + //expected-note@-3 {{Taking true branch}} A().bar(); } } Index: test/Analysis/diagnostics/Inputs/expected-plists/undef-value-param.m.plist =================================================================== --- test/Analysis/diagnostics/Inputs/expected-plists/undef-value-param.m.plist +++ test/Analysis/diagnostics/Inputs/expected-plists/undef-value-param.m.plist @@ -175,13 +175,13 @@ end - line56 - col9 + line57 + col7 file0 - line56 - col11 + line57 + col15 file0 @@ -189,35 +189,6 @@ - kindevent - location - - line56 - col9 - file0 - - ranges - - - - line56 - col9 - file0 - - - line56 - col11 - file0 - - - - depth1 - extended_message - Assuming 'err' is not equal to 0 - message - Assuming 'err' is not equal to 0 - - kindcontrol edges @@ -225,62 +196,28 @@ start - line56 - col9 + line57 + col7 file0 - line56 - col11 + line57 + col15 file0 end - line59 - col9 - file0 - - - line59 - col17 - file0 - - - - - - - kindcontrol - edges - - - start - - - line59 - col9 - file0 - - - line59 - col17 + line58 + col7 file0 - - end - - line60 + line58 col9 file0 - - line60 - col11 - file0 - @@ -289,21 +226,21 @@ kindevent location - line60 - col9 + line58 + col7 file0 ranges - line60 - col9 + line58 + col7 file0 - line60 - col15 + line58 + col13 file0 @@ -322,25 +259,25 @@ start - line60 - col9 + line58 + col7 file0 - line60 - col11 + line58 + col9 file0 end - line62 + line60 col5 file0 - line62 + line60 col5 file0 @@ -352,7 +289,7 @@ kindevent location - line62 + line60 col5 file0 @@ -360,12 +297,12 @@ - line62 + line60 col5 file0 - line62 + line60 col19 file0 @@ -497,9 +434,9 @@ 54 55 56 - 59 + 57 + 58 60 - 62 @@ -602,7 +539,7 @@ kindevent location - line65 + line63 col1 file0 @@ -620,12 +557,12 @@ start - line65 + line63 col1 file0 - line65 + line63 col6 file0 @@ -633,12 +570,12 @@ end - line66 + line64 col3 file0 - line66 + line64 col10 file0 @@ -654,12 +591,12 @@ start - line66 + line64 col3 file0 - line66 + line64 col10 file0 @@ -667,12 +604,12 @@ end - line68 + line66 col3 file0 - line68 + line66 col4 file0 @@ -688,12 +625,12 @@ start - line68 + line66 col3 file0 - line68 + line66 col4 file0 @@ -701,75 +638,12 @@ end - line68 - col7 - file0 - - - line68 - col9 - file0 - - - - - - - kindevent - location - - line68 - col7 - file0 - - ranges - - - - line68 - col7 - file0 - - - line68 - col9 - file0 - - - - depth1 - extended_message - Assuming 'err' is not equal to 0 - message - Assuming 'err' is not equal to 0 - - - kindcontrol - edges - - - start - - - line68 - col7 - file0 - - - line68 - col9 - file0 - - - end - - - line71 + line67 col5 file0 - line71 + line67 col13 file0 @@ -785,12 +659,12 @@ start - line71 + line67 col5 file0 - line71 + line67 col13 file0 @@ -798,12 +672,12 @@ end - line72 + line68 col5 file0 - line72 + line68 col10 file0 @@ -819,12 +693,12 @@ start - line72 + line68 col5 file0 - line72 + line68 col10 file0 @@ -832,12 +706,12 @@ end - line72 + line68 col5 file0 - line72 + line68 col10 file0 @@ -849,7 +723,7 @@ kindevent location - line72 + line68 col5 file0 @@ -867,12 +741,12 @@ start - line72 + line68 col5 file0 - line72 + line68 col10 file0 @@ -880,12 +754,12 @@ end - line72 + line68 col5 file0 - line72 + line68 col10 file0 @@ -1009,19 +883,19 @@ 44 45 48 + 63 + 64 65 66 67 68 - 71 - 72 files - /clang/test/Analysis/diagnostics/undef-value-param.m + /clang/test/Analysis/diagnostics/undef-value-param.m - + \ No newline at end of file Index: test/Analysis/diagnostics/macros.cpp =================================================================== --- test/Analysis/diagnostics/macros.cpp +++ test/Analysis/diagnostics/macros.cpp @@ -30,7 +30,8 @@ // There are no path notes on the comparison to float types. void testDoubleMacro(double d) { - if (d == DBL_MAX) { // expected-note {{Taking true branch}} + if (d == DBL_MAX) { // expected-note {{Assuming 'd' is equal to DBL_MAX}} + // expected-note@-1 {{Taking true branch}} char *p = NULL; // expected-note {{'p' initialized to a null pointer value}} *p = 7; // expected-warning {{Dereference of null pointer (loaded from variable 'p')}} Index: test/Analysis/diagnostics/undef-value-param.m =================================================================== --- test/Analysis/diagnostics/undef-value-param.m +++ test/Analysis/diagnostics/undef-value-param.m @@ -53,11 +53,9 @@ static void CreateRef(SCDynamicStoreRef *storeRef, unsigned x) { unsigned err = 0; SCDynamicStoreRef ref = anotherCreateRef(&err, x); - if (err) { - //expected-note@-1{{Assuming 'err' is not equal to 0}} - //expected-note@-2{{Taking true branch}} - CFRelease(ref); - ref = 0; // expected-note{{nil object reference stored to 'ref'}} + if (err) { //expected-note{{Taking true branch}} + CFRelease(ref); + ref = 0; // expected-note{{nil object reference stored to 'ref'}} } *storeRef = ref; // expected-note{{nil object reference stored to 'storeRef'}} } @@ -65,9 +63,7 @@ static void CreateRefUndef(SCDynamicStoreRef *storeRef, unsigned x) { unsigned err = 0; SCDynamicStoreRef ref = anotherCreateRef(&err, x); - if (err) { - //expected-note@-1{{Assuming 'err' is not equal to 0}} - //expected-note@-2{{Taking true branch}} + if (err) { //expected-note{{Taking true branch}} CFRelease(ref); return; // expected-note{{Returning without writing to '*storeRef'}} } Index: test/Analysis/new-ctor-malloc.cpp =================================================================== --- test/Analysis/new-ctor-malloc.cpp +++ test/Analysis/new-ctor-malloc.cpp @@ -8,8 +8,7 @@ void *operator new(size_t size) throw() { void *x = malloc(size); // expected-note {{Memory is allocated}} - if (!x) // expected-note {{Assuming 'x' is non-null}} - // expected-note@-1 {{Taking false branch}} + if (!x) // expected-note {{Taking false branch}} return nullptr; return x; } Index: test/Analysis/objc-radar17039661.m =================================================================== --- test/Analysis/objc-radar17039661.m +++ test/Analysis/objc-radar17039661.m @@ -418,69 +418,6 @@ // CHECK: end // CHECK: // CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth3 -// CHECK: extended_message -// CHECK: Assuming 'cond' is not equal to 0 -// CHECK: message -// CHECK: Assuming 'cond' is not equal to 0 -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: // CHECK: line33 // CHECK: col7 // CHECK: file0 @@ -861,6 +798,69 @@ // CHECK: end // CHECK: // CHECK: +// CHECK: line37 +// CHECK: col11 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: line37 +// CHECK: col20 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: kindevent +// CHECK: location +// CHECK: +// CHECK: line37 +// CHECK: col11 +// CHECK: file0 +// CHECK: +// CHECK: ranges +// CHECK: +// CHECK: +// CHECK: +// CHECK: line37 +// CHECK: col11 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: line37 +// CHECK: col37 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: +// CHECK: depth3 +// CHECK: extended_message +// CHECK: Assuming 'traitValue' is equal to 'newTraitValue' +// CHECK: message +// CHECK: Assuming 'traitValue' is equal to 'newTraitValue' +// CHECK: +// CHECK: +// CHECK: kindcontrol +// CHECK: edges +// CHECK: +// CHECK: +// CHECK: start +// CHECK: +// CHECK: +// CHECK: line37 +// CHECK: col11 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: line37 +// CHECK: col20 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: end +// CHECK: +// CHECK: // CHECK: line40 // CHECK: col7 // CHECK: file0 @@ -1323,11 +1323,36 @@ // CHECK: descriptionPotential leak of an object // CHECK: categoryMemory (Core Foundation/Objective-C) // CHECK: typeLeak +// CHECK: check_nameosx.cocoa.RetainCount +// CHECK: +// CHECK: issue_hash_content_of_line_in_context500e2bbda41c8086771ad98b6bcfdc50 // CHECK: location // CHECK: // CHECK: line52 // CHECK: col5 // CHECK: file0 // CHECK: +// CHECK: ExecutedLines +// CHECK: +// CHECK: 0 +// CHECK: +// CHECK: 22 +// CHECK: 23 +// CHECK: 24 +// CHECK: 27 +// CHECK: 28 +// CHECK: 29 +// CHECK: 31 +// CHECK: 33 +// CHECK: 35 +// CHECK: 37 +// CHECK: 40 +// CHECK: 47 +// CHECK: 48 +// CHECK: 49 +// CHECK: 50 +// CHECK: 52 +// CHECK: +// CHECK: // CHECK: // CHECK: Index: test/Analysis/uninit-vals.m =================================================================== --- test/Analysis/uninit-vals.m +++ test/Analysis/uninit-vals.m @@ -164,7 +164,8 @@ // expected-note@-1{{TRUE}} testObj->origin = makePoint(0.0, 0.0); - if (testObj->size > 0) { ; } // expected-note{{Taking false branch}} + if (testObj->size > 0) { ; } // expected-note{{Assuming the condition is false}} + // expected-note@-1{{Taking false branch}} // FIXME: Assigning to 'testObj->origin' kills the default binding for the // whole region, meaning that we've forgotten that testObj->size should also @@ -218,10 +219,14 @@ // expected-note@-1{{TRUE}} testObj->origin = makeIntPoint(1, 2); - if (testObj->size > 0) { ; } // expected-note{{Taking false branch}} - // expected-note@-1{{Taking false branch}} - // expected-note@-2{{Taking false branch}} - // expected-note@-3{{Taking false branch}} + if (testObj->size > 0) { ; } // expected-note{{Assuming the condition is false}} + // expected-note@-1{{Assuming the condition is false}} + // expected-note@-2{{Assuming the condition is false}} + // expected-note@-3{{Assuming the condition is false}} + // expected-note@-4{{Taking false branch}} + // expected-note@-5{{Taking false branch}} + // expected-note@-6{{Taking false branch}} + // expected-note@-7{{Taking false branch}} // FIXME: Assigning to 'testObj->origin' kills the default binding for the // whole region, meaning that we've forgotten that testObj->size should also @@ -316,9 +321,12 @@ // expected-note@-1{{TRUE}} testObj->origin = makeIntPoint2D(1, 2); - if (testObj->size > 0) { ; } // expected-note{{Taking false branch}} - // expected-note@-1{{Taking false branch}} - // expected-note@-2{{Taking false branch}} + if (testObj->size > 0) { ; } // expected-note{{Assuming the condition is false}} + // expected-note@-1{{Assuming the condition is false}} + // expected-note@-2{{Assuming the condition is false}} + // expected-note@-3{{Taking false branch}} + // expected-note@-4{{Taking false branch}} + // expected-note@-5{{Taking false branch}} clang_analyzer_eval(testObj->size == 0); // expected-warning{{TRUE}} // expected-note@-1{{TRUE}} Index: test/Analysis/virtualcall.cpp =================================================================== --- test/Analysis/virtualcall.cpp +++ test/Analysis/virtualcall.cpp @@ -164,8 +164,10 @@ X(int i) { if (i > 0) { #if !PUREONLY - // expected-note-re@-2 {{{{^}}Taking true branch}} - // expected-note-re@-3 {{{{^}}Taking false branch}} + // expected-note-re@-2 {{{{^}}Assuming 'i' is > 0}} + // expected-note-re@-3 {{{{^}}Taking true branch}} + // expected-note-re@-4 {{{{^}}Assuming 'i' is <= 0}} + // expected-note-re@-5 {{{{^}}Taking false branch}} #endif X x(i - 1); #if !PUREONLY