[PATCH] D149922: Fix nullptr dereference found by Coverity static analysis tool

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 08:13:17 PDT 2023


Manna updated this revision to Diff 519868.
Manna marked an inline comment as done.

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

https://reviews.llvm.org/D149922

Files:
  clang/lib/AST/ASTContext.cpp


Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -2859,10 +2859,8 @@
   if (Ty->isPointerType())
     return true;
 
-  if (Ty->isMemberPointerType()) {
-    const auto *MPT = Ty->getAs<MemberPointerType>();
+  if (const auto *MPT = Ty->getAs<MemberPointerType>())
     return !ABI->getMemberPointerInfo(MPT).HasPadding;
-  }
 
   if (Ty->isRecordType()) {
     const RecordDecl *Record = Ty->castAs<RecordType>()->getDecl();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149922.519868.patch
Type: text/x-patch
Size: 550 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230505/cea3bbb2/attachment.bin>


More information about the cfe-commits mailing list