[analyzer] Use Optional as a return type of StoreManager::castRegion
authorDenys Petrov <dpetrov@accesssoftek.com>
Fri, 28 May 2021 13:52:44 +0000 (16:52 +0300)
committerDenys Petrov <dpetrov@accesssoftek.com>
Sat, 29 May 2021 12:16:56 +0000 (15:16 +0300)
commitfae3534b3056bb96d26a6d1b6e7d6a2ccaf4fab1
tree180bbc8057dcb58ac5e3613fd484e109ec67e105
parentc123c178b26ea38a1035093edfa430256bfd1e64
[analyzer]  Use Optional as a return type of StoreManager::castRegion

Summary: Make StoreManager::castRegion function usage safier. Replace `const MemRegion *` with `Optional<const MemRegion *>`. Simplified one of related test cases due to suggestions in D101635.

Differential Revision: https://reviews.llvm.org/D103319
clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
clang/lib/StaticAnalyzer/Core/Store.cpp
clang/test/Analysis/casts.c