r353556 - Pass the base element type of an array type to the visit method instead

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 8 11:46:53 PST 2019


Author: ahatanak
Date: Fri Feb  8 11:46:53 2019
New Revision: 353556

URL: http://llvm.org/viewvc/llvm-project?rev=353556&view=rev
Log:
Pass the base element type of an array type to the visit method instead
of the array type itself.

This fixes a bug found by inspection that was introduced in r353459. I
don't have a test case for this since we don't yet have types that would
make the containing C struct non-trivial to copy/move but wouldn't make
it non-trivial to default-initialize or destruct.

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

Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=353556&r1=353555&r2=353556&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Fri Feb  8 11:46:53 2019
@@ -2258,7 +2258,7 @@ struct IsNonTrivialCopyMoveVisitor
 
   bool visitWithKind(QualType::PrimitiveCopyKind PCK, QualType QT) {
     if (const auto *AT = this->Ctx.getAsArrayType(QT))
-      return this->asDerived().visit(QualType(AT, 0));
+      return this->asDerived().visit(Ctx.getBaseElementType(AT));
     return Super::visitWithKind(PCK, QT);
   }
 




More information about the cfe-commits mailing list