Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-0: SwiftDemangler fix for ArgumentTuple vs Tuple

Ryan Kurtz2f6e25e19b52
diff --git a/Ghidra/Features/SwiftDemangler/src/main/java/ghidra/app/util/demangler/swift/nodes/SwiftTupleNode.java b/Ghidra/Features/SwiftDemangler/src/main/java/ghidra/app/util/demangler/swift/nodes/SwiftTupleNode.java
index 7e416c5a75..a089f49342 100644
--- a/Ghidra/Features/SwiftDemangler/src/main/java/ghidra/app/util/demangler/swift/nodes/SwiftTupleNode.java
+++ b/Ghidra/Features/SwiftDemangler/src/main/java/ghidra/app/util/demangler/swift/nodes/SwiftTupleNode.java
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,6 +21,7 @@ import java.util.List;
import ghidra.app.util.demangler.*;
import ghidra.app.util.demangler.swift.SwiftDemangledNodeKind;
import ghidra.app.util.demangler.swift.SwiftDemangler;
+import ghidra.app.util.demangler.swift.datatypes.SwiftTuple;
/**
* A {@link SwiftDemangledNodeKind#Tuple} {@link SwiftNode}
@@ -40,6 +41,17 @@ public class SwiftTupleNode extends SwiftNode {
break;
}
}
- return new DemangledList(elements);
+
+ // Argument tuples should be treated as a list of items instead of a tuple data type
+ SwiftNode parent = getParent();
+ if (parent != null) {
+ parent = parent.getParent();
+ if (parent != null && parent.getKind().equals(SwiftDemangledNodeKind.ArgumentTuple)) {
+ return new DemangledList(elements);
+ }
+ }
+
+ return new SwiftTuple(properties.mangled(), properties.originalDemangled(),
+ new DemangledList(elements), demangler);
}
}