[PATCH] D95877: [analyzer] Fix static_cast on pointer-to-member handling
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 5 00:21:21 PST 2021
vsavchenko added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp:210
+ "repeated elements");
+ BaseSpecSeen.insert(BaseType);
}
----------------
Containers like `map` and `set` usually return a pair for `insert`, where the second element tells us whether that element was inserted or was already there. It is usually a bad practice to use `find` in the vicinity of `insert` for this very reason, you double the work.
Also, a not about this whole part of the code, if it's done only for assertions, none of this code should be executed in the build without assertions. You'll need to extract this into a function that you call from assert. It means that in release builds it will be unused and should be marked with `LLVM_MAYBE_UNUSED`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95877/new/
https://reviews.llvm.org/D95877
More information about the cfe-commits
mailing list