Index: include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h =================================================================== --- include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h +++ include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h @@ -165,6 +165,8 @@ static const char *const GenericTrueMessage; static const char *const GenericFalseMessage; + ProgramState::ConstraintMap Constraints; + public: void Profile(llvm::FoldingSetNodeID &ID) const override { static int x = 0; @@ -206,6 +208,9 @@ const bool tookTrue, BugReporterContext &BRC, BugReport &R, const ExplodedNode *N); + void finalizeVisitor(BugReporterContext &BRC, const ExplodedNode *N, + BugReport &BR) override; + bool patternMatch(const Expr *Ex, const Expr *ParentEx, raw_ostream &Out, Index: include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h =================================================================== --- include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h @@ -165,8 +165,6 @@ const char* nl, const char *sep) = 0; - virtual void EndPath(ProgramStateRef state) {} - /// Convenience method to query the state to see if a symbol is null or /// not null, or if neither assumption can be made. ConditionTruthVal isNull(ProgramStateRef State, SymbolRef Sym) { Index: include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h =================================================================== --- include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h +++ include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h @@ -22,6 +22,7 @@ #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h" #include "clang/StaticAnalyzer/Core/PathSensitive/Store.h" #include "clang/StaticAnalyzer/Core/PathSensitive/TaintTag.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/ImmutableMap.h" #include "llvm/Support/Allocator.h" @@ -76,6 +77,7 @@ public: typedef llvm::ImmutableSet IntSetTy; typedef llvm::ImmutableMap GenericDataMap; + typedef llvm::DenseMap ConstraintMap; private: void operator=(const ProgramState& R) = delete; @@ -231,6 +233,21 @@ /// Utility method for getting regions. const VarRegion* getRegion(const VarDecl *D, const LocationContext *LC) const; + /// Check if the constraint so the state has changed based on the reported + /// message on that constraint being changed. + bool isChangedOrInsertConstraint(ConstraintMap &Constraints, const Stmt *Cond, + StringRef Message) const { + ConstraintMap::iterator I = Constraints.find(Cond); + + // Insert new constraint or if the message has changed update the message. + if (I == Constraints.end() || !Message.equals(I->second)) { + Constraints[Cond] = Message; + return true; + } + + return false; + } + //==---------------------------------------------------------------------==// // Binding and retrieving values to/from the environment and symbolic store. //==---------------------------------------------------------------------==// @@ -674,10 +691,6 @@ return ProgramStateTrait::MakeContext(p); } - - void EndPath(ProgramStateRef St) { - ConstraintMgr->EndPath(St); - } }; Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -1820,22 +1820,26 @@ ConditionBRVisitor::VisitNodeImpl(const ExplodedNode *N, BugReporterContext &BRC, BugReport &BR) { ProgramPoint progPoint = N->getLocation(); - ProgramStateRef CurrentState = N->getState(); - ProgramStateRef PrevState = N->getFirstPred()->getState(); - - // Compare the GDMs of the state, because that is where constraints - // are managed. Note that ensure that we only look at nodes that - // were generated by the analyzer engine proper, not checkers. - if (CurrentState->getGDM().getRoot() == - PrevState->getGDM().getRoot()) - return nullptr; + ProgramStateRef State = N->getState(); // If an assumption was made on a branch, it should be caught // here by looking at the state transition. if (Optional BE = progPoint.getAs()) { const CFGBlock *srcBlk = BE->getSrc(); - if (const Stmt *term = srcBlk->getTerminator()) - return VisitTerminator(term, N, srcBlk, BE->getDst(), BR, BRC); + if (const Stmt *term = srcBlk->getTerminator()) { + + auto Piece = VisitTerminator(term, N, srcBlk, BE->getDst(), BR, BRC); + if (!Piece) + return nullptr; + + const Stmt *Cond = srcBlk->getTerminatorCondition(); + StringRef ReportMessage = Piece->getString(); + if (State->isChangedOrInsertConstraint(Constraints, Cond, ReportMessage)) + return Piece; + + return nullptr; + } + return nullptr; } @@ -1844,12 +1848,17 @@ ExprEngine::geteagerlyAssumeBinOpBifurcationTags(); const ProgramPointTag *tag = PS->getTag(); - if (tag == tags.first) - return VisitTrueTest(cast(PS->getStmt()), true, - BRC, BR, N); - if (tag == tags.second) - return VisitTrueTest(cast(PS->getStmt()), false, - BRC, BR, N); + if (tag != tags.first && tag != tags.second) + return nullptr; + + const auto *Cond = cast(PS->getStmt()); + auto Piece = VisitTrueTest(Cond, tag == tags.first, BRC, BR, N); + if (!Piece) + return nullptr; + + StringRef ReportMessage = Piece->getString(); + if (State->isChangedOrInsertConstraint(Constraints, Cond, ReportMessage)) + return Piece; return nullptr; } @@ -2218,6 +2227,11 @@ return std::move(event); } +void ConditionBRVisitor::finalizeVisitor(BugReporterContext &BRC, + const ExplodedNode *N, BugReport &BR) { + Constraints.clear(); +} + const char *const ConditionBRVisitor::GenericTrueMessage = "Assuming the condition is true"; const char *const ConditionBRVisitor::GenericFalseMessage = Index: lib/StaticAnalyzer/Core/ExprEngine.cpp =================================================================== --- lib/StaticAnalyzer/Core/ExprEngine.cpp +++ lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -2258,7 +2258,6 @@ Pred->getStackFrame()->getParent())); PrettyStackTraceLocationContext CrashInfo(Pred->getLocationContext()); - StateMgr.EndPath(Pred->getState()); ExplodedNodeSet Dst; if (Pred->getLocationContext()->inTopFrame()) { Index: lib/StaticAnalyzer/Core/ProgramState.cpp =================================================================== --- lib/StaticAnalyzer/Core/ProgramState.cpp +++ lib/StaticAnalyzer/Core/ProgramState.cpp @@ -25,8 +25,8 @@ using namespace ento; namespace clang { namespace ento { -/// Increments the number of times this state is referenced. +/// Increments the number of times this state is referenced. void ProgramStateRetain(const ProgramState *state) { ++const_cast(state)->refCount; } @@ -42,6 +42,7 @@ Mgr.freeStates.push_back(s); } } + }} ProgramState::ProgramState(ProgramStateManager *mgr, const Environment& env, 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 + Assuming 'p' is non-null + message + Assuming '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/conditional-path-notes.c.plist =================================================================== --- test/Analysis/Inputs/expected-plists/conditional-path-notes.c.plist +++ test/Analysis/Inputs/expected-plists/conditional-path-notes.c.plist @@ -1769,4 +1769,4 @@ /clang/test/Analysis/conditional-path-notes.c - + \ No newline at end of file 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 @@ -421,6 +484,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 @@ -666,6 +792,69 @@ end + + + line32 + col7 + file0 + + + line32 + col10 + file0 + + + + + + + kindevent + location + + line32 + col7 + file0 + + ranges + + + + line32 + col7 + file0 + + + line32 + col10 + file0 + + + + depth1 + extended_message + Assuming 'fail' is not equal to 0 + message + Assuming 'fail' is not equal to 0 + + + kindcontrol + edges + + + start + + + line32 + col7 + file0 + + + line32 + col10 + file0 + + + end line33 Index: test/Analysis/Inputs/expected-plists/edges-new.mm.plist =================================================================== --- test/Analysis/Inputs/expected-plists/edges-new.mm.plist +++ test/Analysis/Inputs/expected-plists/edges-new.mm.plist @@ -2711,6 +2711,35 @@ + kindevent + location + + line146 + col8 + file0 + + ranges + + + + line146 + col8 + file0 + + + line146 + col13 + file0 + + + + depth0 + extended_message + Assuming 'i' is not equal to 1 + message + Assuming 'i' is not equal to 1 + + kindcontrol edges @@ -2891,6 +2920,69 @@ end + line146 + col8 + file0 + + + line146 + col8 + file0 + + + + + + + kindevent + location + + line146 + col8 + file0 + + ranges + + + + line146 + col8 + file0 + + + line146 + col13 + file0 + + + + depth0 + extended_message + Assuming 'i' is equal to 1 + message + Assuming 'i' is equal to 1 + + + kindcontrol + edges + + + start + + + line146 + col8 + file0 + + + line146 + col8 + file0 + + + end + + line147 col5 file0 @@ -3809,6 +3901,69 @@ end + line178 + col9 + file0 + + + line178 + col9 + file0 + + + + + + + kindevent + location + + line178 + col9 + file0 + + ranges + + + + line178 + col9 + file0 + + + line178 + col14 + file0 + + + + depth0 + extended_message + Assuming 'i' is equal to 0 + message + Assuming 'i' is equal to 0 + + + kindcontrol + edges + + + start + + + line178 + col9 + file0 + + + line178 + col9 + file0 + + + end + + line179 col7 file0 @@ -4003,6 +4158,69 @@ end + line178 + col9 + file0 + + + line178 + col9 + file0 + + + + + + + kindevent + location + + line178 + col9 + file0 + + ranges + + + + line178 + col9 + file0 + + + line178 + col14 + file0 + + + + depth0 + extended_message + Assuming 'i' is not equal to 0 + message + Assuming 'i' is not equal to 0 + + + kindcontrol + edges + + + start + + + line178 + col9 + file0 + + + line178 + col9 + file0 + + + end + + line181 col5 file0 @@ -4037,6 +4255,69 @@ end + line181 + col9 + file0 + + + line181 + col9 + file0 + + + + + + + kindevent + location + + line181 + col9 + file0 + + ranges + + + + line181 + col9 + file0 + + + line181 + col14 + file0 + + + + depth0 + extended_message + Assuming 'i' is equal to 1 + message + Assuming 'i' is equal to 1 + + + kindcontrol + edges + + + start + + + line181 + col9 + file0 + + + line181 + col9 + file0 + + + end + + line183 col7 file0 @@ -6417,6 +6698,35 @@ + kindevent + location + + line240 + col7 + file0 + + ranges + + + + line240 + col7 + file0 + + + line240 + col7 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + kindcontrol edges @@ -6451,6 +6761,35 @@ + kindevent + location + + line240 + col12 + file0 + + ranges + + + + line240 + col12 + file0 + + + line240 + col12 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + kindcontrol edges @@ -6675,6 +7014,35 @@ + kindevent + location + + line247 + col7 + file0 + + ranges + + + + line247 + col7 + file0 + + + line247 + col7 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -6709,6 +7077,35 @@ + kindevent + location + + line247 + col12 + file0 + + ranges + + + + line247 + col12 + file0 + + + line247 + col12 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + kindcontrol edges @@ -6933,6 +7330,35 @@ + kindevent + location + + line255 + col12 + file0 + + ranges + + + + line255 + col12 + file0 + + + line255 + col12 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -7254,6 +7680,35 @@ + kindevent + location + + line263 + col8 + file0 + + ranges + + + + line263 + col8 + file0 + + + line263 + col8 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -7309,6 +7764,69 @@ line263 + col7 + file0 + + + line263 + col7 + file0 + + + + + + + kindevent + location + + line263 + col7 + file0 + + ranges + + + + line263 + col7 + file0 + + + line263 + col14 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + + kindcontrol + edges + + + start + + + line263 + col7 + file0 + + + line263 + col7 + file0 + + + end + + + line263 col19 file0 @@ -7575,6 +8093,35 @@ + kindevent + location + + line263 + col8 + file0 + + ranges + + + + line263 + col8 + file0 + + + line263 + col8 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -7630,7 +8177,70 @@ line263 - col19 + col7 + file0 + + + line263 + col7 + file0 + + + + + + + kindevent + location + + line263 + col7 + file0 + + ranges + + + + line263 + col7 + file0 + + + line263 + col14 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + + kindcontrol + edges + + + start + + + line263 + col7 + file0 + + + line263 + col7 + file0 + + + end + + + line263 + col19 file0 @@ -7740,6 +8350,35 @@ + kindevent + location + + line267 + col7 + file0 + + ranges + + + + line267 + col7 + file0 + + + line267 + col7 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -7774,6 +8413,35 @@ + kindevent + location + + line267 + col13 + file0 + + ranges + + + + line267 + col13 + file0 + + + line267 + col13 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -7808,6 +8476,35 @@ + kindevent + location + + line267 + col18 + file0 + + ranges + + + + line267 + col18 + file0 + + + line267 + col22 + file0 + + + + depth0 + extended_message + Assuming 'coin' is 0 + message + Assuming 'coin' is 0 + + kindcontrol edges @@ -8033,6 +8730,35 @@ + kindevent + location + + line276 + col8 + file0 + + ranges + + + + line276 + col8 + file0 + + + line276 + col8 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -8067,6 +8793,132 @@ + kindevent + location + + line276 + col14 + file0 + + ranges + + + + line276 + col14 + file0 + + + line276 + col14 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + + kindcontrol + edges + + + start + + + line276 + col14 + file0 + + + line276 + col14 + file0 + + + end + + + line276 + col19 + file0 + + + line276 + col19 + file0 + + + + + + + kindcontrol + edges + + + start + + + line276 + col19 + file0 + + + line276 + col19 + file0 + + + end + + + line276 + col7 + file0 + + + line276 + col7 + file0 + + + + + + + kindevent + location + + line276 + col7 + file0 + + ranges + + + + line276 + col7 + file0 + + + line276 + col21 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -8075,12 +8927,12 @@ line276 - col14 + col7 file0 line276 - col14 + col7 file0 @@ -8088,12 +8940,12 @@ line276 - col19 + col30 file0 line276 - col19 + col30 file0 @@ -8101,6 +8953,35 @@ + kindevent + location + + line276 + col31 + file0 + + ranges + + + + line276 + col31 + file0 + + + line276 + col31 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + kindcontrol edges @@ -8109,12 +8990,12 @@ line276 - col19 + col31 file0 line276 - col19 + col31 file0 @@ -8122,12 +9003,12 @@ line276 - col30 + col36 file0 line276 - col30 + col36 file0 @@ -8143,12 +9024,12 @@ line276 - col31 + col36 file0 line276 - col31 + col36 file0 @@ -8156,12 +9037,12 @@ line276 - col36 + col30 file0 line276 - col36 + col30 file0 @@ -8169,6 +9050,35 @@ + kindevent + location + + line276 + col30 + file0 + + ranges + + + + line276 + col30 + file0 + + + line276 + col37 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + kindcontrol edges @@ -8177,12 +9087,12 @@ line276 - col36 + col30 file0 line276 - col36 + col30 file0 @@ -8203,6 +9113,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 @@ -8660,6 +9599,35 @@ + kindevent + location + + line285 + col12 + file0 + + ranges + + + + line285 + col12 + file0 + + + line285 + col12 + file0 + + + + depth0 + extended_message + Assuming 'z' is 0 + message + Assuming 'z' is 0 + + kindcontrol edges @@ -9001,6 +9969,69 @@ end + line294 + col7 + file0 + + + line294 + col7 + file0 + + + + + + + kindevent + location + + line294 + col7 + file0 + + ranges + + + + line294 + col7 + file0 + + + line294 + col7 + file0 + + + + depth0 + extended_message + Assuming 'y' is null + message + Assuming 'y' is null + + + kindcontrol + edges + + + start + + + line294 + col7 + file0 + + + line294 + col7 + file0 + + + end + + line297 col3 file0 @@ -11556,12 +12587,46 @@ line457 - col5 + col5 + file0 + + + line457 + col6 + file0 + + + + + + + kindcontrol + edges + + + start + + + line457 + col5 + file0 + + + line457 + col6 + file0 + + + end + + + line457 + col9 file0 line457 - col6 + col9 file0 @@ -11569,6 +12634,35 @@ + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Assuming 'first' is not equal to 0 + message + Assuming 'first' is not equal to 0 + + kindcontrol edges @@ -11577,12 +12671,12 @@ line457 - col5 + col9 file0 line457 - col6 + col9 file0 @@ -11788,6 +12882,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Assuming 'first' is 0 + message + Assuming 'first' is 0 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line458 col7 file0 @@ -12053,6 +13210,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Assuming 'first' is not equal to 0 + message + Assuming 'first' is not equal to 0 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 @@ -12548,6 +13768,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Assuming 'first' is not equal to 0 + message + Assuming 'first' is not equal to 0 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 @@ -13098,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 + Assuming 'first' is not equal to 0 + message + Assuming 'first' is not equal to 0 + + + kindcontrol + edges + + + start + + + line457 + col9 file0 line457 - col6 + col9 file0 @@ -14591,6 +15937,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Assuming 'first' is not equal to 0 + message + Assuming 'first' is not equal to 0 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 @@ -16199,6 +17608,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Assuming 'first' is not equal to 0 + message + Assuming 'first' is not equal to 0 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 @@ -18032,6 +19504,69 @@ end + line457 + col9 + file0 + + + line457 + col9 + file0 + + + + + + + kindevent + location + + line457 + col9 + file0 + + ranges + + + + line457 + col9 + file0 + + + line457 + col14 + file0 + + + + depth0 + extended_message + Assuming 'first' is not equal to 0 + message + Assuming 'first' is not equal to 0 + + + kindcontrol + edges + + + start + + + line457 + col9 + file0 + + + line457 + col9 + file0 + + + end + + line459 col5 file0 @@ -19997,9 +21532,9 @@ depth0 extended_message - Assuming 'tmp' is null + Reallocation failed message - Assuming 'tmp' is null + Reallocation failed kindevent @@ -20026,9 +21561,9 @@ depth0 extended_message - Reallocation failed + Assuming 'tmp' is null message - Reallocation failed + Assuming 'tmp' is null kindcontrol @@ -21341,6 +22876,69 @@ end + line587 + col11 + file0 + + + line587 + col11 + file0 + + + + + + + kindevent + location + + line587 + col11 + file0 + + ranges + + + + line587 + col11 + file0 + + + line587 + col16 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + + kindcontrol + edges + + + start + + + line587 + col11 + file0 + + + line587 + col11 + file0 + + + end + + line588 col9 file0 Index: test/Analysis/Inputs/expected-plists/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 + Assuming 'p' is equal to null + message + Assuming '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/method-call-path-notes.cpp.plist =================================================================== --- test/Analysis/Inputs/expected-plists/method-call-path-notes.cpp.plist +++ test/Analysis/Inputs/expected-plists/method-call-path-notes.cpp.plist @@ -842,4 +842,4 @@ /clang/test/Analysis/method-call-path-notes.cpp - + \ No newline at end of file Index: test/Analysis/Inputs/expected-plists/model-file.cpp.plist =================================================================== --- test/Analysis/Inputs/expected-plists/model-file.cpp.plist +++ test/Analysis/Inputs/expected-plists/model-file.cpp.plist @@ -127,6 +127,69 @@ end + line25 + col7 + file0 + + + line25 + col13 + file0 + + + + + + + kindevent + location + + line25 + col7 + file0 + + ranges + + + + line25 + col7 + file0 + + + line25 + col16 + file0 + + + + depth0 + extended_message + Assuming the condition is false + message + Assuming the condition is false + + + kindcontrol + edges + + + start + + + line25 + col7 + file0 + + + line25 + col13 + file0 + + + end + + line31 col3 file0 Index: test/Analysis/Inputs/expected-plists/plist-macros.cpp.plist =================================================================== --- test/Analysis/Inputs/expected-plists/plist-macros.cpp.plist +++ test/Analysis/Inputs/expected-plists/plist-macros.cpp.plist @@ -1389,6 +1389,35 @@ depth0 extended_message + Assuming 'p' is null + message + Assuming '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 @@ -1758,4 +1850,4 @@ /clang/test/Analysis/plist-macros.cpp - + \ No newline at end of file Index: test/Analysis/Inputs/expected-plists/plist-output-alternate.m.plist =================================================================== --- test/Analysis/Inputs/expected-plists/plist-output-alternate.m.plist +++ test/Analysis/Inputs/expected-plists/plist-output-alternate.m.plist @@ -1517,4 +1517,4 @@ /clang/test/Analysis/plist-output-alternate.m - + \ No newline at end of file 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/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 @@ -515,6 +515,69 @@ line105 + col12 + file0 + + + line105 + col27 + file0 + + + + + + + kindevent + location + + line105 + col12 + file0 + + ranges + + + + line105 + col12 + file0 + + + line105 + col49 + file0 + + + + depth0 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + + kindcontrol + edges + + + start + + + line105 + col12 + file0 + + + line105 + col27 + file0 + + + end + + + line105 col52 file0 @@ -2244,6 +2307,69 @@ end + line60 + col6 + file0 + + + line60 + col21 + file0 + + + + + + + kindevent + location + + line60 + col6 + file0 + + ranges + + + + line60 + col6 + file0 + + + line60 + col49 + file0 + + + + depth1 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + + kindcontrol + edges + + + start + + + line60 + col6 + file0 + + + line60 + col21 + file0 + + + end + + line61 col3 file0 @@ -2601,6 +2727,69 @@ end + line60 + col6 + file0 + + + line60 + col21 + file0 + + + + + + + kindevent + location + + line60 + col6 + file0 + + ranges + + + + line60 + col6 + file0 + + + line60 + col49 + file0 + + + + depth1 + extended_message + Assuming the condition is true + message + Assuming the condition is true + + + kindcontrol + edges + + + start + + + line60 + col6 + file0 + + + line60 + col21 + file0 + + + end + + line61 col3 file0 Index: test/Analysis/MisusedMovedObject.cpp =================================================================== --- test/Analysis/MisusedMovedObject.cpp +++ test/Analysis/MisusedMovedObject.cpp @@ -184,10 +184,12 @@ } { A a; - if (i == 1) { // expected-note {{Taking false branch}} expected-note {{Taking false branch}} + if (i == 1) { // expected-note {{Assuming 'i' is not equal to 1}} expected-note {{Taking false branch}} + // expected-note@-1 {{Assuming '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 {{Assuming 'i' is not equal to 2}} expected-note {{Taking false branch}} + // expected-note@-1 {{Assuming '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 {{Assuming 'i' is > 5}} 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'}} } } @@ -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 {{Assuming 'i' is > 0}} expected-note {{'?' condition is true}} } // A variation on the theme above. { @@ -577,7 +579,8 @@ A a; if (a.foo() > 0 && A(std::move(a)).foo() > 0) { // expected-note {{Assuming the condition is false}} expected-note {{Assuming the condition is false}} // expected-note@-1 {{Left side of '&&' is false}} expected-note@-1 {{Left side of '&&' is false}} - //expected-note@-2 {{Taking false branch}} expected-note@-2 {{Taking false branch}} + // expected-note@-2 {{Assuming the condition is false}} expected-note@-2 {{Assuming the condition is false}} + // expected-note@-3 {{Taking false branch}} expected-note@-3 {{Taking false branch}} A().bar(); } } @@ -587,7 +590,8 @@ A a; if (!(a.foo() > 0 && A(std::move(a)).foo() > 0)) { // expected-note {{Assuming the condition is false}} expected-note {{Assuming the condition is false}} // expected-note@-1 {{Left side of '&&' is false}} expected-note@-1 {{Left side of '&&' is false}} - // expected-note@-2 {{Taking true branch}} expected-note@-2 {{Taking true branch}} + // expected-note@-2 {{Assuming the condition is true}} expected-note@-2 {{Assuming the condition is true}} + // expected-note@-3 {{Taking true branch}} expected-note@-3 {{Taking true branch}} A().bar(); } } @@ -596,15 +600,17 @@ if (A(std::move(a)).foo() > 0 && a.foo() > 0) { // expected-warning {{Method call on a 'moved-from' object 'a'}} expected-note {{Method call on a 'moved-from' object 'a'}} // expected-note@-1 {{'a' became 'moved-from' here}} expected-note@-1 {{Assuming the condition is true}} expected-note@-1 {{Assuming the condition is false}} // expected-note@-2 {{Left side of '&&' is false}} expected-note@-2 {{Left side of '&&' is true}} - // expected-note@-3 {{Taking false branch}} + // expected-note@-3 {{Assuming the condition is false}} + // expected-note@-4 {{Taking false branch}} A().bar(); } } { A a; if (a.foo() > 0 || A(std::move(a)).foo() > 0) { // expected-note {{Assuming the condition is true}} - //expected-note@-1 {{Left side of '||' is true}} - //expected-note@-2 {{Taking true branch}} + // expected-note@-1 {{Left side of '||' is true}} + // expected-note@-2 {{Assuming the condition is true}} + // expected-note@-3 {{Taking true branch}} A().bar(); } } 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 {{Assuming 'p' is non-null}} + // expected-note@-2 {{Taking true branch}} delete p; // expected-note@-1 {{Memory is released}} Index: test/Analysis/diagnostics/Inputs/expected-plists/undef-value-param.c.plist =================================================================== --- test/Analysis/diagnostics/Inputs/expected-plists/undef-value-param.c.plist +++ test/Analysis/diagnostics/Inputs/expected-plists/undef-value-param.c.plist @@ -1341,4 +1341,4 @@ /clang/test/Analysis/diagnostics/undef-value-param.c - + \ No newline at end of file Index: test/Analysis/diagnostics/macros.cpp =================================================================== --- test/Analysis/diagnostics/macros.cpp +++ test/Analysis/diagnostics/macros.cpp @@ -30,7 +30,8 @@ // There are no path notes on the comparison to float types. void testDoubleMacro(double d) { - if (d == DBL_MAX) { // expected-note {{Taking true branch}} + if (d == DBL_MAX) { // expected-note {{Assuming 'd' is equal to DBL_MAX}} + // expected-note@-1 {{Taking true branch}} char *p = NULL; // expected-note {{'p' initialized to a null pointer value}} *p = 7; // expected-warning {{Dereference of null pointer (loaded from variable 'p')}} Index: test/Analysis/diagnostics/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{{Assuming '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{{Assuming '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{{Assuming '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{{Assuming '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{{Assuming 'param' is not equal to 0}} + // 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{{Assuming '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{{Assuming '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{{Assuming '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{{Assuming '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{{Assuming 'out' is not equal to 0}} + // 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{{Assuming '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 {{Assuming '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 @@ -5224,4 +5224,4 @@ /clang/test/Analysis/inlining/path-notes.cpp - + \ No newline at end of file Index: test/Analysis/objc-radar17039661.m =================================================================== --- test/Analysis/objc-radar17039661.m +++ test/Analysis/objc-radar17039661.m @@ -418,69 +418,6 @@ // CHECK: end // CHECK: // CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth3 -// CHECK: extended_message -// CHECK: Assuming 'cond' is not equal to 0 -// CHECK: message -// CHECK: Assuming 'cond' is not equal to 0 -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: // CHECK: line33 // CHECK: col7 // CHECK: file0 @@ -861,6 +798,69 @@ // CHECK: end // CHECK: // CHECK: +// CHECK: line37 +// CHECK: col11 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: line37 +// CHECK: col20 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: kindevent +// CHECK: location +// CHECK: +// CHECK: line37 +// CHECK: col11 +// CHECK: file0 +// CHECK: +// CHECK: ranges +// CHECK: +// CHECK: +// CHECK: +// CHECK: line37 +// CHECK: col11 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: line37 +// CHECK: col37 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: +// CHECK: depth3 +// CHECK: extended_message +// CHECK: Assuming 'traitValue' is equal to 'newTraitValue' +// CHECK: message +// CHECK: Assuming 'traitValue' is equal to 'newTraitValue' +// CHECK: +// CHECK: +// CHECK: kindcontrol +// CHECK: edges +// CHECK: +// CHECK: +// CHECK: start +// CHECK: +// CHECK: +// CHECK: line37 +// CHECK: col11 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: line37 +// CHECK: col20 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: end +// CHECK: +// CHECK: // CHECK: line40 // CHECK: col7 // CHECK: file0 @@ -1323,11 +1323,36 @@ // CHECK: descriptionPotential leak of an object // CHECK: categoryMemory (Core Foundation/Objective-C) // CHECK: typeLeak +// CHECK: check_nameosx.cocoa.RetainCount +// CHECK: +// CHECK: issue_hash_content_of_line_in_context500e2bbda41c8086771ad98b6bcfdc50 // CHECK: location // CHECK: // CHECK: line52 // CHECK: col5 // CHECK: file0 // CHECK: +// CHECK: ExecutedLines +// CHECK: +// CHECK: 0 +// CHECK: +// CHECK: 22 +// CHECK: 23 +// CHECK: 24 +// CHECK: 27 +// CHECK: 28 +// CHECK: 29 +// CHECK: 31 +// CHECK: 33 +// CHECK: 35 +// CHECK: 37 +// CHECK: 40 +// CHECK: 47 +// CHECK: 48 +// CHECK: 49 +// CHECK: 50 +// CHECK: 52 +// CHECK: +// CHECK: // CHECK: -// CHECK: +// CHECK: \ No newline at end of file Index: test/Analysis/uninit-vals.m =================================================================== --- test/Analysis/uninit-vals.m +++ test/Analysis/uninit-vals.m @@ -164,7 +164,8 @@ // expected-note@-1{{TRUE}} testObj->origin = makePoint(0.0, 0.0); - if (testObj->size > 0) { ; } // expected-note{{Taking false branch}} + if (testObj->size > 0) { ; } // expected-note{{Assuming the condition is false}} + // expected-note@-1{{Taking false branch}} // FIXME: Assigning to 'testObj->origin' kills the default binding for the // whole region, meaning that we've forgotten that testObj->size should also @@ -218,10 +219,14 @@ // expected-note@-1{{TRUE}} testObj->origin = makeIntPoint(1, 2); - if (testObj->size > 0) { ; } // expected-note{{Taking false branch}} - // expected-note@-1{{Taking false branch}} - // expected-note@-2{{Taking false branch}} - // expected-note@-3{{Taking false branch}} + if (testObj->size > 0) { ; } // expected-note{{Assuming the condition is false}} + // expected-note@-1{{Assuming the condition is false}} + // expected-note@-2{{Assuming the condition is false}} + // expected-note@-3{{Assuming the condition is false}} + // expected-note@-4{{Taking false branch}} + // expected-note@-5{{Taking false branch}} + // expected-note@-6{{Taking false branch}} + // expected-note@-7{{Taking false branch}} // FIXME: Assigning to 'testObj->origin' kills the default binding for the // whole region, meaning that we've forgotten that testObj->size should also @@ -316,9 +321,12 @@ // expected-note@-1{{TRUE}} testObj->origin = makeIntPoint2D(1, 2); - if (testObj->size > 0) { ; } // expected-note{{Taking false branch}} - // expected-note@-1{{Taking false branch}} - // expected-note@-2{{Taking false branch}} + if (testObj->size > 0) { ; } // expected-note{{Assuming the condition is false}} + // expected-note@-1{{Assuming the condition is false}} + // expected-note@-2{{Assuming the condition is false}} + // expected-note@-3{{Taking false branch}} + // expected-note@-4{{Taking false branch}} + // expected-note@-5{{Taking false branch}} clang_analyzer_eval(testObj->size == 0); // expected-warning{{TRUE}} // expected-note@-1{{TRUE}} Index: test/Analysis/virtualcall.cpp =================================================================== --- test/Analysis/virtualcall.cpp +++ test/Analysis/virtualcall.cpp @@ -164,8 +164,10 @@ X(int i) { if (i > 0) { #if !PUREONLY - // expected-note-re@-2 {{{{^}}Taking true branch}} - // expected-note-re@-3 {{{{^}}Taking false branch}} + // expected-note-re@-2 {{{{^}}Assuming 'i' is > 0}} + // expected-note-re@-3 {{{{^}}Taking true branch}} + // expected-note-re@-4 {{{{^}}Assuming 'i' is <= 0}} + // expected-note-re@-5 {{{{^}}Taking false branch}} #endif X x(i - 1); #if !PUREONLY