r302889 - Fix an assertion failure (PR33020).

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri May 12 04:24:26 PDT 2017


Author: alexfh
Date: Fri May 12 06:24:25 2017
New Revision: 302889

URL: http://llvm.org/viewvc/llvm-project?rev=302889&view=rev
Log:
Fix an assertion failure (PR33020).

Adding a test separately (tools/extra/test/clang-tidy/misc-use-after-move.cpp).

Modified:
    cfe/trunk/lib/AST/DeclCXX.cpp

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=302889&r1=302888&r2=302889&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Fri May 12 06:24:25 2017
@@ -1432,8 +1432,9 @@ bool CXXRecordDecl::isAnyDestructorNoRet
 
   // Check base classes destructor for noreturn.
   for (const auto &Base : bases())
-    if (Base.getType()->getAsCXXRecordDecl()->isAnyDestructorNoReturn())
-      return true;
+    if (const CXXRecordDecl *RD = Base.getType()->getAsCXXRecordDecl())
+      if (RD->isAnyDestructorNoReturn())
+        return true;
 
   // Check fields for noreturn.
   for (const auto *Field : fields())




More information about the cfe-commits mailing list