Index: include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h =================================================================== --- include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h +++ include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h @@ -163,6 +163,12 @@ // FIXME: constexpr initialization isn't supported by MSVC2013. static const char *const GenericTrueMessage; static const char *const GenericFalseMessage; + + // If the constraint information is changed between the current and the + // previous program state we assuming the newly seen constraint information. + // If we cannot evaluate the condition (and the constraints are the same) + // the analyzer has no information about the value and just assuming it. + bool IsAssuming; public: void Profile(llvm::FoldingSetNodeID &ID) const override { Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -153,6 +153,28 @@ return E; } +static Optional +getConcreteIntegerValue(const Expr *CondVarExpr, const ExplodedNode *N) { + ProgramStateRef State = N->getState(); + const LocationContext *LCtx = N->getLocationContext(); + + // The value may hard-coded. + SVal HardCodedSVal = State->getSVal(CondVarExpr, LCtx); + if (auto HardCodedCI = HardCodedSVal.getAs()) + return &HardCodedCI->getValue(); + + // The declaration of the value may rely on a pointer so take its l-value. + if (const auto *DRE = dyn_cast_or_null(CondVarExpr)) { + if (const auto *VD = dyn_cast_or_null(DRE->getDecl())) { + SVal DeclSVal = State->getSVal(State->getLValue(VD, LCtx)); + if (auto DeclCI = DeclSVal.getAs()) + return &DeclCI->getValue(); + } + } + + return {}; +} + //===----------------------------------------------------------------------===// // Definitions for bug reporter visitors. //===----------------------------------------------------------------------===// @@ -1787,30 +1809,37 @@ std::shared_ptr ConditionBRVisitor::VisitNodeImpl(const ExplodedNode *N, BugReporterContext &BRC, BugReport &BR) { - ProgramPoint progPoint = N->getLocation(); + ProgramPoint ProgPoint = N->getLocation(); + const std::pair &Tags = + ExprEngine::geteagerlyAssumeBinOpBifurcationTags(); // 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 (Optional BE = ProgPoint.getAs()) { + const CFGBlock *SrcBlock = BE->getSrc(); + if (const Stmt *Term = SrcBlock->getTerminator()) { + + // If the tag of the previous node is 'Eagerly Assume...' the current + // 'BlockEdge' has the same constraint information. We do not want to + // report the value as it is just an assumption on the predecessor node + // which will be caught in the next VisitNode() iteration as a 'PostStmt'. + const ProgramPointTag *PreviousNodeTag = + N->getFirstPred()->getLocation().getTag(); + if (PreviousNodeTag == Tags.first || PreviousNodeTag == Tags.second) + return nullptr; + + return VisitTerminator(Term, N, SrcBlock, BE->getDst(), BR, BRC); + } return nullptr; } - if (Optional PS = progPoint.getAs()) { - const std::pair &tags = - 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 (Optional PS = ProgPoint.getAs()) { + const ProgramPointTag *CurrentNodeTag = PS->getTag(); + if (CurrentNodeTag != Tags.first && CurrentNodeTag != Tags.second) + return nullptr; - return nullptr; + bool TookTrue = CurrentNodeTag == Tags.first; + return VisitTrueTest(cast(PS->getStmt()), TookTrue, BRC, BR, N); } return nullptr; @@ -1876,16 +1905,16 @@ BugReporterContext &BRC, BugReport &R, const ExplodedNode *N) { ProgramStateRef CurrentState = N->getState(); - ProgramStateRef PreviousState = N->getFirstPred()->getState(); + ProgramStateRef PrevState = N->getFirstPred()->getState(); const LocationContext *LCtx = N->getLocationContext(); // If the constraint information is changed between the current and the // previous program state we assuming the newly seen constraint information. // If we cannot evaluate the condition (and the constraints are the same) // the analyzer has no information about the value and just assuming it. - if (BRC.getStateManager().haveEqualConstraints(CurrentState, PreviousState) && - CurrentState->getSVal(Cond, LCtx).isValid()) - return nullptr; + IsAssuming = + !BRC.getStateManager().haveEqualConstraints(CurrentState, PrevState) || + CurrentState->getSVal(Cond, LCtx).isUnknownOrUndef(); // These will be modified in code below, but we need to preserve the original // values in case we want to throw the generic message. @@ -2062,7 +2091,8 @@ // 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 "; + Out << (IsAssuming ? "Assuming " : "") + << (shouldInvert ? RhsString : LhsString) << " is "; // Do we need to invert the opcode? if (shouldInvert) @@ -2148,27 +2178,34 @@ } 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); - Out << "Assuming '" << VD->getDeclName() << "' is "; + Out << (IsAssuming ? "Assuming '" : "'") << VD->getDeclName() << "' is "; - QualType VDTy = VD->getType(); + QualType Ty = 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 IntValue; + if (!IsAssuming) + IntValue = getConcreteIntegerValue(DRE, N); + + if (IsAssuming || !IntValue.hasValue()) + Out << (tookTrue ? "not equal to 0" : "0"); + else + Out << *IntValue.getValue(); + } 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 @@ -90,6 +90,69 @@ file0 + end + + + line9 + col7 + file0 + + + line9 + col7 + file0 + + + + + + + kindevent + location + + line9 + col7 + file0 + + ranges + + + + line9 + col7 + file0 + + + line9 + col7 + file0 + + + + depth0 + extended_message + 'p' is non-null + message + 'p' is non-null + + + kindcontrol + edges + + + start + + + line9 + col7 + file0 + + + line9 + col7 + file0 + + end 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 @@ -158,6 +158,69 @@ file0 + end + + + line11 + col9 + file0 + + + line11 + col9 + file0 + + + + + + + kindevent + location + + line11 + col9 + file0 + + ranges + + + + line11 + col9 + file0 + + + line11 + col14 + file0 + + + + depth0 + extended_message + 'y' is not equal to 2 + message + 'y' is not equal to 2 + + + kindcontrol + edges + + + start + + + line11 + col9 + file0 + + + line11 + col9 + file0 + + end @@ -420,6 +483,69 @@ file0 + end + + + line11 + col9 + file0 + + + line11 + col9 + file0 + + + + + + + kindevent + location + + line11 + col9 + file0 + + ranges + + + + line11 + col9 + file0 + + + line11 + col14 + file0 + + + + depth0 + extended_message + 'y' is equal to 2 + message + 'y' is equal to 2 + + + kindcontrol + edges + + + start + + + line11 + col9 + file0 + + + line11 + col9 + file0 + + end @@ -665,6 +791,69 @@ file0 + end + + + line32 + col7 + file0 + + + line32 + col10 + file0 + + + + + + + kindevent + location + + line32 + col7 + file0 + + ranges + + + + line32 + col7 + file0 + + + line32 + col10 + file0 + + + + depth1 + extended_message + 'fail' is 1 + message + 'fail' is 1 + + + kindcontrol + edges + + + start + + + line32 + col7 + file0 + + + line32 + col10 + file0 + + end 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 @@ -2710,6 +2710,35 @@ + + kindevent + location + + line146 + col8 + file0 + + ranges + + + + line146 + col8 + file0 + + + line146 + col13 + file0 + + + + depth0 + extended_message + 'i' is not equal to 1 + message + 'i' is not equal to 1 + kindcontrol edges @@ -2888,6 +2917,69 @@ file0 + end + + + line146 + col8 + file0 + + + line146 + col8 + file0 + + + + + + + kindevent + location + + line146 + col8 + file0 + + ranges + + + + line146 + col8 + file0 + + + line146 + col13 + file0 + + + + depth0 + extended_message + 'i' is equal to 1 + message + 'i' is equal to 1 + + + kindcontrol + edges + + + start + + + line146 + col8 + file0 + + + line146 + col8 + file0 + + end @@ -3806,6 +3898,69 @@ file0 + end + + + line178 + col9 + file0 + + + line178 + col9 + file0 + + + + + + + kindevent + location + + line178 + col9 + file0 + + ranges + + + + line178 + col9 + file0 + + + line178 + col14 + file0 + + + + depth0 + extended_message + 'i' is equal to 0 + message + 'i' is equal to 0 + + + kindcontrol + edges + + + start + + + line178 + col9 + file0 + + + line178 + col9 + file0 + + end @@ -4000,6 +4155,69 @@ file0 + end + + + line178 + col9 + file0 + + + line178 + col9 + file0 + + + + + + + kindevent + location + + line178 + col9 + file0 + + ranges + + + + line178 + col9 + file0 + + + line178 + col14 + file0 + + + + depth0 + extended_message + 'i' is not equal to 0 + message + 'i' is not equal to 0 + + + kindcontrol + edges + + + start + + + line178 + col9 + file0 + + + line178 + col9 + file0 + + end @@ -4034,6 +4252,69 @@ file0 + end + + + line181 + col9 + file0 + + + line181 + col9 + file0 + + + + + + + kindevent + location + + line181 + col9 + file0 + + ranges + + + + line181 + col9 + file0 + + + line181 + col14 + file0 + + + + depth0 + extended_message + 'i' is equal to 1 + message + 'i' is equal to 1 + + + kindcontrol + edges + + + start + + + line181 + col9 + file0 + + + line181 + col9 + file0 + + end @@ -6416,6 +6697,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 @@ -6450,6 +6760,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 @@ -6674,6 +7013,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 @@ -6708,6 +7076,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 @@ -6932,6 +7329,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 @@ -7253,6 +7679,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 @@ -7637,6 +8092,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 @@ -7865,6 +8349,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 @@ -7899,6 +8412,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 @@ -7933,6 +8475,35 @@ + + kindevent + location + + line267 + col18 + file0 + + ranges + + + + line267 + col18 + file0 + + + line267 + col22 + file0 + + + + depth0 + extended_message + 'coin' is 0 + message + 'coin' is 0 + kindcontrol edges @@ -8158,6 +8729,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 @@ -8192,6 +8792,35 @@ + + 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 @@ -8323,6 +8952,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 @@ -8454,6 +9112,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 @@ -8911,6 +9598,35 @@ + + kindevent + location + + line285 + col12 + file0 + + ranges + + + + line285 + col12 + file0 + + + line285 + col12 + file0 + + + + depth0 + extended_message + 'z' is 0 + message + 'z' is 0 + kindcontrol edges @@ -9250,6 +9966,69 @@ file0 + end + + + line294 + col7 + file0 + + + line294 + col7 + file0 + + + + + + + kindevent + location + + line294 + col7 + file0 + + ranges + + + + line294 + col7 + file0 + + + line294 + col7 + file0 + + + + depth0 + extended_message + 'y' is null + message + 'y' is null + + + kindcontrol + edges + + + start + + + line294 + col7 + file0 + + + line294 + col7 + file0 + + end @@ -11778,8 +12557,42 @@ file0 - line454 - col8 + line454 + col8 + file0 + + + + + + + kindcontrol + edges + + + start + + + line454 + col5 + file0 + + + line454 + col8 + file0 + + + end + + + line457 + col5 + file0 + + + line457 + col6 file0 @@ -11794,13 +12607,13 @@ start - line454 + line457 col5 file0 - line454 - col8 + line457 + col6 file0 @@ -11808,18 +12621,47 @@ line457 - col5 + col9 file0 line457 - col6 + col9 file0 + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + 'first' is 1 + message + 'first' is 1 + kindcontrol edges @@ -11829,12 +12671,12 @@ line457 - col5 + col9 file0 line457 - col6 + col9 file0 @@ -12037,6 +12879,69 @@ file0 + end + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + 'first' is 0 + message + 'first' is 0 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + end @@ -12302,6 +13207,69 @@ file0 + end + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + 'first' is 1 + message + 'first' is 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + end @@ -12797,6 +13765,69 @@ file0 + end + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + 'first' is 1 + message + 'first' is 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + end @@ -13350,12 +14381,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 + 'first' is 1 + message + 'first' is 1 + + + kindcontrol + edges + + + start + + + line457 + col9 file0 line457 - col6 + col9 file0 @@ -14840,6 +15934,69 @@ file0 + end + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + 'first' is 1 + message + 'first' is 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + end @@ -16448,6 +17605,69 @@ file0 + end + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + 'first' is 1 + message + 'first' is 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + end @@ -18281,6 +19501,69 @@ file0 + end + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + 'first' is 1 + message + 'first' is 1 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + end @@ -21590,6 +22873,69 @@ file0 + 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 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 + 'p' is equal to null + message + '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/model-file.cpp.plist =================================================================== --- test/Analysis/Inputs/expected-plists/model-file.cpp.plist +++ test/Analysis/Inputs/expected-plists/model-file.cpp.plist @@ -124,6 +124,69 @@ file0 + 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 Index: test/Analysis/Inputs/expected-plists/objc-radar17039661.m.plist =================================================================== --- test/Analysis/Inputs/expected-plists/objc-radar17039661.m.plist +++ test/Analysis/Inputs/expected-plists/objc-radar17039661.m.plist @@ -803,6 +803,69 @@ file0 + end + + + line38 + col11 + file0 + + + line38 + col20 + file0 + + + + + + + kindevent + location + + line38 + col11 + file0 + + ranges + + + + line38 + col11 + file0 + + + line38 + col37 + file0 + + + + depth3 + extended_message + 'traitValue' is equal to 'newTraitValue' + message + 'traitValue' is equal to 'newTraitValue' + + + kindcontrol + edges + + + start + + + line38 + col11 + file0 + + + line38 + col20 + file0 + + end Index: test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist =================================================================== --- test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist +++ test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist @@ -5205,6 +5205,64 @@ + + kindevent + location + + line418 + col3 + file0 + + ranges + + + + line418 + col3 + file0 + + + line418 + col27 + file0 + + + + depth1 + extended_message + 'A' is >= 0 + message + 'A' is >= 0 + + + kindevent + location + + line418 + col3 + file0 + + ranges + + + + line418 + col3 + file0 + + + line418 + col27 + file0 + + + + depth1 + extended_message + 'B' is >= 0 + message + 'B' is >= 0 + kindevent location 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 @@ -1364,6 +1364,35 @@ + + kindevent + location + + line69 + col3 + file0 + + ranges + + + + line69 + col3 + file0 + + + line69 + col16 + file0 + + + + depth0 + extended_message + 'p' is null + message + 'p' is null + kindevent location @@ -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 @@ -1645,6 +1674,69 @@ file0 + 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 @@ -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 @@ -2496,6 +2496,35 @@ + + kindevent + location + + line96 + col8 + file0 + + ranges + + + + line96 + col8 + file0 + + + line96 + col13 + file0 + + + + depth0 + extended_message + 'i' is not equal to 1 + message + 'i' is not equal to 1 + kindcontrol edges @@ -2674,6 +2703,69 @@ file0 + end + + + line96 + col8 + file0 + + + line96 + col8 + file0 + + + + + + + kindevent + location + + line96 + col8 + file0 + + ranges + + + + line96 + col8 + file0 + + + line96 + col13 + file0 + + + + depth0 + extended_message + 'i' is equal to 1 + message + 'i' is equal to 1 + + + kindcontrol + edges + + + start + + + line96 + col8 + file0 + + + line96 + col8 + file0 + + end @@ -3447,6 +3539,35 @@ + + kindevent + location + + line127 + col9 + file0 + + ranges + + + + line127 + col9 + file0 + + + line127 + col14 + file0 + + + + depth0 + extended_message + 'i' is not equal to 1 + message + 'i' is not equal to 1 + kindcontrol edges @@ -3625,6 +3746,69 @@ file0 + end + + + line127 + col9 + file0 + + + line127 + col9 + file0 + + + + + + + kindevent + location + + line127 + col9 + file0 + + ranges + + + + line127 + col9 + file0 + + + line127 + col14 + file0 + + + + depth0 + extended_message + 'i' is equal to 1 + message + 'i' is equal to 1 + + + kindcontrol + edges + + + start + + + line127 + col9 + file0 + + + line127 + col9 + file0 + + end Index: test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist =================================================================== --- test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist +++ test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist @@ -9568,6 +9568,69 @@ file0 + end + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + + + + + + kindevent + location + + line716 + col6 + file0 + + ranges + + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + + + depth0 + extended_message + 'name' is non-nil + message + 'name' is non-nil + + + kindcontrol + edges + + + start + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + end @@ -10095,6 +10158,69 @@ file0 + end + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + + + + + + kindevent + location + + line716 + col6 + file0 + + ranges + + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + + + depth0 + extended_message + 'name' is non-nil + message + 'name' is non-nil + + + kindcontrol + edges + + + start + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + end Index: test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist =================================================================== --- test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist +++ test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist @@ -9568,6 +9568,69 @@ file0 + end + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + + + + + + kindevent + location + + line716 + col6 + file0 + + ranges + + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + + + depth0 + extended_message + 'name' is non-nil + message + 'name' is non-nil + + + kindcontrol + edges + + + start + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + end @@ -10095,6 +10158,69 @@ file0 + end + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + + + + + + kindevent + location + + line716 + col6 + file0 + + ranges + + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + + + depth0 + extended_message + 'name' is non-nil + message + 'name' is non-nil + + + kindcontrol + edges + + + start + + + line716 + col6 + file0 + + + line716 + col9 + file0 + + end 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 @@ -511,6 +511,69 @@ file0 + end + + + 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 @@ -2241,6 +2304,69 @@ file0 + 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 @@ -2598,6 +2724,69 @@ file0 + 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 Index: test/Analysis/NewDelete-path-notes.cpp =================================================================== --- test/Analysis/NewDelete-path-notes.cpp +++ test/Analysis/NewDelete-path-notes.cpp @@ -6,8 +6,8 @@ void test() { int *p = new int; // expected-note@-1 {{Memory is allocated}} - if (p) - // expected-note@-1 {{Taking true branch}} + if (p) // expected-note {{'p' is non-null}} + // expected-note@-1 {{Taking true branch}} delete p; // expected-note@-1 {{Memory is released}} Index: test/Analysis/diagnostics/dtors.cpp =================================================================== --- test/Analysis/diagnostics/dtors.cpp +++ test/Analysis/diagnostics/dtors.cpp @@ -16,11 +16,12 @@ S *s; smart_ptr(S *); S *get() { - return (x || 0) ? nullptr : s; // expected-note{{Left side of '||' is false}} - // expected-note@-1{{Assuming the condition is false}} - // expected-note@-2{{'?' condition is false}} - // expected-warning@-3{{Use of memory after it is freed}} - // expected-note@-4{{Use of memory after it is freed}} + return (x || 0) ? nullptr : s; // expected-note{{Assuming the condition is false}} + // expected-note@-1{{Left side of '||' is false}} + // expected-note@-2{{Assuming the condition is false}} + // expected-note@-3{{'?' condition is false}} + // expected-warning@-4{{Use of memory after it is freed}} + // expected-note@-5{{Use of memory after it is freed}} } }; 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{{'x' is 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{{'x' is 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{{'param' is 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{{'param' is 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{{'param' is 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{{'param' is 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{{'x' is 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{{'param' is 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{{'param' is 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{{'out' is 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{{'x' is 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 {{'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/osobject-retain-release.cpp =================================================================== --- test/Analysis/osobject-retain-release.cpp +++ test/Analysis/osobject-retain-release.cpp @@ -489,7 +489,8 @@ void check_dynamic_cast_null_branch(OSObject *obj) { OSArray *arr1 = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject}} OSArray *arr = OSDynamicCast(OSArray, obj); // expected-note{{Assuming dynamic cast returns null due to type mismatch}} - if (!arr) // expected-note{{Taking true branch}} + if (!arr) // expected-note{{'arr' is null}} + // expected-note@-1{{Taking true branch}} return; // expected-warning{{Potential leak of an object stored into 'arr1'}} // expected-note@-1{{Object leaked}} arr1->release(); @@ -591,16 +592,18 @@ { OSObjectPtr p(obj); // expected-note{{Calling constructor for 'smart_ptr'}} // expected-note@-1{{Returning from constructor for 'smart_ptr'}} + // expected-note@os_smart_ptr.h:13{{Assuming the condition is true}} // expected-note@os_smart_ptr.h:13{{Taking true branch}} // expected-note@os_smart_ptr.h:14{{Calling 'smart_ptr::_retain'}} // expected-note@os_smart_ptr.h:72{{Reference count incremented. The object now has a +2 retain count}} // expected-note@os_smart_ptr.h:14{{Returning from 'smart_ptr::_retain'}} } // expected-note{{Calling '~smart_ptr'}} + // expected-note@os_smart_ptr.h:35{{Assuming the condition is true}} // expected-note@os_smart_ptr.h:35{{Taking true branch}} // expected-note@os_smart_ptr.h:36{{Calling 'smart_ptr::_release'}} // expected-note@os_smart_ptr.h:77{{Reference count decremented. The object now has a +1 retain count}} // expected-note@os_smart_ptr.h:36{{Returning from 'smart_ptr::_release'}} - // expected-note@-5{{Returning from '~smart_ptr'}} + // expected-note@-6{{Returning from '~smart_ptr'}} obj->release(); // expected-note{{Object released}} obj->release(); // expected-warning{{Reference-counted object is used after it is released}} // expected-note@-1{{Reference-counted object is used after it is released}} @@ -611,16 +614,18 @@ { OSObjectPtr p(obj); // expected-note{{Calling constructor for 'smart_ptr'}} // expected-note@-1{{Returning from constructor for 'smart_ptr'}} + // expected-note@os_smart_ptr.h:13{{Assuming the condition is true}} // expected-note@os_smart_ptr.h:13{{Taking true branch}} // expected-note@os_smart_ptr.h:14{{Calling 'smart_ptr::_retain'}} // expected-note@os_smart_ptr.h:72{{Reference count incremented. The object now has a +2 retain count}} // expected-note@os_smart_ptr.h:14{{Returning from 'smart_ptr::_retain'}} } // expected-note{{Calling '~smart_ptr'}} + // expected-note@os_smart_ptr.h:35{{Assuming the condition is true}} // expected-note@os_smart_ptr.h:35{{Taking true branch}} // expected-note@os_smart_ptr.h:36{{Calling 'smart_ptr::_release'}} // expected-note@os_smart_ptr.h:77{{Reference count decremented. The object now has a +1 retain count}} // expected-note@os_smart_ptr.h:36{{Returning from 'smart_ptr::_release'}} - // expected-note@-5{{Returning from '~smart_ptr'}} + // expected-note@-6{{Returning from '~smart_ptr'}} } // expected-warning{{Potential leak of an object stored into 'obj'}} // expected-note@-1{{Object leaked: object allocated and stored into 'obj' is not referenced later in this execution path and has a retain count of +1}} Index: test/Analysis/uninit-vals.m =================================================================== --- test/Analysis/uninit-vals.m +++ test/Analysis/uninit-vals.m @@ -321,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 the condition is false}} // expected-note@-1{{Taking false branch}} - // expected-note@-2{{Taking false branch}} + // expected-note@-2{{Assuming the condition is false}} + // expected-note@-3{{Taking false branch}} + // expected-note@-4{{Assuming the condition is false}} + // expected-note@-5{{Taking false branch}} clang_analyzer_eval(testObj->size == 0); // expected-warning{{TRUE}} // expected-note@-1{{TRUE}} Index: test/Analysis/use-after-move.cpp =================================================================== --- test/Analysis/use-after-move.cpp +++ test/Analysis/use-after-move.cpp @@ -248,15 +248,19 @@ A a; if (i == 1) { #ifndef PEACEFUL - // expected-note@-2 {{Taking false branch}} + // expected-note@-2 {{'i' is not equal to 1}} // expected-note@-3 {{Taking false branch}} + // expected-note@-4 {{'i' is not equal to 1}} + // expected-note@-5 {{Taking false branch}} #endif std::move(a); } if (i == 2) { #ifndef PEACEFUL - // expected-note@-2 {{Taking false branch}} + // expected-note@-2 {{'i' is not equal to 2}} // expected-note@-3 {{Taking false branch}} + // expected-note@-4 {{'i' is not equal to 2}} + // expected-note@-5 {{Taking false branch}} #endif a = A(); a.foo(); @@ -301,9 +305,10 @@ if (i > 5) { a.foo(); #ifndef PEACEFUL - // expected-note@-3 {{Taking true branch}} - // expected-warning@-3 {{Method called on moved-from object 'a'}} - // expected-note@-4 {{Method called on moved-from object 'a'}} + // expected-note@-3 {{'i' is > 5}} + // expected-note@-4 {{Taking true branch}} + // expected-warning@-4 {{Method called on moved-from object 'a'}} + // expected-note@-5 {{Method called on moved-from object 'a'}} #endif } } @@ -659,7 +664,8 @@ A a, b; i > 0 ? (void)(b = std::move(a)) : a.bar(); // no-warning #ifndef PEACEFUL - // expected-note@-2 {{'?' condition is true}} + // expected-note@-2 {{'i' is > 0}} + // expected-note@-3 {{'?' condition is true}} #endif } // A variation on the theme above. @@ -842,11 +848,13 @@ #ifndef PEACEFUL // expected-note@-2 {{Assuming the condition is false}} // expected-note@-3 {{Left side of '&&' is false}} - // expected-note@-4 {{Taking false branch}} + // expected-note@-4 {{Assuming the condition is false}} + // expected-note@-5 {{Taking false branch}} // And the other report: - // expected-note@-6 {{Assuming the condition is false}} - // expected-note@-7 {{Left side of '&&' is false}} - // expected-note@-8 {{Taking false branch}} + // expected-note@-7 {{Assuming the condition is false}} + // expected-note@-8 {{Left side of '&&' is false}} + // expected-note@-9 {{Assuming the condition is false}} + // expected-note@-10{{Taking false branch}} A().bar(); #endif } @@ -859,11 +867,13 @@ #ifndef PEACEFUL // expected-note@-2 {{Assuming the condition is false}} // expected-note@-3 {{Left side of '&&' is false}} - // expected-note@-4 {{Taking true branch}} + // expected-note@-4 {{Assuming the condition is true}} + // expected-note@-5 {{Taking true branch}} // And the other report: - // expected-note@-6 {{Assuming the condition is false}} - // expected-note@-7 {{Left side of '&&' is false}} - // expected-note@-8 {{Taking true branch}} + // expected-note@-7 {{Assuming the condition is false}} + // expected-note@-8 {{Left side of '&&' is false}} + // expected-note@-9 {{Assuming the condition is true}} + // expected-note@-10{{Taking true branch}} #endif A().bar(); } @@ -880,7 +890,8 @@ // And the other report: // expected-note@-8 {{Assuming the condition is false}} // expected-note@-9 {{Left side of '&&' is false}} - // expected-note@-10{{Taking false branch}} + // expected-note@-10{{Assuming the condition is false}} + // expected-note@-11{{Taking false branch}} #endif A().bar(); } @@ -891,7 +902,8 @@ #ifndef PEACEFUL // expected-note@-2 {{Assuming the condition is true}} // expected-note@-3 {{Left side of '||' is true}} - // expected-note@-4 {{Taking true branch}} + // expected-note@-4 {{Assuming the condition is true}} + // expected-note@-5 {{Taking true branch}} #endif A().bar(); } 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 {{{{^}}'i' is > 0}} + // expected-note-re@-3 {{{{^}}Taking true branch}} + // expected-note-re@-4 {{{{^}}'i' is <= 0}} + // expected-note-re@-5 {{{{^}}Taking false branch}} #endif X x(i - 1); #if !PUREONLY