gribozavr created this revision. gribozavr added a reviewer: NoQ. Herald added subscribers: steakhal, martong. Herald added a project: All. gribozavr requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
MemRegion::getMemorySpace() is annotated with LLVM_ATTRIBUTE_RETURNS_NONNULL (which triggers instant UB if a null pointer is returned), and callers indeed don't check the return value for null. Thus, even though llvm::dyn_cast is called, it can never return null in this context. Therefore, we can safely call llvm::cast. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D151727 Files: clang/lib/StaticAnalyzer/Core/MemRegion.cpp Index: clang/lib/StaticAnalyzer/Core/MemRegion.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -1283,7 +1283,7 @@ SR = dyn_cast<SubRegion>(R); } - return dyn_cast<MemSpaceRegion>(R); + return cast<MemSpaceRegion>(R); } bool MemRegion::hasStackStorage() const {
Index: clang/lib/StaticAnalyzer/Core/MemRegion.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -1283,7 +1283,7 @@ SR = dyn_cast<SubRegion>(R); } - return dyn_cast<MemSpaceRegion>(R); + return cast<MemSpaceRegion>(R); } bool MemRegion::hasStackStorage() const {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits