Use the code written for -fvirtual to gather information about virtual methods needed for C#.
The code written for -fvirtual is largely replicated in the code for directors and ought to be consolidated; they both are constructing vtables of sorts.
Both approaches also need fixing for when the virtual keyword is not used, eg
class Base {
virtual void foo();
virtual void bar();
};
class Derived : public Base {
virtual void foo();
void bar();
};
Neither currently detects bar as a virtual method.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4525 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5e04ac087a
commit
17c8b86ba9
1 changed files with 7 additions and 5 deletions
|
|
@ -91,7 +91,9 @@ class Allocate : public Dispatcher {
|
||||||
(checkAttribute(temp, "name", name)) &&
|
(checkAttribute(temp, "name", name)) &&
|
||||||
(checkAttribute(temp, "type", type)) &&
|
(checkAttribute(temp, "type", type)) &&
|
||||||
(!Strcmp(local_decl, base_decl)) ) {
|
(!Strcmp(local_decl, base_decl)) ) {
|
||||||
Setattr(c, "Tiger: defined_in_base", "1");
|
// Indicate a virtual method in the derived class, that is, not the virtual method definition in a base class
|
||||||
|
Setattr(c, "virtual:derived", "1");
|
||||||
|
if (virtual_elimination_mode)
|
||||||
Setattr(c, "feature:ignore", "1");
|
Setattr(c, "feature:ignore", "1");
|
||||||
Delete(base_decl);
|
Delete(base_decl);
|
||||||
Delete(local_decl);
|
Delete(local_decl);
|
||||||
|
|
@ -111,6 +113,7 @@ class Allocate : public Dispatcher {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function not used
|
||||||
/* Checks if a class has the same virtual functions as the bases have */
|
/* Checks if a class has the same virtual functions as the bases have */
|
||||||
int class_is_defined_in_bases(Node *n) {
|
int class_is_defined_in_bases(Node *n) {
|
||||||
Node *c, *bases; /* bases is the closest ancestors of class n */
|
Node *c, *bases; /* bases is the closest ancestors of class n */
|
||||||
|
|
@ -470,7 +473,6 @@ public:
|
||||||
|
|
||||||
if (inclass) {
|
if (inclass) {
|
||||||
/* check whether the member node n is defined in class node inclass's bases */
|
/* check whether the member node n is defined in class node inclass's bases */
|
||||||
if (virtual_elimination_mode)
|
|
||||||
if (checkAttribute(n, "storage", "virtual"))
|
if (checkAttribute(n, "storage", "virtual"))
|
||||||
class_member_is_defined_in_bases(n, inclass);
|
class_member_is_defined_in_bases(n, inclass);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue