Apply patch #3066958 from Mikael Johansson to fix default smart pointer handling when the smart pointer contains both a const and non-const operator->.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12240 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
766ed8db37
commit
3219746776
9 changed files with 343 additions and 12 deletions
|
|
@ -824,9 +824,12 @@ Allocate():
|
|||
int isconst = 0;
|
||||
Delete(SwigType_pop(type));
|
||||
if (SwigType_isconst(type)) {
|
||||
isconst = 1;
|
||||
isconst = !Getattr(inclass, "allocate:smartpointermutable");
|
||||
Setattr(inclass, "allocate:smartpointerconst", "1");
|
||||
}
|
||||
else {
|
||||
Setattr(inclass, "allocate:smartpointermutable", "1");
|
||||
}
|
||||
List *methods = smart_pointer_methods(sc, 0, isconst);
|
||||
Setattr(inclass, "allocate:smartpointer", methods);
|
||||
Setattr(inclass, "allocate:smartpointerbase", base);
|
||||
|
|
@ -834,7 +837,6 @@ Allocate():
|
|||
/* Hmmm. The return value is not a pointer. If the type is a value
|
||||
or reference. We're going to chase it to see if another operator->()
|
||||
can be found */
|
||||
|
||||
if ((SwigType_check_decl(type, "")) || (SwigType_check_decl(type, "r."))) {
|
||||
Node *nn = Swig_symbol_clookup((char *) "operator ->", Getattr(sc, "symtab"));
|
||||
if (nn) {
|
||||
|
|
|
|||
|
|
@ -1344,7 +1344,7 @@ int Language::variableHandler(Node *n) {
|
|||
Swig_save("variableHandler", n, "feature:immutable", NIL);
|
||||
if (SmartPointer) {
|
||||
/* If a smart-pointer and it's a constant access, we have to set immutable */
|
||||
if (Getattr(CurrentClass, "allocate:smartpointerconst")) {
|
||||
if (!Getattr(CurrentClass, "allocate:smartpointermutable")) {
|
||||
SetFlag(n, "feature:immutable");
|
||||
}
|
||||
}
|
||||
|
|
@ -1391,7 +1391,7 @@ int Language::membervariableHandler(Node *n) {
|
|||
int assignable = is_assignable(n);
|
||||
|
||||
if (SmartPointer) {
|
||||
if (Getattr(CurrentClass, "allocate:smartpointerconst")) {
|
||||
if (!Getattr(CurrentClass, "allocate:smartpointermutable")) {
|
||||
assignable = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -2443,6 +2443,9 @@ int Language::classHandler(Node *n) {
|
|||
List *methods = Getattr(n, "allocate:smartpointer");
|
||||
cplus_mode = PUBLIC;
|
||||
SmartPointer = CWRAP_SMART_POINTER;
|
||||
if (Getattr(n, "allocate:smartpointerconst") && Getattr(n, "allocate:smartpointermutable")) {
|
||||
SmartPointer |= CWRAP_SMART_POINTER_OVERLOAD;
|
||||
}
|
||||
Iterator c;
|
||||
for (c = First(methods); c.item; c = Next(c)) {
|
||||
emit_one(c.item);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue