aaron.ballman added inline comments.

================
Comment at: clang/lib/Sema/SemaChecking.cpp:10320
+
+  const clang::CastKind Kind = Cast->getCastKind();
+  if (Kind == clang::CK_BitCast &&
----------------
We don't typically use top-level `const` on locals or params.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:10326
+      !isa<IntegerLiteral>(
+          Cast->getSubExpr()->IgnoreImplicitAsWritten()->IgnoreParens()))
+    return;
----------------
I'm not 100% certain, but would `IgnoreParenImpCasts()` be sufficient here? 
(`IgnoreImplicitAsWritten() seems to be a bit special -- the only use of it I 
can find in tree is for rewritten binary operator expressions.)


================
Comment at: clang/test/Analysis/free.cpp:221
+void t18b (S s) {
+  std::free((void*)(unsigned long long)s.p); // no warning
+}
----------------
I think it'd be useful to add tests for named casts as well as the C-style 
casts.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97512/new/

https://reviews.llvm.org/D97512

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to