Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -876,7 +876,6 @@ if (Optional RetLoc = RetVal.getAs()) EnableNullFPSuppression = State->isNull(*RetLoc).isConstrainedTrue(); - BR.markInteresting(CalleeContext); BR.addVisitor(llvm::make_unique(CalleeContext, EnableNullFPSuppression, Options)); @@ -927,16 +926,13 @@ RetE = RetE->IgnoreParenCasts(); - // If we're returning 0, we should track where that 0 came from. - bugreporter::trackExpressionValue(N, RetE, BR, EnableNullFPSuppression); - // Build an appropriate message based on the return value. SmallString<64> Msg; llvm::raw_svector_ostream Out(Msg); + // Known to be null. if (State->isNull(V).isConstrainedTrue()) { if (V.getAs()) { - // If we have counter-suppression enabled, make sure we keep visiting // future nodes. We want to emit a path note as well, in case // the report is resurrected as valid later on. @@ -952,8 +948,8 @@ } else { Out << "Returning zero"; } - - } else { + // Known to be non-null. + } else if (State->isNonNull(V).isConstrainedTrue()) { if (auto CI = V.getAs()) { Out << "Returning the value " << CI->getValue(); } else if (V.getAs()) { @@ -961,8 +957,15 @@ } else { Out << "Returning value"; } + // Unknown value. If a pointer and its LValue is available treat as known. + } else if (V.getAs() && LValue) { + Out << "Returning pointer"; } + // If we do not return a known value do not report that. + if (Msg.empty()) + return nullptr; + if (LValue) { if (const MemRegion *MR = LValue->getAsRegion()) { if (MR->canPrintPretty()) { @@ -978,6 +981,9 @@ Out << " (loaded from '" << *DD << "')"; } + // If we return a value track where it came from. + bugreporter::trackExpressionValue(N, RetE, BR, EnableNullFPSuppression); + PathDiagnosticLocation L(Ret, BRC.getSourceManager(), StackFrame); if (!L.isValid() || !L.asLocation().isValid()) return nullptr; @@ -1095,8 +1101,9 @@ return FrameSpace->getStackFrame() == LCtx->getStackFrame(); } -/// Show diagnostics for initializing or declaring a region \p R with a bad value. -static void showBRDiagnostics(const char *action, llvm::raw_svector_ostream &os, +/// Show diagnostics for initializing/declaring a region \p R with a bad value. +/// \returns Whether we create a report. +static bool showBRDiagnostics(const char *action, llvm::raw_svector_ostream &os, const MemRegion *R, SVal V, const DeclStmt *DS) { if (R->canPrintPretty()) { R->printPretty(os); @@ -1131,16 +1138,18 @@ } } } else { - os << (R->canPrintPretty() ? "initialized" : "Initialized") - << " here"; + // At this point we do not make a report. + return false; } } + + return true; } /// Display diagnostics for passing bad region as a parameter. -static void showBRParamDiagnostics(llvm::raw_svector_ostream& os, - const VarRegion *VR, - SVal V) { +/// \returns Whether we create a report. +static bool showBRParamDiagnostics(llvm::raw_svector_ostream &os, + const VarRegion *VR, SVal V) { const auto *Param = cast(VR->getDecl()); os << "Passing "; @@ -1155,7 +1164,8 @@ } else if (auto CI = V.getAs()) { os << "the value " << CI->getValue(); } else { - os << "value"; + // At this point we do not make a report. + return false; } // Printed parameter indexes are 1-based, not 0-based. @@ -1165,10 +1175,13 @@ os << " "; VR->printPretty(os); } + + return true; } /// Show default diagnostics for storing bad region. -static void showBRDefaultDiagnostics(llvm::raw_svector_ostream& os, +/// \returns Whether we create a report. +static bool showBRDefaultDiagnostics(llvm::raw_svector_ostream& os, const MemRegion *R, SVal V) { if (V.getAs()) { @@ -1201,16 +1214,16 @@ os << "Assigning " << CV->getValue(); } else { - if (R->canPrintPretty()) - os << "Value assigned"; - else - os << "Assigning value"; + // At this point we do not make a report. + return false; } if (R->canPrintPretty()) { os << " to "; R->printPretty(os); } + + return true; } std::shared_ptr @@ -1339,16 +1352,20 @@ } } } + if (action) - showBRDiagnostics(action, os, R, V, DS); + if (!showBRDiagnostics(action, os, R, V, DS)) + return nullptr; } else if (StoreSite->getLocation().getAs()) { if (const auto *VR = dyn_cast(R)) - showBRParamDiagnostics(os, VR, V); + if (!showBRParamDiagnostics(os, VR, V)) + return nullptr; } if (os.str().empty()) - showBRDefaultDiagnostics(os, R, V); + if (!showBRDefaultDiagnostics(os, R, V)) + return nullptr; // Construct a new PathDiagnosticPiece. ProgramPoint P = StoreSite->getLocation(); Index: clang/test/Analysis/CFContainers.mm =================================================================== --- clang/test/Analysis/CFContainers.mm +++ clang/test/Analysis/CFContainers.mm @@ -175,7 +175,7 @@ } void TestGetCount(CFArrayRef A, CFIndex sIndex) { - CFIndex sCount = CFArrayGetCount(A); // expected-note{{'sCount' initialized here}} + CFIndex sCount = CFArrayGetCount(A); if (sCount > sIndex) // expected-note{{Assuming 'sCount' is <= 'sIndex'}} // expected-note@-1{{Taking false branch}} const void *s1 = CFArrayGetValueAtIndex(A, sIndex); @@ -237,7 +237,7 @@ } void TestCFMutableArrayRefEscapeViaImmutableArgument(CFMutableArrayRef a) { - CFIndex aLen = CFArrayGetCount(a); // expected-note{{'aLen' initialized here}} + CFIndex aLen = CFArrayGetCount(a); ArrayRefEscape(a); // ArrayRefEscape is declared to take a CFArrayRef (i.e, an immutable array) Index: clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist =================================================================== --- clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist +++ clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist @@ -1647,47 +1647,18 @@ line103 - col8 + col7 file0 line103 - col8 + col7 file0 - - kindevent - location - - line103 - col8 - file0 - - ranges - - - - line103 - col8 - file0 - - - line103 - col28 - file0 - - - - depth0 - extended_message - Value assigned to 'p' - message - Value assigned to 'p' - kindevent location Index: clang/test/Analysis/Inputs/expected-plists/null-deref-path-notes.m.plist =================================================================== --- clang/test/Analysis/Inputs/expected-plists/null-deref-path-notes.m.plist +++ clang/test/Analysis/Inputs/expected-plists/null-deref-path-notes.m.plist @@ -262,35 +262,6 @@ path - - kindevent - location - - line28 - col3 - file0 - - ranges - - - - line28 - col3 - file0 - - - line28 - col33 - file0 - - - - depth0 - extended_message - Value assigned to 'self' - message - Value assigned to 'self' - kindcontrol edges Index: clang/test/Analysis/Inputs/expected-plists/plist-macros.cpp.plist =================================================================== --- clang/test/Analysis/Inputs/expected-plists/plist-macros.cpp.plist +++ clang/test/Analysis/Inputs/expected-plists/plist-macros.cpp.plist @@ -1549,35 +1549,6 @@ path - - kindevent - location - - line87 - col3 - file0 - - ranges - - - - line87 - col3 - file0 - - - line87 - col12 - file0 - - - - depth0 - extended_message - Passing value via 1st parameter 'a' - message - Passing value via 1st parameter 'a' - kindevent location @@ -1718,6 +1689,35 @@ message Assuming 'a' is null + + kindevent + location + + line77 + col7 + file0 + + ranges + + + + line77 + col7 + file0 + + + line77 + col7 + file0 + + + + depth1 + extended_message + Assuming pointer value is null + message + Assuming pointer value is null + kindcontrol edges Index: clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist =================================================================== --- clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist +++ clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist @@ -1659,35 +1659,6 @@ - - kindevent - location - - line56 - col7 - file0 - - ranges - - - - line56 - col7 - file0 - - - line56 - col27 - file0 - - - - depth0 - extended_message - Value assigned to 'p' - message - Value assigned to 'p' - kindevent location Index: clang/test/Analysis/diagnostics/Inputs/expected-plists/deref-track-symbolic-region.c.plist =================================================================== --- clang/test/Analysis/diagnostics/Inputs/expected-plists/deref-track-symbolic-region.c.plist +++ clang/test/Analysis/diagnostics/Inputs/expected-plists/deref-track-symbolic-region.c.plist @@ -27,69 +27,6 @@ file0 - end - - - line14 - col3 - file0 - - - line14 - col5 - file0 - - - - - - - kindevent - location - - line14 - col3 - file0 - - ranges - - - - line14 - col3 - file0 - - - line14 - col15 - file0 - - - - depth0 - extended_message - Value assigned to 'syz.x' - message - Value assigned to 'syz.x' - - - kindcontrol - edges - - - start - - - line14 - col3 - file0 - - - line14 - col5 - file0 - - end @@ -316,69 +253,6 @@ file0 - end - - - line29 - col3 - file0 - - - line29 - col5 - file0 - - - - - - - kindevent - location - - line29 - col3 - file0 - - ranges - - - - line29 - col3 - file0 - - - line29 - col15 - file0 - - - - depth0 - extended_message - Value assigned to 'syz.x' - message - Value assigned to 'syz.x' - - - kindcontrol - edges - - - start - - - line29 - col3 - file0 - - - line29 - col5 - file0 - - end Index: clang/test/Analysis/diagnostics/deref-track-symbolic-region.c =================================================================== --- clang/test/Analysis/diagnostics/deref-track-symbolic-region.c +++ clang/test/Analysis/diagnostics/deref-track-symbolic-region.c @@ -11,7 +11,7 @@ void test(struct S syz, int *pp) { int m = 0; - syz.x = foo(); // expected-note{{Value assigned to 'syz.x'}} + syz.x = foo(); struct S *ps = &syz; if (ps->x) @@ -26,7 +26,7 @@ void testTrackConstraintBRVisitorIsTrackingTurnedOn(struct S syz, int *pp) { int m = 0; - syz.x = foo(); // expected-note{{Value assigned to 'syz.x'}} + syz.x = foo(); struct S *ps = &syz; if (ps->x) Index: clang/test/Analysis/diagnostics/deref-track-symbolic-region.cpp =================================================================== --- clang/test/Analysis/diagnostics/deref-track-symbolic-region.cpp +++ clang/test/Analysis/diagnostics/deref-track-symbolic-region.cpp @@ -7,7 +7,7 @@ S &getSomeReference(); void test(S *p) { - S &r = *p; //expected-note {{'r' initialized here}} + S &r = *p; if (p) return; //expected-note@-1{{Taking false branch}} //expected-note@-2{{Assuming 'p' is null}} @@ -16,7 +16,7 @@ } void testRefParam(int *ptr) { - int &ref = *ptr; // expected-note {{'ref' initialized here}} + int &ref = *ptr; if (ptr) // expected-note@-1{{Assuming 'ptr' is null}} // expected-note@-2{{Taking false branch}} @@ -29,7 +29,7 @@ int testRefToNullPtr() { int *p = 0; // expected-note {{'p' initialized to a null pointer value}} - int *const &p2 = p; // expected-note{{'p2' initialized here}} + int *const &p2 = p; int *p3 = p2; // expected-note {{'p3' initialized to a null pointer value}} return *p3; // expected-warning {{Dereference of null pointer}} // expected-note@-1{{Dereference of null pointer}} @@ -37,7 +37,7 @@ int testRefToNullPtr2() { int *p = 0; // expected-note {{'p' initialized to a null pointer value}} - int *const &p2 = p;// expected-note{{'p2' initialized here}} + int *const &p2 = p; return *p2; //expected-warning {{Dereference of null pointer}} // expected-note@-1{{Dereference of null pointer}} -} \ No newline at end of file +} Index: clang/test/Analysis/diagnostics/find_last_store.c =================================================================== --- clang/test/Analysis/diagnostics/find_last_store.c +++ clang/test/Analysis/diagnostics/find_last_store.c @@ -1,17 +1,16 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=text -verify %s + typedef struct { float b; } c; void *a(); void *d() { - return a(); // expected-note{{Returning pointer}} + return a(); } void no_find_last_store() { - c *e = d(); // expected-note{{Calling 'd'}} - // expected-note@-1{{Returning from 'd'}} - // expected-note@-2{{'e' initialized here}} - - (void)(e || e->b); // expected-note{{Assuming 'e' is null}} - // expected-note@-1{{Left side of '||' is false}} - // expected-note@-2{{Access to field 'b' results in a dereference of a null pointer (loaded from variable 'e')}} - // expected-warning@-3{{Access to field 'b' results in a dereference of a null pointer (loaded from variable 'e')}} + c *e = d(); + (void)(e || e->b); + // expected-note@-1{{Assuming 'e' is null}} + // expected-note@-2{{Left side of '||' is false}} + // expected-note@-3{{Access to field 'b' results in a dereference of a null pointer (loaded from variable 'e')}} + // expected-warning@-4{{Access to field 'b' results in a dereference of a null pointer (loaded from variable 'e')}} } Index: clang/test/Analysis/diagnostics/macro-null-return-suppression.cpp =================================================================== --- clang/test/Analysis/diagnostics/macro-null-return-suppression.cpp +++ clang/test/Analysis/diagnostics/macro-null-return-suppression.cpp @@ -50,7 +50,7 @@ extern int* returnFreshPointer(); int noSuppressMacroUnrelated() { int *x = RETURN_NULL(); - x = returnFreshPointer(); // expected-note{{Value assigned to 'x'}} + x = returnFreshPointer(); if (x) {} // expected-note{{Taking false branch}} // expected-note@-1{{Assuming 'x' is null}} return *x; // expected-warning{{Dereference of null pointer}} Index: clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.c.plist =================================================================== --- clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.c.plist +++ clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.c.plist @@ -461,35 +461,6 @@ path - - kindevent - location - - line32 - col3 - file0 - - ranges - - - - line32 - col3 - file0 - - - line32 - col8 - file0 - - - - depth0 - extended_message - 'a' initialized here - message - 'a' initialized here - kindcontrol edges @@ -511,12 +482,12 @@ end - line34 + line33 col3 file0 - line34 + line33 col4 file0 @@ -532,12 +503,12 @@ start - line34 + line33 col3 file0 - line34 + line33 col4 file0 @@ -545,12 +516,12 @@ end - line34 + line33 col7 file0 - line34 + line33 col7 file0 @@ -562,7 +533,7 @@ kindevent location - line34 + line33 col7 file0 @@ -570,12 +541,12 @@ - line34 + line33 col7 file0 - line34 + line33 col7 file0 @@ -595,12 +566,12 @@ start - line34 + line33 col7 file0 - line34 + line33 col7 file0 @@ -608,12 +579,12 @@ end - line39 + line38 col3 file0 - line39 + line38 col3 file0 @@ -629,12 +600,12 @@ start - line39 + line38 col3 file0 - line39 + line38 col3 file0 @@ -642,12 +613,12 @@ end - line39 + line38 col6 file0 - line39 + line38 col6 file0 @@ -659,7 +630,7 @@ kindevent location - line39 + line38 col6 file0 @@ -667,12 +638,12 @@ - line39 + line38 col4 file0 - line39 + line38 col4 file0 @@ -693,10 +664,10 @@ issue_hash_content_of_line_in_contextec20b5e53a72c82d442b3ca04c81e138 issue_context_kindfunction issue_contexttestInitCheck - issue_hash_function_offset8 + issue_hash_function_offset7 location - line39 + line38 col6 file0 @@ -706,43 +677,14 @@ 31 32 - 34 - 39 + 33 + 38 path - - kindevent - location - - line44 - col3 - file0 - - ranges - - - - line44 - col3 - file0 - - - line44 - col18 - file0 - - - - depth0 - extended_message - Value assigned to 'a' - message - Value assigned to 'a' - kindcontrol edges @@ -751,12 +693,12 @@ start - line44 + line43 col3 file0 - line44 + line43 col3 file0 @@ -764,12 +706,12 @@ end - line46 + line44 col3 file0 - line46 + line44 col4 file0 @@ -785,12 +727,12 @@ start - line46 + line44 col3 file0 - line46 + line44 col4 file0 @@ -798,12 +740,12 @@ end - line46 + line44 col7 file0 - line46 + line44 col7 file0 @@ -815,7 +757,7 @@ kindevent location - line46 + line44 col7 file0 @@ -823,12 +765,12 @@ - line46 + line44 col7 file0 - line46 + line44 col7 file0 @@ -848,12 +790,12 @@ start - line46 + line44 col7 file0 - line46 + line44 col7 file0 @@ -861,12 +803,12 @@ end - line51 + line49 col3 file0 - line51 + line49 col3 file0 @@ -882,12 +824,12 @@ start - line51 + line49 col3 file0 - line51 + line49 col3 file0 @@ -895,12 +837,12 @@ end - line51 + line49 col6 file0 - line51 + line49 col6 file0 @@ -912,7 +854,7 @@ kindevent location - line51 + line49 col6 file0 @@ -920,12 +862,12 @@ - line51 + line49 col4 file0 - line51 + line49 col4 file0 @@ -946,10 +888,10 @@ issue_hash_content_of_line_in_context1ae8e7c84d15f307abc1df9f5612078b issue_context_kindfunction issue_contexttestStoreCheck - issue_hash_function_offset8 + issue_hash_function_offset7 location - line51 + line49 col6 file0 @@ -957,10 +899,10 @@ 0 + 42 43 44 - 46 - 51 + 49 @@ -971,7 +913,7 @@ kindevent location - line65 + line63 col4 file0 @@ -979,12 +921,12 @@ - line65 + line63 col4 file0 - line65 + line63 col12 file0 @@ -1000,7 +942,7 @@ kindevent location - line56 + line54 col1 file0 @@ -1018,12 +960,12 @@ start - line56 + line54 col1 file0 - line56 + line54 col3 file0 @@ -1031,12 +973,12 @@ end - line57 + line55 col3 file0 - line57 + line55 col5 file0 @@ -1048,7 +990,7 @@ kindevent location - line57 + line55 col3 file0 @@ -1056,12 +998,12 @@ - line57 + line55 col3 file0 - line57 + line55 col8 file0 @@ -1081,12 +1023,12 @@ start - line57 + line55 col3 file0 - line57 + line55 col5 file0 @@ -1094,12 +1036,12 @@ end - line60 + line58 col3 file0 - line60 + line58 col8 file0 @@ -1111,7 +1053,7 @@ kindevent location - line60 + line58 col3 file0 @@ -1119,12 +1061,12 @@ - line60 + line58 col3 file0 - line60 + line58 col10 file0 @@ -1140,7 +1082,7 @@ kindevent location - line65 + line63 col4 file0 @@ -1148,12 +1090,12 @@ - line65 + line63 col4 file0 - line65 + line63 col12 file0 @@ -1173,12 +1115,12 @@ start - line65 + line63 col3 file0 - line65 + line63 col3 file0 @@ -1186,12 +1128,12 @@ end - line65 + line63 col14 file0 - line65 + line63 col14 file0 @@ -1203,7 +1145,7 @@ kindevent location - line65 + line63 col14 file0 @@ -1211,12 +1153,12 @@ - line65 + line63 col3 file0 - line65 + line63 col16 file0 @@ -1240,7 +1182,7 @@ issue_hash_function_offset1 location - line65 + line63 col14 file0 @@ -1248,11 +1190,11 @@ 0 - 56 - 57 - 60 - 64 - 65 + 54 + 55 + 58 + 62 + 63 @@ -1267,12 +1209,12 @@ start - line72 + line70 col3 file0 - line72 + line70 col8 file0 @@ -1280,12 +1222,12 @@ end - line72 + line70 col11 file0 - line72 + line70 col17 file0 @@ -1297,7 +1239,7 @@ kindevent location - line72 + line70 col11 file0 @@ -1305,12 +1247,12 @@ - line72 + line70 col11 file0 - line72 + line70 col19 file0 @@ -1326,7 +1268,7 @@ kindevent location - line56 + line54 col1 file0 @@ -1344,12 +1286,12 @@ start - line56 + line54 col1 file0 - line56 + line54 col3 file0 @@ -1357,12 +1299,12 @@ end - line57 + line55 col3 file0 - line57 + line55 col5 file0 @@ -1374,7 +1316,7 @@ kindevent location - line57 + line55 col3 file0 @@ -1382,12 +1324,12 @@ - line57 + line55 col3 file0 - line57 + line55 col8 file0 @@ -1407,12 +1349,12 @@ start - line57 + line55 col3 file0 - line57 + line55 col5 file0 @@ -1420,12 +1362,12 @@ end - line60 + line58 col3 file0 - line60 + line58 col8 file0 @@ -1437,7 +1379,7 @@ kindevent location - line60 + line58 col3 file0 @@ -1445,12 +1387,12 @@ - line60 + line58 col3 file0 - line60 + line58 col10 file0 @@ -1466,7 +1408,7 @@ kindevent location - line72 + line70 col11 file0 @@ -1474,12 +1416,12 @@ - line72 + line70 col11 file0 - line72 + line70 col19 file0 @@ -1495,7 +1437,7 @@ kindevent location - line72 + line70 col10 file0 @@ -1503,12 +1445,12 @@ - line72 + line70 col10 file0 - line72 + line70 col19 file0 @@ -1532,7 +1474,7 @@ issue_hash_function_offset1 location - line72 + line70 col10 file0 @@ -1540,11 +1482,11 @@ 0 - 56 - 57 - 60 - 71 - 72 + 54 + 55 + 58 + 69 + 70 @@ -1559,12 +1501,12 @@ start - line79 + line77 col3 file0 - line79 + line77 col5 file0 @@ -1572,12 +1514,12 @@ end - line79 + line77 col12 file0 - line79 + line77 col18 file0 @@ -1589,7 +1531,7 @@ kindevent location - line79 + line77 col12 file0 @@ -1597,12 +1539,12 @@ - line79 + line77 col12 file0 - line79 + line77 col20 file0 @@ -1618,7 +1560,7 @@ kindevent location - line56 + line54 col1 file0 @@ -1636,12 +1578,12 @@ start - line56 + line54 col1 file0 - line56 + line54 col3 file0 @@ -1649,12 +1591,12 @@ end - line57 + line55 col3 file0 - line57 + line55 col5 file0 @@ -1666,7 +1608,7 @@ kindevent location - line57 + line55 col3 file0 @@ -1674,12 +1616,12 @@ - line57 + line55 col3 file0 - line57 + line55 col8 file0 @@ -1699,12 +1641,12 @@ start - line57 + line55 col3 file0 - line57 + line55 col5 file0 @@ -1712,12 +1654,12 @@ end - line60 + line58 col3 file0 - line60 + line58 col8 file0 @@ -1729,7 +1671,7 @@ kindevent location - line60 + line58 col3 file0 @@ -1737,12 +1679,12 @@ - line60 + line58 col3 file0 - line60 + line58 col10 file0 @@ -1758,7 +1700,7 @@ kindevent location - line79 + line77 col12 file0 @@ -1766,12 +1708,12 @@ - line79 + line77 col12 file0 - line79 + line77 col20 file0 @@ -1791,12 +1733,12 @@ start - line79 + line77 col12 file0 - line79 + line77 col18 file0 @@ -1804,12 +1746,12 @@ end - line79 + line77 col3 file0 - line79 + line77 col5 file0 @@ -1821,7 +1763,7 @@ kindevent location - line79 + line77 col3 file0 @@ -1829,12 +1771,12 @@ - line79 + line77 col3 file0 - line79 + line77 col8 file0 @@ -1854,12 +1796,12 @@ start - line79 + line77 col3 file0 - line79 + line77 col5 file0 @@ -1867,12 +1809,12 @@ end - line83 + line81 col3 file0 - line83 + line81 col3 file0 @@ -1888,12 +1830,12 @@ start - line83 + line81 col3 file0 - line83 + line81 col3 file0 @@ -1901,12 +1843,12 @@ end - line83 + line81 col6 file0 - line83 + line81 col6 file0 @@ -1918,7 +1860,7 @@ kindevent location - line83 + line81 col6 file0 @@ -1926,12 +1868,12 @@ - line83 + line81 col4 file0 - line83 + line81 col4 file0 @@ -1955,7 +1897,7 @@ issue_hash_function_offset5 location - line83 + line81 col6 file0 @@ -1963,12 +1905,12 @@ 0 - 56 - 57 - 60 - 78 - 79 - 83 + 54 + 55 + 58 + 76 + 77 + 81 @@ -1983,12 +1925,12 @@ start - line88 + line86 col3 file0 - line88 + line86 col3 file0 @@ -1996,12 +1938,12 @@ end - line88 + line86 col7 file0 - line88 + line86 col13 file0 @@ -2013,7 +1955,7 @@ kindevent location - line88 + line86 col7 file0 @@ -2021,12 +1963,12 @@ - line88 + line86 col7 file0 - line88 + line86 col15 file0 @@ -2042,7 +1984,7 @@ kindevent location - line56 + line54 col1 file0 @@ -2060,12 +2002,12 @@ start - line56 + line54 col1 file0 - line56 + line54 col3 file0 @@ -2073,12 +2015,12 @@ end - line57 + line55 col3 file0 - line57 + line55 col5 file0 @@ -2090,7 +2032,7 @@ kindevent location - line57 + line55 col3 file0 @@ -2098,12 +2040,12 @@ - line57 + line55 col3 file0 - line57 + line55 col8 file0 @@ -2123,12 +2065,12 @@ start - line57 + line55 col3 file0 - line57 + line55 col5 file0 @@ -2136,12 +2078,12 @@ end - line60 + line58 col3 file0 - line60 + line58 col8 file0 @@ -2153,7 +2095,7 @@ kindevent location - line60 + line58 col3 file0 @@ -2161,12 +2103,12 @@ - line60 + line58 col3 file0 - line60 + line58 col10 file0 @@ -2182,7 +2124,7 @@ kindevent location - line88 + line86 col7 file0 @@ -2190,12 +2132,12 @@ - line88 + line86 col7 file0 - line88 + line86 col15 file0 @@ -2215,12 +2157,12 @@ start - line88 + line86 col7 file0 - line88 + line86 col13 file0 @@ -2228,12 +2170,12 @@ end - line88 + line86 col3 file0 - line88 + line86 col3 file0 @@ -2245,7 +2187,7 @@ kindevent location - line88 + line86 col3 file0 @@ -2253,12 +2195,12 @@ - line88 + line86 col3 file0 - line88 + line86 col15 file0 @@ -2278,12 +2220,12 @@ start - line88 + line86 col3 file0 - line88 + line86 col3 file0 @@ -2291,12 +2233,12 @@ end - line92 + line90 col3 file0 - line92 + line90 col3 file0 @@ -2312,12 +2254,12 @@ start - line92 + line90 col3 file0 - line92 + line90 col3 file0 @@ -2325,12 +2267,12 @@ end - line92 + line90 col6 file0 - line92 + line90 col6 file0 @@ -2342,7 +2284,7 @@ kindevent location - line92 + line90 col6 file0 @@ -2350,12 +2292,12 @@ - line92 + line90 col4 file0 - line92 + line90 col4 file0 @@ -2379,7 +2321,7 @@ issue_hash_function_offset5 location - line92 + line90 col6 file0 @@ -2387,12 +2329,12 @@ 0 - 56 - 57 - 60 - 87 - 88 - 92 + 54 + 55 + 58 + 85 + 86 + 90 @@ -2407,12 +2349,12 @@ start - line103 + line101 col3 file0 - line103 + line101 col12 file0 @@ -2420,12 +2362,12 @@ end - line103 + line101 col14 file0 - line103 + line101 col20 file0 @@ -2437,7 +2379,7 @@ kindevent location - line103 + line101 col14 file0 @@ -2445,12 +2387,12 @@ - line103 + line101 col14 file0 - line103 + line101 col22 file0 @@ -2466,7 +2408,7 @@ kindevent location - line56 + line54 col1 file0 @@ -2484,12 +2426,12 @@ start - line56 + line54 col1 file0 - line56 + line54 col3 file0 @@ -2497,12 +2439,12 @@ end - line57 + line55 col3 file0 - line57 + line55 col5 file0 @@ -2514,7 +2456,7 @@ kindevent location - line57 + line55 col3 file0 @@ -2522,12 +2464,12 @@ - line57 + line55 col3 file0 - line57 + line55 col8 file0 @@ -2547,12 +2489,12 @@ start - line57 + line55 col3 file0 - line57 + line55 col5 file0 @@ -2560,12 +2502,12 @@ end - line60 + line58 col3 file0 - line60 + line58 col8 file0 @@ -2577,7 +2519,7 @@ kindevent location - line60 + line58 col3 file0 @@ -2585,12 +2527,12 @@ - line60 + line58 col3 file0 - line60 + line58 col10 file0 @@ -2606,7 +2548,7 @@ kindevent location - line103 + line101 col14 file0 @@ -2614,12 +2556,12 @@ - line103 + line101 col14 file0 - line103 + line101 col22 file0 @@ -2635,7 +2577,7 @@ kindevent location - line103 + line101 col14 file0 @@ -2643,12 +2585,12 @@ - line103 + line101 col14 file0 - line103 + line101 col22 file0 @@ -2668,12 +2610,12 @@ start - line103 + line101 col14 file0 - line103 + line101 col20 file0 @@ -2681,12 +2623,12 @@ end - line103 + line101 col3 file0 - line103 + line101 col12 file0 @@ -2698,7 +2640,7 @@ kindevent location - line103 + line101 col3 file0 @@ -2706,12 +2648,12 @@ - line103 + line101 col3 file0 - line103 + line101 col23 file0 @@ -2727,7 +2669,7 @@ kindevent location - line96 + line94 col1 file0 @@ -2745,12 +2687,12 @@ start - line96 + line94 col1 file0 - line96 + line94 col4 file0 @@ -2758,12 +2700,12 @@ end - line97 + line95 col3 file0 - line97 + line95 col3 file0 @@ -2779,12 +2721,12 @@ start - line97 + line95 col3 file0 - line97 + line95 col3 file0 @@ -2792,12 +2734,12 @@ end - line97 + line95 col6 file0 - line97 + line95 col6 file0 @@ -2809,7 +2751,7 @@ kindevent location - line97 + line95 col6 file0 @@ -2817,12 +2759,12 @@ - line97 + line95 col4 file0 - line97 + line95 col4 file0 @@ -2846,7 +2788,7 @@ issue_hash_function_offset1 location - line97 + line95 col6 file0 @@ -2854,13 +2796,13 @@ 0 - 56 - 57 - 60 - 96 - 97 + 54 + 55 + 58 + 94 + 95 + 99 101 - 103 @@ -2871,7 +2813,7 @@ kindevent location - line117 + line115 col3 file0 @@ -2879,12 +2821,12 @@ - line117 + line115 col3 file0 - line117 + line115 col19 file0 @@ -2900,7 +2842,7 @@ kindevent location - line112 + line110 col1 file0 @@ -2918,12 +2860,12 @@ start - line112 + line110 col1 file0 - line112 + line110 col4 file0 @@ -2931,12 +2873,12 @@ end - line113 + line111 col2 file0 - line113 + line111 col2 file0 @@ -2948,7 +2890,7 @@ kindevent location - line113 + line111 col2 file0 @@ -2956,12 +2898,12 @@ - line113 + line111 col2 file0 - line113 + line111 col9 file0 @@ -2977,7 +2919,7 @@ kindevent location - line117 + line115 col3 file0 @@ -2985,12 +2927,12 @@ - line117 + line115 col3 file0 - line117 + line115 col19 file0 @@ -3010,12 +2952,12 @@ start - line117 + line115 col3 file0 - line117 + line115 col16 file0 @@ -3023,12 +2965,12 @@ end - line119 + line117 col3 file0 - line119 + line117 col8 file0 @@ -3044,12 +2986,12 @@ start - line119 + line117 col3 file0 - line119 + line117 col8 file0 @@ -3057,12 +2999,12 @@ end - line119 + line117 col10 file0 - line119 + line117 col10 file0 @@ -3074,7 +3016,7 @@ kindevent location - line119 + line117 col10 file0 @@ -3082,12 +3024,12 @@ - line119 + line117 col14 file0 - line119 + line117 col14 file0 @@ -3111,7 +3053,7 @@ issue_hash_function_offset3 location - line119 + line117 col10 file0 @@ -3119,11 +3061,11 @@ 0 - 112 - 113 - 116 + 110 + 111 + 114 + 115 117 - 119 @@ -3134,7 +3076,7 @@ kindevent location - line131 + line129 col3 file0 @@ -3142,12 +3084,12 @@ - line131 + line129 col3 file0 - line131 + line129 col25 file0 @@ -3167,12 +3109,12 @@ start - line131 + line129 col3 file0 - line131 + line129 col12 file0 @@ -3180,12 +3122,12 @@ end - line132 + line130 col3 file0 - line132 + line130 col3 file0 @@ -3201,12 +3143,12 @@ start - line132 + line130 col3 file0 - line132 + line130 col3 file0 @@ -3214,12 +3156,12 @@ end - line132 + line130 col24 file0 - line132 + line130 col24 file0 @@ -3231,7 +3173,7 @@ kindevent location - line132 + line130 col24 file0 @@ -3239,12 +3181,12 @@ - line132 + line130 col22 file0 - line132 + line130 col22 file0 @@ -3268,7 +3210,7 @@ issue_hash_function_offset2 location - line132 + line130 col24 file0 @@ -3276,9 +3218,9 @@ 0 + 128 + 129 130 - 131 - 132 @@ -3293,12 +3235,12 @@ start - line137 + line135 col3 file0 - line137 + line135 col4 file0 @@ -3306,12 +3248,12 @@ end - line137 + line135 col7 file0 - line137 + line135 col7 file0 @@ -3323,7 +3265,7 @@ kindevent location - line137 + line135 col7 file0 @@ -3331,12 +3273,12 @@ - line137 + line135 col7 file0 - line137 + line135 col8 file0 @@ -3356,12 +3298,12 @@ start - line137 + line135 col7 file0 - line137 + line135 col7 file0 @@ -3369,12 +3311,12 @@ end - line139 + line137 col3 file0 - line139 + line137 col3 file0 @@ -3390,12 +3332,12 @@ start - line139 + line137 col3 file0 - line139 + line137 col3 file0 @@ -3403,12 +3345,12 @@ end - line139 + line137 col7 file0 - line139 + line137 col7 file0 @@ -3420,7 +3362,7 @@ kindevent location - line139 + line137 col7 file0 @@ -3428,12 +3370,12 @@ - line139 + line137 col3 file0 - line139 + line137 col9 file0 @@ -3457,7 +3399,7 @@ issue_hash_function_offset3 location - line139 + line137 col7 file0 @@ -3465,9 +3407,9 @@ 0 - 136 + 134 + 135 137 - 139 @@ -3482,12 +3424,12 @@ start - line152 + line150 col3 file0 - line152 + line150 col5 file0 @@ -3495,12 +3437,12 @@ end - line153 + line151 col3 file0 - line153 + line151 col19 file0 @@ -3512,7 +3454,7 @@ kindevent location - line153 + line151 col3 file0 @@ -3520,12 +3462,12 @@ - line153 + line151 col3 file0 - line153 + line151 col23 file0 @@ -3541,7 +3483,7 @@ kindevent location - line146 + line144 col1 file0 @@ -3559,12 +3501,12 @@ start - line146 + line144 col1 file0 - line146 + line144 col4 file0 @@ -3572,12 +3514,12 @@ end - line147 + line145 col3 file0 - line147 + line145 col3 file0 @@ -3589,7 +3531,7 @@ kindevent location - line147 + line145 col3 file0 @@ -3597,12 +3539,12 @@ - line147 + line145 col3 file0 - line147 + line145 col8 file0 @@ -3622,12 +3564,12 @@ start - line147 + line145 col3 file0 - line147 + line145 col3 file0 @@ -3635,12 +3577,12 @@ end - line148 + line146 col3 file0 - line148 + line146 col14 file0 @@ -3652,7 +3594,7 @@ kindevent location - line153 + line151 col3 file0 @@ -3660,12 +3602,12 @@ - line153 + line151 col3 file0 - line153 + line151 col23 file0 @@ -3685,12 +3627,12 @@ start - line153 + line151 col3 file0 - line153 + line151 col19 file0 @@ -3698,12 +3640,12 @@ end - line155 + line153 col12 file0 - line155 + line153 col12 file0 @@ -3715,7 +3657,7 @@ kindevent location - line155 + line153 col12 file0 @@ -3723,12 +3665,12 @@ - line155 + line153 col10 file0 - line155 + line153 col14 file0 @@ -3752,7 +3694,7 @@ issue_hash_function_offset4 location - line155 + line153 col12 file0 @@ -3760,14 +3702,14 @@ 0 - 143 + 141 + 144 + 145 146 - 147 - 148 + 149 + 150 151 - 152 153 - 155 Index: clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist =================================================================== --- clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist +++ clang/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist @@ -3838,35 +3838,6 @@ path - - kindevent - location - - line210 - col3 - file0 - - ranges - - - - line210 - col3 - file0 - - - line210 - col9 - file0 - - - - depth0 - extended_message - 'y' initialized here - message - 'y' initialized here - kindcontrol edges @@ -4556,35 +4527,6 @@ path - - kindevent - location - - line254 - col3 - file0 - - ranges - - - - line254 - col3 - file0 - - - line254 - col14 - file0 - - - - depth0 - extended_message - 'val' initialized here - message - 'val' initialized here - kindcontrol edges Index: clang/test/Analysis/inlining/path-notes.c =================================================================== --- clang/test/Analysis/inlining/path-notes.c +++ clang/test/Analysis/inlining/path-notes.c @@ -30,7 +30,6 @@ void testInitCheck() { int *a = getPointer(); - // expected-note@-1 {{'a' initialized here}} if (a) { // expected-note@-1 + {{Assuming 'a' is null}} // expected-note@-2 + {{Taking false branch}} @@ -42,7 +41,6 @@ void testStoreCheck(int *a) { a = getPointer(); - // expected-note@-1 {{Value assigned to 'a'}} if (a) { // expected-note@-1 + {{Assuming 'a' is null}} // expected-note@-2 + {{Taking false branch}} Index: clang/test/Analysis/inlining/path-notes.cpp =================================================================== --- clang/test/Analysis/inlining/path-notes.cpp +++ clang/test/Analysis/inlining/path-notes.cpp @@ -207,7 +207,7 @@ } int testNonPrintableAssignment(int **p) { - int *&y = *p; // expected-note {{'y' initialized here}} + int *&y = *p; y = 0; // expected-note {{Storing null pointer value}} return *y; // expected-warning {{Dereference of null pointer (loaded from variable 'y')}} // expected-note@-1 {{Dereference of null pointer (loaded from variable 'y')}} @@ -251,7 +251,7 @@ void bar() const {} }; const A& testDeclRefExprToReferenceInGetDerefExpr(const A *ptr) { - const A& val = *ptr; //expected-note {{'val' initialized here}} + const A& val = *ptr; // This is not valid C++; if 'ptr' were null, creating 'ref' would be illegal. // However, this is not checked at runtime, so this branch is actually Index: clang/test/Analysis/loop-widening-notes.cpp =================================================================== --- clang/test/Analysis/loop-widening-notes.cpp +++ clang/test/Analysis/loop-widening-notes.cpp @@ -9,7 +9,7 @@ bar(); for (int i = 0; // expected-note {{Loop condition is true. Entering loop body}} // expected-note@-1 {{Loop condition is false. Execution continues on line 16}} - ++i, // expected-note {{Value assigned to 'p_a'}} + ++i, i < flag_a; ++i) {} @@ -23,8 +23,7 @@ flag_b = 100; int num = 10; while (flag_b-- > 0) { // expected-note {{Loop condition is true. Entering loop body}} - // expected-note@-1 {{Value assigned to 'num'}} - // expected-note@-2 {{Loop condition is false. Execution continues on line 30}} + // expected-note@-1 {{Loop condition is false. Execution continues on line 29}} num = flag_b; } if (num < 0) // expected-note {{Assuming 'num' is >= 0}} @@ -42,10 +41,10 @@ int flag_c; int do_while_analyzer_output() { int num = 10; - do { // expected-note {{Loop condition is true. Execution continues on line 47}} + do { // expected-note {{Loop condition is true. Execution continues on line 46}} // expected-note@-1 {{Loop condition is false. Exiting loop}} num--; - } while (flag_c-- > 0); //expected-note {{Value assigned to 'num'}} + } while (flag_c-- > 0); int local = 0; if (num == 0) // expected-note {{Assuming 'num' is equal to 0}} // expected-note@-1 {{Taking true branch}} @@ -58,8 +57,8 @@ int test_for_loop() { int num = 10; for (int i = 0; // expected-note {{Loop condition is true. Entering loop body}} - // expected-note@-1 {{Loop condition is false. Execution continues on line 67}} - new int(10), // expected-note {{Value assigned to 'num'}} + // expected-note@-1 {{Loop condition is false. Execution continues on line 66}} + new int(10), i < flag_d; ++i) { ++num; Index: clang/test/Analysis/null-deref-path-notes.cpp =================================================================== --- clang/test/Analysis/null-deref-path-notes.cpp +++ clang/test/Analysis/null-deref-path-notes.cpp @@ -17,7 +17,7 @@ void c::f(B &g, int &i) { e(g.d[9], i); // expected-warning{{Array access (via field 'd') results in a null pointer dereference}} // expected-note@-1{{Array access (via field 'd') results in a null pointer dereference}} - B h, a; // expected-note{{Value assigned to 'h.d'}} + B h, a; a.d == __null; // expected-note{{Assuming the condition is true}} a.d != h.d; // expected-note{{Assuming 'a.d' is equal to 'h.d'}} f(h, b); // expected-note{{Calling 'c::f'}} Index: clang/test/Analysis/null-deref-path-notes.m =================================================================== --- clang/test/Analysis/null-deref-path-notes.m +++ clang/test/Analysis/null-deref-path-notes.m @@ -25,7 +25,7 @@ @implementation Subclass - (id)initWithID:(int)newID { - self = [super initWithID:newID]; // expected-note{{Value assigned to 'self'}} + self = [super initWithID:newID]; if (self) return self; // expected-note@-1 {{Assuming 'self' is nil}} // expected-note@-2 {{Taking false branch}} Index: clang/test/Analysis/taint-diagnostic-visitor.c =================================================================== --- clang/test/Analysis/taint-diagnostic-visitor.c +++ clang/test/Analysis/taint-diagnostic-visitor.c @@ -21,16 +21,14 @@ } int taintDiagnosticDivZero(int operand) { - scanf("%d", &operand); // expected-note {{Value assigned to 'operand'}} - // expected-note@-1 {{Taint originated here}} + scanf("%d", &operand); // expected-note {{Taint originated here}} return 10 / operand; // expected-warning {{Division by a tainted value, possibly zero}} // expected-note@-1 {{Division by a tainted value, possibly zero}} } void taintDiagnosticVLA() { int x; - scanf("%d", &x); // expected-note {{Value assigned to 'x'}} - // expected-note@-1 {{Taint originated here}} + scanf("%d", &x); // expected-note {{Taint originated here}} int vla[x]; // expected-warning {{Declared variable-length array (VLA) has tainted size}} // expected-note@-1 {{Declared variable-length array (VLA) has tainted size}} } Index: clang/test/Analysis/uninit-const.c =================================================================== --- clang/test/Analysis/uninit-const.c +++ clang/test/Analysis/uninit-const.c @@ -25,7 +25,7 @@ void f_1(void) { int t; - int* tp = &t; // expected-note {{'tp' initialized here}} + int* tp = &t; doStuff_pointerToConstInt(tp); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } @@ -33,7 +33,7 @@ void f_1_1(void) { int t; int* tp1 = &t; - int* tp2 = tp1; // expected-note {{'tp2' initialized here}} + int* tp2 = tp1; doStuff_pointerToConstInt(tp2); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } @@ -46,7 +46,7 @@ void f_2(void) { int t; int* p = f_2_sub(&t); - int* tp = p; // expected-note {{'tp' initialized here}} + int* tp = p; doStuff_pointerToConstInt(tp); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } @@ -63,13 +63,13 @@ void f_5(void) { int ta[5]; - int* tp = ta; // expected-note {{'tp' initialized here}} + int* tp = ta; doStuff_pointerToConstInt(tp); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } void f_5_1(void) { - int ta[5]; // expected-note {{'ta' initialized here}} + int ta[5]; doStuff_pointerToConstInt(ta); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } @@ -100,19 +100,19 @@ void f_9(void) { int a[6]; - int const *ptau = a; // expected-note {{'ptau' initialized here}} + int const *ptau = a; doStuff_arrayOfConstInt(ptau); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } void f_10(void) { - int a[6]; // expected-note {{'a' initialized here}} + int a[6]; doStuff_arrayOfConstInt(a); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } void f_11(void) { - int t[10]; //expected-note {{'t' initialized here}} + int t[10]; doStuff_constStaticSizedArray(t); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } @@ -152,7 +152,7 @@ int f_malloc_1(void) { int *ptr; - ptr = (int *)malloc(sizeof(int)); // expected-note {{Value assigned to 'ptr'}} + ptr = (int *)malloc(sizeof(int)); doStuff_pointerToConstInt(ptr); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} @@ -175,7 +175,7 @@ void f_variadic_unp_unv(void) { int t; int v; - int* tp = &t; // expected-note {{'tp' initialized here}} + int* tp = &t; doStuff_variadic(tp,v); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } @@ -183,7 +183,7 @@ void f_variadic_unp_inv(void) { int t; int v = 3; - int* tp = &t; // expected-note {{'tp' initialized here}} + int* tp = &t; doStuff_variadic(tp,v); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } @@ -219,7 +219,7 @@ int t; int u=3; int *vp = &u ; - int *tp = &t; // expected-note {{'tp' initialized here}} + int *tp = &t; doStuff_variadic(tp,vp); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } @@ -238,7 +238,7 @@ int t; int u; int *vp = &u ; - int *tp = &t; // expected-note {{'tp' initialized here}} + int *tp = &t; doStuff_variadic(tp,vp); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } Index: clang/test/Analysis/uninit-const.cpp =================================================================== --- clang/test/Analysis/uninit-const.cpp +++ clang/test/Analysis/uninit-const.cpp @@ -56,10 +56,9 @@ void f6_1(void) { int t; // expected-note{{'t' declared without an initial value}} int p = f6_1_sub(t); //expected-warning {{Assigned value is garbage or undefined}} - //expected-note@-1 {{Passing value via 1st parameter 'p'}} - //expected-note@-2 {{Calling 'f6_1_sub'}} - //expected-note@-3 {{Returning from 'f6_1_sub'}} - //expected-note@-4 {{Assigned value is garbage or undefined}} + //expected-note@-1 {{Calling 'f6_1_sub'}} + //expected-note@-2 {{Returning from 'f6_1_sub'}} + //expected-note@-3 {{Assigned value is garbage or undefined}} int q = p; doStuff6(q); } @@ -68,7 +67,7 @@ int t; //expected-note {{'t' declared without an initial value}} int &p = t; int &s = p; - int &q = s; //expected-note {{'q' initialized here}} + int &q = s; doStuff6(q); //expected-warning {{1st function call argument is an uninitialized value}} //expected-note@-1 {{1st function call argument is an uninitialized value}} } @@ -97,7 +96,7 @@ void f5(void) { int t; - int* tp = &t; // expected-note {{'tp' initialized here}} + int* tp = &t; doStuff_uninit(tp); // expected-warning {{1st function call argument is a pointer to uninitialized value}} // expected-note@-1 {{1st function call argument is a pointer to uninitialized value}} } Index: clang/test/Analysis/uninit-vals.c =================================================================== --- clang/test/Analysis/uninit-vals.c +++ clang/test/Analysis/uninit-vals.c @@ -149,8 +149,6 @@ RetVoidFuncType f = foo_radar12278788_fp; return ((RetIntFuncType)f)(); //expected-warning {{Undefined or garbage value returned to caller}} //expected-note@-1 {{Undefined or garbage value returned to caller}} - //expected-note@-2 {{Calling 'foo_radar12278788_fp'}} - //expected-note@-3 {{Returning from 'foo_radar12278788_fp'}} } void rdar13665798() { @@ -164,8 +162,6 @@ RetVoidFuncType f = foo_radar12278788_fp; return ((RetIntFuncType)f)(); //expected-warning {{Undefined or garbage value returned to caller}} //expected-note@-1 {{Undefined or garbage value returned to caller}} - //expected-note@-2 {{Calling 'foo_radar12278788_fp'}} - //expected-note@-3 {{Returning from 'foo_radar12278788_fp'}} }(); } @@ -182,18 +178,14 @@ void use(struct Point p); void testUseHalfPoint() { - struct Point p = getHalfPoint(); // expected-note{{Calling 'getHalfPoint'}} - // expected-note@-1{{Returning from 'getHalfPoint'}} - // expected-note@-2{{'p' initialized here}} + struct Point p = getHalfPoint(); use(p); // expected-warning{{uninitialized}} // expected-note@-1{{uninitialized}} } void testUseHalfPoint2() { struct Point p; - p = getHalfPoint(); // expected-note{{Calling 'getHalfPoint'}} - // expected-note@-1{{Returning from 'getHalfPoint'}} - // expected-note@-2{{Value assigned to 'p'}} + p = getHalfPoint(); use(p); // expected-warning{{uninitialized}} // expected-note@-1{{uninitialized}} } Index: clang/test/Analysis/uninit-vals.m =================================================================== --- clang/test/Analysis/uninit-vals.m +++ clang/test/Analysis/uninit-vals.m @@ -59,7 +59,7 @@ extern void test_uninit_struct_arg_aux(struct TestUninit arg); void test_uninit_struct_arg() { - struct TestUninit x; // expected-note{{'x' initialized here}} + struct TestUninit x; test_uninit_struct_arg_aux(x); // expected-warning{{Passed-by-value struct argument contains uninitialized data (e.g., field: 'x')}} // expected-note@-1{{Passed-by-value struct argument contains uninitialized data (e.g., field: 'x')}} } @@ -68,7 +68,7 @@ - (void) passVal:(struct TestUninit)arg; @end void testFoo(Foo *o) { - struct TestUninit x; // expected-note{{'x' initialized here}} + struct TestUninit x; [o passVal:x]; // expected-warning{{Passed-by-value struct argument contains uninitialized data (e.g., field: 'x')}} // expected-note@-1{{Passed-by-value struct argument contains uninitialized data (e.g., field: 'x')}} } @@ -402,7 +402,7 @@ struct { int : 4; int y : 4; - } a, b, c; // expected-note{{'c' initialized here}} + } a, b, c; a.y = 2; @@ -419,7 +419,7 @@ struct { int x : 4; int : 4; - } a, b, c; // expected-note{{'c' initialized here}} + } a, b, c; a.x = 1;