[PATCH] D88949: DeferredDiagnosticsEmitter crashes

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 08:45:33 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb9225543e844: DeferredDiagnosticsEmitter crashes (authored by glevner, committed by yaxunl).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88949

Files:
  clang/lib/Sema/UsedDeclVisitor.h


Index: clang/lib/Sema/UsedDeclVisitor.h
===================================================================
--- clang/lib/Sema/UsedDeclVisitor.h
+++ clang/lib/Sema/UsedDeclVisitor.h
@@ -67,10 +67,13 @@
   void VisitCXXDeleteExpr(CXXDeleteExpr *E) {
     if (E->getOperatorDelete())
       asImpl().visitUsedDecl(E->getBeginLoc(), E->getOperatorDelete());
-    QualType Destroyed = S.Context.getBaseElementType(E->getDestroyedType());
-    if (const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
-      CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
-      asImpl().visitUsedDecl(E->getBeginLoc(), S.LookupDestructor(Record));
+    QualType DestroyedOrNull = E->getDestroyedType();
+    if (!DestroyedOrNull.isNull()) {
+      QualType Destroyed = S.Context.getBaseElementType(DestroyedOrNull);
+      if (const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
+        CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
+        asImpl().visitUsedDecl(E->getBeginLoc(), S.LookupDestructor(Record));
+      }
     }
 
     Inherited::VisitCXXDeleteExpr(E);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88949.296981.patch
Type: text/x-patch
Size: 1125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201008/eb185f4d/attachment.bin>


More information about the cfe-commits mailing list