Skip to content

Ghidra is a software reverse engineering (SRE) framework

Tests - fixed test failing due to recent Decompiler changes

dragonmacher06a88e0c634b
diff --git a/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/extension/datatype/finder/DecompilerVariable.java b/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/extension/datatype/finder/DecompilerVariable.java
index e20b59157d..576b92fd30 100644
--- a/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/extension/datatype/finder/DecompilerVariable.java
+++ b/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/extension/datatype/finder/DecompilerVariable.java
@@ -63,6 +63,16 @@ public abstract class DecompilerVariable {
return dataType;
}
+ // The parent variable declaration node has the type
+ ClangNode parent = variable.Parent();
+ if (parent instanceof ClangVariableDecl) {
+ ClangVariableDecl decl = (ClangVariableDecl) parent;
+ dataType = decl.getDataType();
+ if (dataType != null) {
+ return dataType;
+ }
+ }
+
// Prefer the type of the first input varnode, unless that type is a 'void *'.
// Usually, in that special case, the output varnode has the correct type information.
PcodeOp op = variable.getPcodeOp();