aboutsummaryrefslogtreecommitdiffstats
path: root/abstractmetalang.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-03-25 12:56:05 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:09:58 -0300
commit02f68822d7cfa18d44d484ea156618701601c3e2 (patch)
tree5b81d4bf965ab8e56d3e5dfceabe8d0f396aa6a4 /abstractmetalang.cpp
parentafc91022a1ef73ecc47fc04fe9a49862b5052605 (diff)
Fixes attributes for default constructors and class' "isPolymorphic" flag.
When a class has no constructor explicitly declared a default is provided by API Extractor, but it should be marked as "Final". The setting of the "isPolymorphic" flag done in the AbstractMetaClass::addFunction method must take into account if the class has a virtual destructor, as it is done in the AbstractMetaClass::setFunctions method. The already existing tests cover the cases affected by the changes.
Diffstat (limited to 'abstractmetalang.cpp')
-rw-r--r--abstractmetalang.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/abstractmetalang.cpp b/abstractmetalang.cpp
index b9a15d42..66610171 100644
--- a/abstractmetalang.cpp
+++ b/abstractmetalang.cpp
@@ -1270,8 +1270,8 @@ void AbstractMetaClass::setFunctions(const AbstractMetaFunctionList &functions)
f->setOwnerClass(this);
m_hasVirtualSlots = m_hasVirtualSlots || f->isVirtualSlot();
- m_hasVirtuals = m_hasVirtuals || !f->isFinal() || f->isVirtualSlot();
- m_isPolymorphic = m_isPolymorphic || m_hasVirtuals || hasVirtualDestructor();
+ m_hasVirtuals = m_hasVirtuals || !f->isFinal() || f->isVirtualSlot() || hasVirtualDestructor();
+ m_isPolymorphic = m_isPolymorphic || m_hasVirtuals;
m_hasNonpublic = m_hasNonpublic || !f->isPublic();
// If we have non-virtual overloads of a virtual function, we have to implement
@@ -1327,7 +1327,7 @@ void AbstractMetaClass::addFunction(AbstractMetaFunction *function)
m_functions << function;
m_hasVirtualSlots |= function->isVirtualSlot();
- m_hasVirtuals |= !function->isFinal() || function->isVirtualSlot();
+ m_hasVirtuals |= !function->isFinal() || function->isVirtualSlot() || hasVirtualDestructor();
m_isPolymorphic |= m_hasVirtuals;
m_hasNonpublic |= !function->isPublic();
}
@@ -1563,6 +1563,7 @@ void AbstractMetaClass::addDefaultConstructor()
uint attr = AbstractMetaAttributes::Native;
attr |= AbstractMetaAttributes::Public;
+ attr |= AbstractMetaAttributes::Final;
f->setAttributes(attr);
f->setImplementingClass(this);
f->setOriginalAttributes(f->attributes());