[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 08:09:47 PST 2021


vsavchenko added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp:180
 
+bool noRepeatedElements(
+    const llvm::ImmutableList<const CXXBaseSpecifier *> &BaseSpecList) {
----------------
RedDocMD wrote:
> vsavchenko wrote:
> > nit: functions represent actions, in languages verbs act the same way, so it's recommended to use verbs in functions (`hasNoRepeatedElements`)
> > 
> > + `LLVM_MAYBE_UNUSED` because in the build without assertions it would be a warning otherwise.
> > nit: functions represent actions, in languages verbs act the same way, so it's recommended to use verbs in functions (`hasNoRepeatedElements`)
> > 
> > + `LLVM_MAYBE_UNUSED` because in the build without assertions it would be a warning otherwise.
> 
> How do I put in the LLVM_MAYBE_UNUSED? Sorry for being annoying, but ripgrepping or Googling didn't return anything.
Sorry, my bad, it's `LLVM_ATTRIBUTE_UNUSED`


================
Comment at: clang/test/Analysis/pointer-to-member.cpp:314-333
+// namespace testReinterpretCasting {
+// struct Base {
+//   int field;
+// };
+//
+// struct Derived : public Base {};
+//
----------------
RedDocMD wrote:
> vsavchenko wrote:
> > Uncomment it, and expect the actual current result.  This is where `TODO` will come in handy.
> > Uncomment it, and expect the actual current result.  This is where `TODO` will come in handy.
> Will do it.
> Just one clarification: the static analyzer tests only serve to check whether the Static Analyzer crashes or hits an assertion error, or is it something more?
> 
Mostly they check for reported results, you can see special comments like `// expect-warning{...}` in almost every test.


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