public DataType getDataType() {
		if (variable instanceof ClangTypeToken) {
			return ((ClangTypeToken) variable).getDataType();
		}

// not sure if we need this; the type returned here is the structure and not the
// field's type
//		if (variable instanceof ClangFieldToken) {
//			return ((ClangFieldToken) variable).getDataType();
//		}

		// Note: this is the icky part of the API.  How to know from where to get the data type?
		HighVariable highVariable = variable.getHighVariable();
		if (highVariable != null) {
			return highVariable.getDataType();
		}

		Varnode varnode = variable.getVarnode();
		DataType dataType = getDataType(varnode);
		if (dataType != null) {
			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();
		dataType = getInputDataType(op);

		if (dataType instanceof PointerDataType) {
			dataType = DecompilerReference.getBaseType(dataType);
			if (dataType instanceof VoidDataType) {
				// don't search for void
				dataType = null;
			}
		}

		if (dataType != null) {
			return dataType;
		}

		// Finally, try the output varnode
		dataType = getOutputDataType(op);
		return dataType;
	}
A base class that represents a variable from the decompiler.  This is either a variable
type or a variable with an optional field access.
Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/extension/datatype/finder/DecompilerVariable.java