forked from OSchip/llvm-project
A new helper function to set various bits in the class when
a new virtual function is declared/instantiated. it is used in couple of places. llvm-svn: 90470
This commit is contained in:
parent
e357d5689e
commit
6dfc1978ac
|
@ -533,6 +533,10 @@ public:
|
|||
/// [dcl.init.aggr]).
|
||||
void setAggregate(bool Agg) { Aggregate = Agg; }
|
||||
|
||||
/// setMethodAsVirtual - Make input method virtual and set the necesssary
|
||||
/// special function bits and other bits accordingly.
|
||||
void setMethodAsVirtual(FunctionDecl *Method);
|
||||
|
||||
/// isPOD - Whether this class is a POD-type (C++ [class]p4), which is a class
|
||||
/// that is an aggregate that has no non-static non-POD data members, no
|
||||
/// reference data members, no user-defined copy assignment operator and no
|
||||
|
|
|
@ -439,6 +439,18 @@ void CXXRecordDecl::addConversionFunction(FunctionTemplateDecl *ConvDecl) {
|
|||
Conversions.addDecl(ConvDecl);
|
||||
}
|
||||
|
||||
|
||||
void CXXRecordDecl::setMethodAsVirtual(FunctionDecl *Method) {
|
||||
Method->setVirtualAsWritten(true);
|
||||
setAggregate(false);
|
||||
setPOD(false);
|
||||
setEmpty(false);
|
||||
setPolymorphic(true);
|
||||
setHasTrivialConstructor(false);
|
||||
setHasTrivialCopyConstructor(false);
|
||||
setHasTrivialCopyAssignment(false);
|
||||
}
|
||||
|
||||
CXXRecordDecl *CXXRecordDecl::getInstantiatedFromMemberClass() const {
|
||||
if (MemberSpecializationInfo *MSInfo = getMemberSpecializationInfo())
|
||||
return cast<CXXRecordDecl>(MSInfo->getInstantiatedFrom());
|
||||
|
|
|
@ -2822,15 +2822,8 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
|
|||
SourceRange(D.getDeclSpec().getVirtualSpecLoc()));
|
||||
} else {
|
||||
// Okay: Add virtual to the method.
|
||||
cast<CXXMethodDecl>(NewFD)->setVirtualAsWritten(true);
|
||||
CXXRecordDecl *CurClass = cast<CXXRecordDecl>(DC);
|
||||
CurClass->setAggregate(false);
|
||||
CurClass->setPOD(false);
|
||||
CurClass->setEmpty(false);
|
||||
CurClass->setPolymorphic(true);
|
||||
CurClass->setHasTrivialConstructor(false);
|
||||
CurClass->setHasTrivialCopyConstructor(false);
|
||||
CurClass->setHasTrivialCopyAssignment(false);
|
||||
CurClass->setMethodAsVirtual(NewFD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1359,13 +1359,8 @@ TemplateDeclInstantiator::InitMethodInstantiation(CXXMethodDecl *New,
|
|||
|
||||
CXXRecordDecl *Record = cast<CXXRecordDecl>(Owner);
|
||||
New->setAccess(Tmpl->getAccess());
|
||||
if (Tmpl->isVirtualAsWritten()) {
|
||||
New->setVirtualAsWritten(true);
|
||||
Record->setAggregate(false);
|
||||
Record->setPOD(false);
|
||||
Record->setEmpty(false);
|
||||
Record->setPolymorphic(true);
|
||||
}
|
||||
if (Tmpl->isVirtualAsWritten())
|
||||
Record->setMethodAsVirtual(New);
|
||||
|
||||
// FIXME: attributes
|
||||
// FIXME: New needs a pointer to Tmpl
|
||||
|
|
Loading…
Reference in New Issue