r199128 - Follow-up to r199120: don't try referencing the dtor if the param decl isn't valid.
Hans Wennborg
hans at hanshq.net
Mon Jan 13 11:24:32 PST 2014
Author: hans
Date: Mon Jan 13 13:24:31 2014
New Revision: 199128
URL: http://llvm.org/viewvc/llvm-project?rev=199128&view=rev
Log:
Follow-up to r199120: don't try referencing the dtor if the param decl isn't valid.
This was caught by running test/SemaCXX/destructor.cpp in MS ABI mode.
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=199128&r1=199127&r2=199128&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Jan 13 13:24:31 2014
@@ -6246,14 +6246,16 @@ bool Sema::CheckParmsForFunctionDef(Parm
if (getLangOpts().CPlusPlus && Context.getTargetInfo()
.getCXXABI()
.areArgsDestroyedLeftToRightInCallee()) {
- if (const RecordType *RT = Param->getType()->getAs<RecordType>()) {
- CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(RT->getDecl());
- if (!ClassDecl->isInvalidDecl() &&
- !ClassDecl->hasIrrelevantDestructor() &&
- !ClassDecl->isDependentContext()) {
- CXXDestructorDecl *Destructor = LookupDestructor(ClassDecl);
- MarkFunctionReferenced(Param->getLocation(), Destructor);
- DiagnoseUseOfDecl(Destructor, Param->getLocation());
+ if (!Param->isInvalidDecl()) {
+ if (const RecordType *RT = Param->getType()->getAs<RecordType>()) {
+ CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(RT->getDecl());
+ if (!ClassDecl->isInvalidDecl() &&
+ !ClassDecl->hasIrrelevantDestructor() &&
+ !ClassDecl->isDependentContext()) {
+ CXXDestructorDecl *Destructor = LookupDestructor(ClassDecl);
+ MarkFunctionReferenced(Param->getLocation(), Destructor);
+ DiagnoseUseOfDecl(Destructor, Param->getLocation());
+ }
}
}
}
More information about the cfe-commits
mailing list