This revision was automatically updated to reflect the committed changes. Closed by commit rL357329: [analyzer] PR41239: Fix a crash on invalid source location in… (authored by dergachev, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D59901?vs=192512&id=192935#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59901/new/ https://reviews.llvm.org/D59901 Files: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.c Index: cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.c =================================================================== --- cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.c +++ cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.c @@ -1,4 +1,5 @@ -// RUN: %clang_analyze_cc1 -x c -analyzer-checker=core -analyzer-output=text -verify %s +// RUN: %clang_analyze_cc1 -w -x c -analyzer-checker=core -analyzer-output=text\ +// RUN: -verify %s typedef __typeof(sizeof(int)) size_t; void *memset(void *__s, int __c, size_t __n); @@ -244,3 +245,12 @@ return z; // expected-warning{{Undefined or garbage value returned to caller}} // expected-note@-1{{Undefined or garbage value returned to caller}} } + +void test_implicit_function_decl(int *x) { + if (x) {} // expected-note{{Assuming 'x' is null}} + // expected-note@-1{{Taking false branch}} + implicit_function(x); + *x = 4; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}} + // expected-note@-1{{Dereference of null pointer (loaded from variable 'x')}} +} +int implicit_function(int *y) {} Index: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -322,7 +322,7 @@ CallEventRef<> Call = BR.getStateManager().getCallEventManager().getCaller(SCtx, State); - if (SM.isInSystemHeader(Call->getDecl()->getSourceRange().getBegin())) + if (Call->isInSystemHeader()) return nullptr; // Region of interest corresponds to an IVar, exiting a method
Index: cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.c =================================================================== --- cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.c +++ cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.c @@ -1,4 +1,5 @@ -// RUN: %clang_analyze_cc1 -x c -analyzer-checker=core -analyzer-output=text -verify %s +// RUN: %clang_analyze_cc1 -w -x c -analyzer-checker=core -analyzer-output=text\ +// RUN: -verify %s typedef __typeof(sizeof(int)) size_t; void *memset(void *__s, int __c, size_t __n); @@ -244,3 +245,12 @@ return z; // expected-warning{{Undefined or garbage value returned to caller}} // expected-note@-1{{Undefined or garbage value returned to caller}} } + +void test_implicit_function_decl(int *x) { + if (x) {} // expected-note{{Assuming 'x' is null}} + // expected-note@-1{{Taking false branch}} + implicit_function(x); + *x = 4; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}} + // expected-note@-1{{Dereference of null pointer (loaded from variable 'x')}} +} +int implicit_function(int *y) {} Index: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -322,7 +322,7 @@ CallEventRef<> Call = BR.getStateManager().getCallEventManager().getCaller(SCtx, State); - if (SM.isInSystemHeader(Call->getDecl()->getSourceRange().getBegin())) + if (Call->isInSystemHeader()) return nullptr; // Region of interest corresponds to an IVar, exiting a method
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits