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,18 @@ /// Visitor that tries to report interesting diagnostics from conditions. class ConditionBRVisitor final : public BugReporterVisitor { + + // When we are about to write out what we know about a condition we could + // 'Assuming...' or 'Knowing...' it based on the constraint range information + // attached to that condition: + // - If the constraint information is changed in a *specific way between two + // program states, we write out 'Assuming...' the condition as there is a + // new information for the reader. + // - Otherwise the constraint information is not changed so inform the user + // why we 'Taking...' a branch with write out 'Knowing...' the condition. + // *'specific way': see in 'VisitNodeImpl()'. + bool IsAssuming; + // FIXME: constexpr initialization isn't supported by MSVC2013. static const char *const GenericTrueMessage; static const char *const GenericFalseMessage; Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -82,6 +82,90 @@ return nullptr; } +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 DeclSV = State->getSVal(State->getLValue(CondVarVD, LCtx)); + + // The value may inline. + const auto InlineSV = State->getSVal(CondVarExpr, LCtx); + + const ConstraintRangeTy Ranges = State->get(); + for (auto I = Ranges.begin(); I != Ranges.end(); ++I) { + if (I.getKey() == DeclSV.getAsSymExpr() || + I.getKey() == InlineSV.getAsSymExpr()) { + return &I.getData(); + } + } + + return nullptr; +} + +static Optional getConcreteIntegerValue(const Expr *CondVarExpr, + const ExplodedNode *N) { + ProgramStateRef State = N->getState(); + + // If there is no value return. + if (!State->getStore()) + return {}; + + const LocationContext *LCtx = N->getLocationContext(); + const VarDecl *CondVarVD = getCondVarVD(CondVarExpr); + if (!CondVarVD) + return {}; + + // If symbolic range of the SVal is found that means the value is unknown. + if (getRangeSet(CondVarExpr, N)) + return {}; + + // 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 (const auto *IntValue = SVB.getKnownValue(State, DeclValue)) + return IntValue->getExtValue(); + } + + if (const auto InlineRegion = InlineSVal.getAsRegion()) { + const auto InlineValue = State->getRawSVal(loc::MemRegionVal(InlineRegion), + CondVarExpr->getType()); + auto &SVB = State->getStateManager().getSValBuilder(); + if (const auto *IntValue = SVB.getKnownValue(State, InlineValue)) + return IntValue->getExtValue(); + } + + return {}; +} + /// 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,16 +1882,43 @@ 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()) + const ExplodedNode *PredNode = N->getFirstPred(); + const ExplodedNode *PredPredNode = PredNode->getFirstPred(); + + ProgramStateRef PredState = PredNode->getState(); + ProgramStateRef PredPredState = + PredPredNode ? PredPredNode->getState() : PredState; + + const auto CurrentCR = N->getState()->get(); + const auto PredCR = PredState->get(); + const auto PredPredCR = PredPredState->get(); + + // We only want to check BlockEdges once so we have to determine if the change + // of the range information is not happened because of dead symbols. + // + // Here is the traversing (we walk 'upwards' on each predecessor node): + // + // (3) := [PredPredState]; (2) := [PredState]; (1) := [Current state]; + // + // c) (3) Ranges are empty. + // (2) Ranges are empty. + // (1) Range information of the BlockEdge. + // + // b) (3) Ranges are empty. + // (2) Range information of the BlockEdge. + // (1) Ranges are empty. (PreStmtPurgeDeadSymbols) + // + // a) (3) Range information of the BlockEdge. + // (2) Ranges are empty. (PreStmtPurgeDeadSymbols) + // (1) Ranges are empty. + // + // We want to keep (c) so we negate the conditions in (c). + if (PredCR != PredPredCR && CurrentCR == PredCR) return nullptr; + // If the constraint information does not changed there is no assumption. + IsAssuming = CurrentCR != PredCR; + // If an assumption was made on a branch, it should be caught // here by looking at the state transition. if (Optional BE = progPoint.getAs()) { @@ -1927,6 +2038,10 @@ break; } + // Prevent the generic message if we know there is no new information. + if (!IsAssuming) + return nullptr; + // Condition too complex to explain? Just say something so that the user // knew we've made some path decision at this point. const LocationContext *LCtx = N->getLocationContext(); @@ -2031,6 +2146,20 @@ return false; } + // At this point we cannot pretty-print the value because no information is + // available. If it is a variable just write it out. + const Stmt *SmallestChild = Ex; + for (const Stmt *Child : SmallestChild->children()) + SmallestChild = Child->IgnoreImplicit(); + + if (const auto *DRE = dyn_cast_or_null(SmallestChild)) + if (dyn_cast_or_null(DRE->getDecl())) + Out << '\'' + << Lexer::getSourceText( + CharSourceRange::getTokenRange(Ex->getSourceRange()), + BRC.getSourceManager(), BRC.getASTContext().getLangOpts(), 0) + << '\''; + return false; } @@ -2067,11 +2196,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) { @@ -2093,22 +2217,49 @@ default: return nullptr; } + + // Should we invert the strings if the LHS is not a variable name? + SmallString<256> buf; + llvm::raw_svector_ostream Out(buf); + StringRef ValueMessage = (shouldInvert ? LhsString : RhsString); + const RangeSet *CurrentRanges = getRangeSet(BExpr, N); + + // If there is no range information we just assume the value. + Out << (IsAssuming || !CurrentRanges ? "Assuming " : "Knowing ") + << (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; + default: + break; + case BO_EQ: + Out << "equal to " << ValueMessage; + break; + case BO_NE: + Out << "not equal to " << ValueMessage; + break; + case BO_LT: + case BO_LE: + Out << (CurrentRanges ? "<=" : BinaryOperator::getOpcodeStr(Op)) << ' '; + if (CurrentRanges) + Out << CurrentRanges->begin()->To(); + else + Out << ValueMessage; + break; + case BO_GT: + case BO_GE: + Out << (CurrentRanges ? ">=" : BinaryOperator::getOpcodeStr(Op)) << ' '; + if (CurrentRanges) + Out << CurrentRanges->begin()->From(); + else + Out << ValueMessage; + break; } - Out << (shouldInvert ? LhsString : RhsString); const LocationContext *LCtx = N->getLocationContext(); PathDiagnosticLocation Loc(Cond, BRC.getSourceManager(), LCtx); + if (!Loc.isValid() || !Loc.asLocation().isValid()) + return nullptr; + auto event = std::make_shared(Loc, Out.str()); if (shouldPrune.hasValue()) event->setPrunable(shouldPrune.getValue()); @@ -2156,27 +2307,36 @@ } 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; SmallString<256> Buf; llvm::raw_svector_ostream Out(Buf); + QualType Ty = VD->getType(); - Out << "Assuming '" << VD->getDeclName() << "' is "; + Out << (IsAssuming ? "Assuming '" : "Knowing '") << 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()) - Out << (tookTrue ? "not equal to 0" : "0"); - else + else if (Ty->isScalarType()) { + Optional Value = getConcreteIntegerValue(DRE, N); + if (IsAssuming || !Value.hasValue()) { + Out << (tookTrue ? "not equal to 0" : "0"); + } else { + const int ConcreteIntValue = Value.getValue(); + if (Ty->isBooleanType()) + Out << (ConcreteIntValue ? "true" : "false"); + else if (Ty->isIntegerType()) + Out << "equal to " << ConcreteIntValue; + } + } else return nullptr; const LocationContext *LCtx = N->getLocationContext(); Index: test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist =================================================================== --- test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist +++ test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist @@ -93,12 +93,75 @@ end - line11 + line9 + col7 + file0 + + + line9 + col7 + file0 + + + + + + + kindevent + location + + line9 + col7 + file0 + + ranges + + + + line9 + col7 + file0 + + + line9 + col7 + file0 + + + + depth0 + extended_message + Knowing 'p' is non-null + message + Knowing 'p' is non-null + + + kindcontrol + edges + + + start + + + line9 + col7 + file0 + + + line9 + col7 + file0 + + + end + + + line12 col5 file0 - line11 + line12 col10 file0 @@ -110,7 +173,7 @@ kindevent location - line11 + line12 col5 file0 @@ -118,12 +181,12 @@ - line11 + line12 col5 file0 - line11 + line12 col12 file0 @@ -143,12 +206,12 @@ start - line11 + line12 col5 file0 - line11 + line12 col10 file0 @@ -156,12 +219,12 @@ end - line14 + line15 col3 file0 - line14 + line15 col8 file0 @@ -173,7 +236,7 @@ kindevent location - line14 + line15 col3 file0 @@ -181,12 +244,12 @@ - line14 + line15 col3 file0 - line14 + line15 col10 file0 @@ -207,10 +270,10 @@ issue_hash_content_of_line_in_contextbd8e324d09c70b9e2be6f824a4942e5a issue_context_kindfunction issue_contexttest - issue_hash_function_offset8 + issue_hash_function_offset9 location - line14 + line15 col3 file0 @@ -221,8 +284,8 @@ 6 7 9 - 11 - 14 + 12 + 15 @@ -233,7 +296,7 @@ kindevent location - line25 + line26 col2 file0 @@ -241,12 +304,12 @@ - line25 + line26 col2 file0 - line25 + line26 col12 file0 @@ -262,7 +325,7 @@ kindevent location - line19 + line20 col2 file0 @@ -280,12 +343,12 @@ start - line19 + line20 col2 file0 - line19 + line20 col5 file0 @@ -293,12 +356,12 @@ end - line20 + line21 col3 file0 - line20 + line21 col8 file0 @@ -310,7 +373,7 @@ kindevent location - line20 + line21 col3 file0 @@ -318,12 +381,12 @@ - line20 + line21 col3 file0 - line20 + line21 col13 file0 @@ -339,7 +402,7 @@ kindevent location - line25 + line26 col2 file0 @@ -347,12 +410,12 @@ - line25 + line26 col2 file0 - line25 + line26 col12 file0 @@ -372,12 +435,12 @@ start - line25 + line26 col2 file0 - line25 + line26 col4 file0 @@ -385,12 +448,12 @@ end - line27 + line28 col2 file0 - line27 + line28 col7 file0 @@ -402,7 +465,7 @@ kindevent location - line27 + line28 col2 file0 @@ -410,12 +473,12 @@ - line27 + line28 col2 file0 - line27 + line28 col11 file0 @@ -439,7 +502,7 @@ issue_hash_function_offset3 location - line27 + line28 col2 file0 @@ -447,11 +510,11 @@ 0 - 19 20 - 24 + 21 25 - 27 + 26 + 28 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 @@ -668,6 +794,69 @@ end + line32 + col7 + file0 + + + line32 + col10 + file0 + + + + + + + kindevent + location + + line32 + col7 + file0 + + ranges + + + + line32 + col7 + file0 + + + line32 + col10 + file0 + + + + depth1 + extended_message + Knowing 'fail' is true + message + Knowing 'fail' is true + + + kindcontrol + edges + + + start + + + line32 + col7 + file0 + + + line32 + col10 + file0 + + + end + + line33 col5 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 @@ -7808,6 +8089,35 @@ + kindevent + location + + line267 + col18 + file0 + + ranges + + + + line267 + col18 + file0 + + + line267 + col22 + file0 + + + + depth0 + extended_message + Knowing 'coin' is 0 + message + Knowing 'coin' is 0 + + kindcontrol edges @@ -8660,6 +8970,35 @@ + kindevent + location + + line285 + col12 + file0 + + ranges + + + + line285 + col12 + file0 + + + line285 + col12 + file0 + + + + depth0 + extended_message + Knowing 'z' is equal to 0 + message + Knowing 'z' is equal to 0 + + kindcontrol edges @@ -9001,6 +9340,69 @@ end + line294 + col7 + file0 + + + line294 + col7 + file0 + + + + + + + kindevent + location + + line294 + col7 + file0 + + ranges + + + + line294 + col7 + file0 + + + line294 + col7 + file0 + + + + depth0 + extended_message + Knowing 'y' is null + message + Knowing 'y' is null + + + kindcontrol + edges + + + start + + + line294 + col7 + file0 + + + line294 + col7 + file0 + + + end + + line297 col3 file0 @@ -11589,6 +11991,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Knowing 'first' is equal to 1 + message + Knowing 'first' is equal to 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 @@ -11788,6 +12253,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Knowing 'first' is equal to 0 + message + Knowing 'first' is equal to 0 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line458 col7 file0 @@ -12053,6 +12581,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Knowing 'first' is equal to 1 + message + Knowing 'first' is equal to 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 @@ -12536,12 +13127,75 @@ line457 - col5 + col5 + file0 + + + line457 + col6 + file0 + + + end + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Knowing 'first' is equal to 1 + message + Knowing 'first' is equal to 1 + + + kindcontrol + edges + + + start + + + line457 + col9 file0 line457 - col6 + col9 file0 @@ -13110,6 +13764,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Knowing 'first' is equal to 1 + message + Knowing 'first' is equal to 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 @@ -14591,6 +15308,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Knowing 'first' is equal to 1 + message + Knowing 'first' is equal to 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 @@ -16199,6 +16979,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Knowing 'first' is equal to 1 + message + Knowing 'first' is equal to 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 @@ -18032,6 +18875,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Knowing 'first' is equal to 1 + message + Knowing 'first' is equal to 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 Index: test/Analysis/Inputs/expected-plists/inline-plist.c.plist =================================================================== --- test/Analysis/Inputs/expected-plists/inline-plist.c.plist +++ test/Analysis/Inputs/expected-plists/inline-plist.c.plist @@ -518,12 +518,75 @@ end - line47 + line45 + col7 + file0 + + + line45 + col7 + file0 + + + + + + + kindevent + location + + line45 + col7 + file0 + + ranges + + + + line45 + col7 + file0 + + + line45 + col12 + file0 + + + + depth0 + extended_message + Knowing 'p' is equal to null + message + Knowing 'p' is equal to null + + + kindcontrol + edges + + + start + + + line45 + col7 + file0 + + + line45 + col7 + file0 + + + end + + + line48 col5 file0 - line47 + line48 col16 file0 @@ -535,7 +598,7 @@ kindevent location - line47 + line48 col18 file0 @@ -543,12 +606,12 @@ - line47 + line48 col18 file0 - line47 + line48 col18 file0 @@ -564,7 +627,7 @@ kindevent location - line47 + line48 col5 file0 @@ -572,12 +635,12 @@ - line47 + line48 col5 file0 - line47 + line48 col19 file0 @@ -725,7 +788,7 @@ 38 39 45 - 47 + 48 @@ -736,7 +799,7 @@ kindevent location - line58 + line59 col3 file0 @@ -744,12 +807,12 @@ - line58 + line59 col3 file0 - line58 + line59 col8 file0 @@ -769,12 +832,12 @@ start - line58 + line59 col3 file0 - line58 + line59 col5 file0 @@ -782,12 +845,12 @@ end - line59 + line60 col3 file0 - line59 + line60 col3 file0 @@ -799,7 +862,7 @@ kindevent location - line59 + line60 col3 file0 @@ -807,12 +870,12 @@ - line59 + line60 col3 file0 - line61 + line62 col5 file0 @@ -828,7 +891,7 @@ kindevent location - line59 + line60 col3 file0 @@ -846,12 +909,12 @@ start - line59 + line60 col3 file0 - line59 + line60 col3 file0 @@ -859,12 +922,12 @@ end - line60 + line61 col5 file0 - line60 + line61 col5 file0 @@ -880,12 +943,12 @@ start - line60 + line61 col5 file0 - line60 + line61 col5 file0 @@ -893,12 +956,12 @@ end - line60 + line61 col8 file0 - line60 + line61 col8 file0 @@ -910,7 +973,7 @@ kindevent location - line60 + line61 col8 file0 @@ -918,12 +981,12 @@ - line60 + line61 col6 file0 - line60 + line61 col6 file0 @@ -944,7 +1007,7 @@ issue_hash_content_of_line_in_contexta2e7504f29818834127c44ba841f4da8 location - line60 + line61 col8 file0 @@ -952,10 +1015,10 @@ 0 - 57 58 59 60 + 61 @@ -970,12 +1033,12 @@ start - line66 + line67 col3 file0 - line66 + line67 col5 file0 @@ -983,12 +1046,12 @@ end - line66 + line67 col12 file0 - line66 + line67 col12 file0 @@ -1000,7 +1063,7 @@ kindevent location - line66 + line67 col12 file0 @@ -1008,12 +1071,12 @@ - line66 + line67 col12 file0 - line69 + line70 col5 file0 @@ -1029,7 +1092,7 @@ kindevent location - line66 + line67 col12 file0 @@ -1047,12 +1110,12 @@ start - line66 + line67 col12 file0 - line66 + line67 col12 file0 @@ -1060,12 +1123,12 @@ end - line67 + line68 col5 file0 - line67 + line68 col7 file0 @@ -1077,7 +1140,7 @@ kindevent location - line67 + line68 col5 file0 @@ -1085,12 +1148,12 @@ - line67 + line68 col5 file0 - line67 + line68 col10 file0 @@ -1110,12 +1173,12 @@ start - line67 + line68 col5 file0 - line67 + line68 col7 file0 @@ -1123,12 +1186,12 @@ end - line68 + line69 col5 file0 - line68 + line69 col10 file0 @@ -1140,7 +1203,7 @@ kindevent location - line68 + line69 col5 file0 @@ -1148,12 +1211,12 @@ - line68 + line69 col5 file0 - line68 + line69 col12 file0 @@ -1169,7 +1232,7 @@ kindevent location - line66 + line67 col12 file0 @@ -1177,12 +1240,12 @@ - line66 + line67 col12 file0 - line69 + line70 col5 file0 @@ -1202,12 +1265,12 @@ start - line66 + line67 col12 file0 - line66 + line67 col12 file0 @@ -1215,12 +1278,12 @@ end - line66 + line67 col3 file0 - line66 + line67 col5 file0 @@ -1232,7 +1295,7 @@ kindevent location - line66 + line67 col3 file0 @@ -1240,12 +1303,12 @@ - line66 + line67 col3 file0 - line66 + line67 col8 file0 @@ -1265,12 +1328,12 @@ start - line66 + line67 col3 file0 - line66 + line67 col5 file0 @@ -1278,12 +1341,12 @@ end - line70 + line71 col3 file0 - line70 + line71 col3 file0 @@ -1299,12 +1362,12 @@ start - line70 + line71 col3 file0 - line70 + line71 col3 file0 @@ -1312,12 +1375,12 @@ end - line70 + line71 col6 file0 - line70 + line71 col6 file0 @@ -1329,7 +1392,7 @@ kindevent location - line70 + line71 col6 file0 @@ -1337,12 +1400,12 @@ - line70 + line71 col4 file0 - line70 + line71 col4 file0 @@ -1366,7 +1429,7 @@ issue_hash_function_offset5 location - line70 + line71 col6 file0 @@ -1374,11 +1437,11 @@ 0 - 65 66 67 68 - 70 + 69 + 71 @@ -1393,12 +1456,12 @@ start - line74 + line75 col3 file0 - line74 + line75 col9 file0 @@ -1406,12 +1469,12 @@ end - line75 + line76 col3 file0 - line75 + line76 col3 file0 @@ -1423,7 +1486,7 @@ kindevent location - line75 + line76 col3 file0 @@ -1431,12 +1494,12 @@ - line75 + line76 col3 file0 - line77 + line78 col5 file0 @@ -1452,7 +1515,7 @@ kindevent location - line75 + line76 col3 file0 @@ -1470,12 +1533,12 @@ start - line75 + line76 col3 file0 - line75 + line76 col3 file0 @@ -1483,12 +1546,12 @@ end - line76 + line77 col5 file0 - line76 + line77 col5 file0 @@ -1500,7 +1563,7 @@ kindevent location - line76 + line77 col5 file0 @@ -1508,12 +1571,12 @@ - line76 + line77 col5 file0 - line76 + line77 col9 file0 @@ -1529,7 +1592,7 @@ kindevent location - line75 + line76 col3 file0 @@ -1537,12 +1600,12 @@ - line75 + line76 col3 file0 - line77 + line78 col5 file0 @@ -1562,12 +1625,12 @@ start - line75 + line76 col3 file0 - line75 + line76 col3 file0 @@ -1575,12 +1638,12 @@ end - line78 + line79 col3 file0 - line78 + line79 col3 file0 @@ -1596,12 +1659,12 @@ start - line78 + line79 col3 file0 - line78 + line79 col3 file0 @@ -1609,12 +1672,12 @@ end - line78 + line79 col6 file0 - line78 + line79 col6 file0 @@ -1626,7 +1689,7 @@ kindevent location - line78 + line79 col6 file0 @@ -1634,12 +1697,12 @@ - line78 + line79 col4 file0 - line78 + line79 col4 file0 @@ -1663,7 +1726,7 @@ issue_hash_function_offset5 location - line78 + line79 col6 file0 @@ -1671,11 +1734,11 @@ 0 - 73 74 75 76 - 78 + 77 + 79 @@ -1690,12 +1753,12 @@ start - line82 + line83 col3 file0 - line82 + line83 col5 file0 @@ -1703,12 +1766,12 @@ end - line83 + line84 col3 file0 - line83 + line84 col3 file0 @@ -1720,7 +1783,7 @@ kindevent location - line83 + line84 col3 file0 @@ -1728,12 +1791,12 @@ - line83 + line84 col3 file0 - line85 + line86 col7 file0 @@ -1749,7 +1812,7 @@ kindevent location - line83 + line84 col3 file0 @@ -1767,12 +1830,12 @@ start - line83 + line84 col3 file0 - line83 + line84 col3 file0 @@ -1780,12 +1843,12 @@ end - line84 + line85 col5 file0 - line84 + line85 col5 file0 @@ -1797,7 +1860,7 @@ kindevent location - line84 + line85 col5 file0 @@ -1805,12 +1868,12 @@ - line84 + line85 col5 file0 - line84 + line85 col10 file0 @@ -1826,7 +1889,7 @@ kindevent location - line83 + line84 col3 file0 @@ -1834,12 +1897,12 @@ - line83 + line84 col3 file0 - line85 + line86 col7 file0 @@ -1859,12 +1922,12 @@ start - line83 + line84 col3 file0 - line83 + line84 col3 file0 @@ -1872,12 +1935,12 @@ end - line86 + line87 col3 file0 - line86 + line87 col3 file0 @@ -1893,12 +1956,12 @@ start - line86 + line87 col3 file0 - line86 + line87 col3 file0 @@ -1906,12 +1969,12 @@ end - line86 + line87 col6 file0 - line86 + line87 col6 file0 @@ -1923,7 +1986,7 @@ kindevent location - line86 + line87 col6 file0 @@ -1931,12 +1994,12 @@ - line86 + line87 col4 file0 - line86 + line87 col4 file0 @@ -1960,7 +2023,7 @@ issue_hash_function_offset5 location - line86 + line87 col6 file0 @@ -1968,12 +2031,12 @@ 0 - 81 82 83 84 85 86 + 87 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 @@ -1,4 +1,4 @@ - + kindcontrol edges @@ -58,9 +58,9 @@ depth0 extended_message - Assuming 'in' is > 5 + Assuming 'in' is >= 6 message - Assuming 'in' is > 5 + Assuming 'in' is >= 6 kindcontrol 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 @@ -1389,6 +1389,35 @@ depth0 extended_message + Knowing 'p' is null + message + Knowing 'p' is null + + + kindevent + location + + line69 + col3 + file0 + + ranges + + + + line69 + col3 + file0 + + + line69 + col16 + file0 + + + + depth0 + extended_message Assuming 'y' is 0 message Assuming 'y' is 0 @@ -1525,7 +1554,7 @@ kindevent location - line83 + line87 col3 file0 @@ -1533,12 +1562,12 @@ - line83 + line87 col3 file0 - line83 + line87 col12 file0 @@ -1546,15 +1575,15 @@ depth0 extended_message - Passing null pointer value via 1st parameter 'a' + Passing value via 1st parameter 'a' message - Passing null pointer value via 1st parameter 'a' + Passing value via 1st parameter 'a' kindevent location - line83 + line87 col3 file0 @@ -1562,12 +1591,12 @@ - line83 + line87 col3 file0 - line83 + line87 col12 file0 @@ -1589,9 +1618,9 @@ depth1 extended_message - Entered call from 'test1' + Entered call from 'test2' message - Entered call from 'test1' + Entered call from 'test2' kindcontrol @@ -1648,6 +1677,69 @@ end + line77 + col7 + file0 + + + line77 + col7 + file0 + + + + + + + kindevent + location + + line77 + col7 + file0 + + ranges + + + + line77 + col7 + file0 + + + line77 + col7 + file0 + + + + depth1 + extended_message + Assuming 'a' is null + message + Assuming 'a' is null + + + kindcontrol + edges + + + start + + + line77 + col7 + file0 + + + line77 + col7 + file0 + + + end + + line79 col3 file0 @@ -1747,8 +1839,8 @@ 76 77 79 - 82 - 83 + 86 + 87 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 Index: test/Analysis/MisusedMovedObject.cpp =================================================================== --- test/Analysis/MisusedMovedObject.cpp +++ test/Analysis/MisusedMovedObject.cpp @@ -184,10 +184,12 @@ } { A a; - if (i == 1) { // expected-note {{Taking false branch}} expected-note {{Taking false branch}} + if (i == 1) { // expected-note {{Knowing 'i' is not equal to 1}} expected-note {{Taking false branch}} + // expected-note@-1 {{Knowing 'i' is not equal to 1}} expected-note@-1 {{Taking false branch}} std::move(a); } - if (i == 2) { // expected-note {{Taking false branch}} expected-note {{Taking false branch}} + if (i == 2) { // expected-note {{Knowing 'i' is not equal to 2}} expected-note {{Taking false branch}} + // expected-note@-1 {{Knowing 'i' is not equal to 2}} expected-note@-1 {{Taking false branch}} a = A(); a.foo(); } @@ -216,7 +218,7 @@ if (i < 10) { // expected-note {{Assuming 'i' is >= 10}} expected-note {{Taking false branch}} a = A(); } - if (i > 5) { // expected-note {{Taking true branch}} + if (i > 5) { // expected-note {{Knowing 'i' is >= 10}} expected-note {{Taking true branch}} a.foo(); // expected-warning {{Method call on a 'moved-from' object 'a'}} expected-note {{Method call on a 'moved-from' object 'a'}} } } @@ -460,7 +462,7 @@ // Don't warn if the use is in a different branch from the move. { A a; - if (i > 0) { // expected-note {{Assuming 'i' is > 0}} expected-note {{Taking true branch}} + if (i > 0) { // expected-note {{Assuming 'i' is >= 1}} expected-note {{Taking true branch}} A b; b = std::move(a); } else { @@ -470,7 +472,7 @@ // Same thing, but with a ternary operator. { A a, b; - i > 0 ? (void)(b = std::move(a)) : a.bar(); // no-warning // expected-note {{'?' condition is true}} + i > 0 ? (void)(b = std::move(a)) : a.bar(); // no-warning // expected-note {{Knowing 'i' is >= 1}} expected-note {{'?' condition is true}} } // A variation on the theme above. { Index: test/Analysis/NewDelete-path-notes.cpp =================================================================== --- test/Analysis/NewDelete-path-notes.cpp +++ test/Analysis/NewDelete-path-notes.cpp @@ -7,7 +7,8 @@ int *p = new int; // expected-note@-1 {{Memory is allocated}} if (p) - // expected-note@-1 {{Taking true branch}} + // expected-note@-1 {{Knowing 'p' is non-null}} + // expected-note@-2 {{Taking true branch}} delete p; // expected-note@-1 {{Memory is released}} Index: test/Analysis/diagnostics/macros.cpp =================================================================== --- test/Analysis/diagnostics/macros.cpp +++ test/Analysis/diagnostics/macros.cpp @@ -28,9 +28,9 @@ } } -// 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/no-store-func-path-notes.c =================================================================== --- test/Analysis/diagnostics/no-store-func-path-notes.c +++ test/Analysis/diagnostics/no-store-func-path-notes.c @@ -4,7 +4,8 @@ void *memset(void *__s, int __c, size_t __n); int initializer1(int *p, int x) { - if (x) { // expected-note{{Taking false branch}} + if (x) { // expected-note{{Knowing 'x' is equal to 0}} + // expected-note@-1{{Taking false branch}} *p = 1; return 0; } else { @@ -29,7 +30,8 @@ static int global; int initializer2(int **p, int x) { - if (x) { // expected-note{{Taking false branch}} + if (x) { // expected-note{{Knowing 'x' is equal to 0}} + // expected-note@-1{{Taking false branch}} *p = &global; return 0; } else { @@ -46,7 +48,8 @@ } void initializer3(int *p, int param) { - if (param) // expected-note{{Taking false branch}} + if (param) // expected-note{{Knowing 'param' is equal to 0}} + // expected-note@-1{{Taking false branch}} *p = 0; } // expected-note{{Returning without writing to '*p'}} @@ -59,12 +62,14 @@ } void initializer4(int *p, int param) { - if (param) // expected-note{{Taking false branch}} + if (param) // expected-note{{Knowing 'param' is equal to 0}} + // expected-note@-1{{Taking false branch}} *p = 0; } // expected-note{{Returning without writing to '*p'}} void initializer5(int *p, int param) { - if (!param) // expected-note{{Taking false branch}} + if (!param) // expected-note{{Knowing 'param' is equal to 1}} + // expected-note@-1{{Taking false branch}} *p = 0; } // expected-note{{Returning without writing to '*p'}} @@ -94,7 +99,8 @@ } S; int initializer7(S *s, int param) { - if (param) { // expected-note{{Taking false branch}} + if (param) { // expected-note{{Knowing 'param' is equal to 0}} + // expected-note@-1{{Taking false branch}} s->x = 0; return 0; } Index: test/Analysis/diagnostics/no-store-func-path-notes.cpp =================================================================== --- test/Analysis/diagnostics/no-store-func-path-notes.cpp +++ test/Analysis/diagnostics/no-store-func-path-notes.cpp @@ -1,7 +1,8 @@ // RUN: %clang_analyze_cc1 -x c++ -std=c++14 -analyzer-checker=core -analyzer-output=text -verify %s int initializer1(int &p, int x) { - if (x) { // expected-note{{Taking false branch}} + if (x) { // expected-note{{Knowing 'x' is equal to 0}} + // expected-note@-1{{Taking false branch}} p = 1; return 0; } else { @@ -19,7 +20,8 @@ struct S { int initialize(int *p, int param) { - if (param) { //expected-note{{Taking false branch}} + if (param) { //expected-note{{Knowing 'param' is equal to 0}} + //expected-note@-1{{Taking false branch}} *p = 1; return 1; } Index: test/Analysis/diagnostics/no-store-func-path-notes.m =================================================================== --- test/Analysis/diagnostics/no-store-func-path-notes.m +++ test/Analysis/diagnostics/no-store-func-path-notes.m @@ -10,7 +10,8 @@ @implementation I - (int)initVar:(int *)var param:(int)param { - if (param) { // expected-note{{Taking false branch}} + if (param) { // expected-note{{Knowing 'param' is equal to 0}} + // expected-note@-1{{Taking false branch}} *var = 1; return 0; } @@ -22,14 +23,16 @@ int x; //expected-note{{'x' declared without an initial value}} int out = [i initVar:&x param:0]; //expected-note{{Calling 'initVar:param:'}} //expected-note@-1{{Returning from 'initVar:param:'}} - if (out) // expected-note{{Taking true branch}} + if (out) //expected-note{{Knowing 'out' is equal to 1}} + //expected-note@-1{{Taking true branch}} return x; //expected-warning{{Undefined or garbage value returned to caller}} //expected-note@-1{{Undefined or garbage value returned to caller}} return 0; } int initializer1(int *p, int x) { - if (x) { // expected-note{{Taking false branch}} + if (x) { // expected-note{{Knowing 'x' is equal to 0}} + // expected-note@-1{{Taking false branch}} *p = 1; return 0; } else { Index: test/Analysis/inline-plist.c =================================================================== --- test/Analysis/inline-plist.c +++ test/Analysis/inline-plist.c @@ -43,7 +43,8 @@ } if (p == 0) { - // expected-note@-1 {{Taking true branch}} + // expected-note@-1 {{Knowing 'p' is equal to null}} + // expected-note@-2 {{Taking true branch}} triggers_bug(p); // expected-note@-1 {{Passing null pointer value via 1st parameter 'p'}} // expected-note@-2 {{Calling 'triggers_bug'}} Index: test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist =================================================================== --- test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist +++ test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist @@ -4678,9 +4678,9 @@ depth0 extended_message - Assuming pointer value is null + Assuming '&val' is equal to null message - Assuming pointer value is null + Assuming '&val' is equal to null kindcontrol Index: test/Analysis/inlining/path-notes.cpp =================================================================== --- test/Analysis/inlining/path-notes.cpp +++ test/Analysis/inlining/path-notes.cpp @@ -256,7 +256,7 @@ // This is not valid C++; if 'ptr' were null, creating 'ref' would be illegal. // However, this is not checked at runtime, so this branch is actually // possible. - if (&val == 0) { //expected-note {{Assuming pointer value is null}} + if (&val == 0) { //expected-note {{Assuming '&val' is equal to null}} // expected-note@-1 {{Taking true branch}} val.bar(); // expected-warning {{Called C++ object pointer is null}} // expected-note@-1 {{Called C++ object pointer is null}} Index: test/Analysis/loop-widening-notes.cpp =================================================================== --- test/Analysis/loop-widening-notes.cpp +++ test/Analysis/loop-widening-notes.cpp @@ -30,7 +30,7 @@ if (num < 0) // expected-note {{Assuming 'num' is >= 0}} // expected-note@-1 {{Taking false branch}} flag_b = 0; - else if (num >= 1) // expected-note {{Assuming 'num' is < 1}} + else if (num >= 1) // expected-note {{Assuming 'num' is <= 0}} // expected-note@-1 {{Taking false branch}} flag_b = 50; else Index: test/Analysis/null-deref-path-notes.cpp =================================================================== --- test/Analysis/null-deref-path-notes.cpp +++ test/Analysis/null-deref-path-notes.cpp @@ -19,7 +19,7 @@ // expected-note@-1{{Array access (via field 'd') results in a null pointer dereference}} B h, a; // expected-note{{Value assigned to 'h.d'}} a.d == __null; // expected-note{{Assuming the condition is true}} - a.d != h.d; // expected-note{{Assuming pointer value is null}} + a.d != h.d; // expected-note{{Assuming 'a.d' is equal to 'h.d'}} f(h, b); // expected-note{{Calling 'c::f'}} } } Index: test/Analysis/osobject-retain-release.cpp =================================================================== --- test/Analysis/osobject-retain-release.cpp +++ test/Analysis/osobject-retain-release.cpp @@ -142,7 +142,8 @@ void check_dynamic_cast_null_branch(OSObject *obj) { OSArray *arr1 = OSArray::withCapacity(10); // expected-note{{Call to function 'withCapacity' returns an OSObject}} OSArray *arr = OSDynamicCast(OSArray, obj); - if (!arr) // expected-note{{Taking true branch}} + if (!arr) // expected-note{{Knowing 'arr' is null}} + // expected-note@-1{{Taking true branch}} return; // expected-warning{{Potential leak}} // expected-note@-1{{Object leaked}} arr1->release(); 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 'testObj->size' is <= 0}} + // 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}} + if (testObj->size > 0) { ; } // expected-note{{Assuming 'testObj->size' is <= 0}} // expected-note@-1{{Taking false branch}} - // expected-note@-2{{Taking false branch}} + // expected-note@-2{{Assuming 'testObj->size' is <= 0}} // expected-note@-3{{Taking false branch}} + // expected-note@-4{{Assuming 'testObj->size' is <= 0}} + // expected-note@-5{{Taking false branch}} + // expected-note@-6{{Assuming 'testObj->size' is <= 0}} + // 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}} + if (testObj->size > 0) { ; } // expected-note{{Assuming 'testObj->size' is <= 0}} // expected-note@-1{{Taking false branch}} - // expected-note@-2{{Taking false branch}} + // expected-note@-2{{Assuming 'testObj->size' is <= 0}} + // expected-note@-3{{Taking false branch}} + // expected-note@-4{{Assuming 'testObj->size' is <= 0}} + // 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