[cfe-commits] r90470 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaTemplateInstantiateDecl.cpp
Fariborz Jahanian
fjahanian at apple.com
Thu Dec 3 10:44:40 PST 2009
Author: fjahanian
Date: Thu Dec 3 12:44:40 2009
New Revision: 90470
URL: http://llvm.org/viewvc/llvm-project?rev=90470&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=90470&r1=90469&r2=90470&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Dec 3 12:44:40 2009
@@ -533,6 +533,10 @@
/// [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
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=90470&r1=90469&r2=90470&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Thu Dec 3 12:44:40 2009
@@ -439,6 +439,18 @@
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());
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=90470&r1=90469&r2=90470&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Dec 3 12:44:40 2009
@@ -2822,15 +2822,8 @@
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);
}
}
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=90470&r1=90469&r2=90470&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu Dec 3 12:44:40 2009
@@ -1359,13 +1359,8 @@
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
More information about the cfe-commits
mailing list