[PATCH] D156274: [NFC] Avoid potential dereferencing of nullptr.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 26 06:20:29 PDT 2023


aaron.ballman added subscribers: efriedma, rjmccall.
aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/ItaniumMangle.cpp:1659
       mangleCXXDtorType(Dtor_Complete);
+    assert(ND);
     writeAbiTags(ND, AdditionalAbiTags);
----------------
This seems incorrect -- if the declaration name is a destructor, then `ND` should always be null, right?


================
Comment at: clang/lib/CodeGen/CGObjCMac.cpp:1806
     // Complex types.
+    assert(contBB);
     CGF.EmitBlock(contBB);
----------------
Hmmm, is assert the correct approach here? It seems to me that a Complex rvalue will trigger this assertion. I think this deserves some additional thinking rather than silencing the static analysis warning. CC @efriedma @rjmccall who might have ideas.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156274



More information about the cfe-commits mailing list