Add support for parsing C++11 =delete and =default
Although this was documented as working, it wasn't implemented %typemap(default) failed without the idstring changes Add some C tests using the C++ keyword delete
This commit is contained in:
parent
5e6fb595dd
commit
e566c5fa7f
8 changed files with 173 additions and 31 deletions
|
|
@ -659,7 +659,7 @@ Allocate():
|
|||
}
|
||||
|
||||
if (!Getattr(n, "allocate:has_destructor")) {
|
||||
/* No destructor was defined. We need to check a few things here too */
|
||||
/* No destructor was defined */
|
||||
List *bases = Getattr(n, "allbases");
|
||||
int allows_destruct = 1;
|
||||
|
||||
|
|
@ -676,13 +676,13 @@ Allocate():
|
|||
}
|
||||
|
||||
if (!Getattr(n, "allocate:has_assign")) {
|
||||
/* No destructor was defined. We need to check a few things here too */
|
||||
/* No assignment operator was defined */
|
||||
List *bases = Getattr(n, "allbases");
|
||||
int allows_assign = 1;
|
||||
|
||||
for (int i = 0; i < Len(bases); i++) {
|
||||
Node *n = Getitem(bases, i);
|
||||
/* If base class does not allow default destructor, we don't allow it either */
|
||||
/* If base class does not allow assignment, we don't allow it either */
|
||||
if (Getattr(n, "allocate:has_assign")) {
|
||||
allows_assign = !Getattr(n, "allocate:noassign");
|
||||
}
|
||||
|
|
@ -693,13 +693,13 @@ Allocate():
|
|||
}
|
||||
|
||||
if (!Getattr(n, "allocate:has_new")) {
|
||||
/* No destructor was defined. We need to check a few things here too */
|
||||
/* No new operator was defined */
|
||||
List *bases = Getattr(n, "allbases");
|
||||
int allows_new = 1;
|
||||
|
||||
for (int i = 0; i < Len(bases); i++) {
|
||||
Node *n = Getitem(bases, i);
|
||||
/* If base class does not allow default destructor, we don't allow it either */
|
||||
/* If base class does not allow new operator, we don't allow it either */
|
||||
if (Getattr(n, "allocate:has_new")) {
|
||||
allows_new = !Getattr(n, "allocate:nonew");
|
||||
}
|
||||
|
|
@ -779,18 +779,26 @@ Allocate():
|
|||
if (cplus_mode != PUBLIC) {
|
||||
if (Strcmp(name, "operator =") == 0) {
|
||||
/* Look for a private assignment operator */
|
||||
Setattr(inclass, "allocate:has_assign", "1");
|
||||
if (!GetFlag(n, "deleted"))
|
||||
Setattr(inclass, "allocate:has_assign", "1");
|
||||
Setattr(inclass, "allocate:noassign", "1");
|
||||
} else if (Strcmp(name, "operator new") == 0) {
|
||||
/* Look for a private new operator */
|
||||
Setattr(inclass, "allocate:has_new", "1");
|
||||
if (!GetFlag(n, "deleted"))
|
||||
Setattr(inclass, "allocate:has_new", "1");
|
||||
Setattr(inclass, "allocate:nonew", "1");
|
||||
}
|
||||
} else {
|
||||
if (Strcmp(name, "operator =") == 0) {
|
||||
Setattr(inclass, "allocate:has_assign", "1");
|
||||
if (!GetFlag(n, "deleted"))
|
||||
Setattr(inclass, "allocate:has_assign", "1");
|
||||
else
|
||||
Setattr(inclass, "allocate:noassign", "1");
|
||||
} else if (Strcmp(name, "operator new") == 0) {
|
||||
Setattr(inclass, "allocate:has_new", "1");
|
||||
if (!GetFlag(n, "deleted"))
|
||||
Setattr(inclass, "allocate:has_new", "1");
|
||||
else
|
||||
Setattr(inclass, "allocate:nonew", "1");
|
||||
}
|
||||
/* Look for smart pointer operator */
|
||||
if ((Strcmp(name, "operator ->") == 0) && (!GetFlag(n, "feature:ignore"))) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue