[all-commits] [llvm/llvm-project] 8a40f8: [clang][analyzer][NFC] Replace dyn_cast with cast ...
Dmitri Gribenko via All-commits
all-commits at lists.llvm.org
Tue May 30 09:30:46 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8a40f89e2e9357539db0f9a119db0fcfc77232ab
https://github.com/llvm/llvm-project/commit/8a40f89e2e9357539db0f9a119db0fcfc77232ab
Author: Dmitri Gribenko <gribozavr at gmail.com>
Date: 2023-05-30 (Tue, 30 May 2023)
Changed paths:
M clang/lib/StaticAnalyzer/Core/MemRegion.cpp
Log Message:
-----------
[clang][analyzer][NFC] Replace dyn_cast with cast in MemRegion::getMemorySpace
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.
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D151727
More information about the All-commits
mailing list