Fix -Wdynamic-class-memaccess to skip invalid classes.

This warning sometimes will infinitely recurse on CXXRecordDecl's from
ill-formed recursive classes that have fields of themselves.  Skip processing
these classes to prevent this from happening.
Fixes https://llvm.org/bugs/show_bug.cgi?id=27142

llvm-svn: 264991
This commit is contained in:
Richard Trieu
2016-03-31 04:18:07 +00:00
parent 936a2b09f3
commit 1c7237ae61
2 changed files with 14 additions and 1 deletions

View File

@@ -5611,7 +5611,7 @@ static const CXXRecordDecl *getContainedDynamicClass(QualType T,
const CXXRecordDecl *RD = Ty->getAsCXXRecordDecl();
RD = RD ? RD->getDefinition() : nullptr;
if (!RD)
if (!RD || RD->isInvalidDecl())
return nullptr;
if (RD->isDynamicClass())