]> granicus.if.org Git - clang/commit
[analyzer] PR41239: Fix a crash on invalid source location in NoStoreFuncVisitor.
authorArtem Dergachev <artem.dergachev@gmail.com>
Fri, 29 Mar 2019 22:57:49 +0000 (22:57 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Fri, 29 Mar 2019 22:57:49 +0000 (22:57 +0000)
commita1923b264588a391a9b5b66669f502c515eec81f
tree5112ab94a6c03fc3f7067934b7848edaf1176192
parent8ac513b1f101fa3b1332036b4c9131dc3b88c49a
[analyzer] PR41239: Fix a crash on invalid source location in NoStoreFuncVisitor.

It turns out that SourceManager::isInSystemHeader() crashes when an invalid
source location is passed into it. Invalid source locations are relatively
common: not only they come from body farms, but also, say, any function in C
that didn't come with a forward declaration would have an implicit
forward declaration with invalid source locations.

There's a more comfy API for us to use in the Static Analyzer:
CallEvent::isInSystemHeader(), so just use that.

Differential Revision: https://reviews.llvm.org/D59901

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357329 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
test/Analysis/diagnostics/no-store-func-path-notes.c