GP-4592 Find references to structure fields in local variables and in

functions that call externals that might use the structure field
This commit is contained in:
emteere 2024-05-10 14:02:09 -04:00
parent 15b929fa73
commit dea69c7027
2 changed files with 16 additions and 2 deletions

View File

@ -129,6 +129,20 @@ public class DecompilerDataTypeReferenceFinder implements DataTypeReferenceFinde
callers.addAll(callingFunctions);
}
results.addAll(callers);
// Add any callers to external function that use any form of the data type
it = listing.getExternalFunctions();
callers = new HashSet<>();
for (Function f : it) {
monitor.checkCancelled();
if (usesAnyType(f, types)) {
Set<Function> callingFunctions = f.getCallingFunctions(monitor);
callers.addAll(callingFunctions);
}
}
results.addAll(callers);
return results;

View File

@ -188,11 +188,11 @@ public class VariableAccessDR extends DecompilerReference {
// the thing that contains it. So, if you have:
// foo.bar
// then the 'bar' field will have a data type of Foo. Unfortunately, this is not always
// the case. For now, when the variable is global, we need to check the field. Sad face
// the case. For now, if there is a high variable, we need to check the field. Sad face
// emoji.
//
HighVariable highVariable = var.variable.getHighVariable();
if (highVariable instanceof HighGlobal) {
if (highVariable != null) {
if (matchesParentType(potentialField, dt)) {
DtrfDbg.println(this, indent + "MATCHED on parent type: " + dt);
return potentialField;