fix(ghidra): classify modern Swift manglings in swift type analysis (#1208)

* fix(ghidra): classify modern Swift manglings in swift type analysis

Categorize modern Swift 4.2+ manglings ($s, _$s) instead of dropping them
in analyze_swift_types. The classifier only accepted the legacy _Tt marker,
so procedure names reported by current providers produced an empty inventory.
Legacy _Tt families and behavior are unchanged. Fixes #1187.

* fix(swift): retain provider aliases and category unknowns

---------

Co-authored-by: Saim Shafique <sx4imm@gmail.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
Saim Shafique
2026-10-09 16:10:55 +08:00
committed by GitHub
co-authored by Saim Shafique morluto
parent 04a516b1e3
commit 6935dc7fe1
13 changed files with 968 additions and 31 deletions
+25 -3
View File
@@ -8,6 +8,7 @@ import type { EnhancedToolName } from "../contracts/enhancedInputs.js";
import { enhancedInputSchemas } from "../contracts/enhancedInputs.js";
import {
AnalysisCancelledError,
AnalysisCapabilityUnavailableError,
AnalysisOutputError,
} from "../domain/analysisErrorCore.js";
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
@@ -358,9 +359,30 @@ export class EnhancedTools {
signal?: AbortSignal,
): EnhancedResult {
const procedures = await this.#allAddressed("list_procedures", signal);
return procedures.ok
? ok(categorizeSwiftTypes(procedures.value, input))
: procedures;
if (!procedures.ok) return procedures;
const symbols = await this.#allAddressed("list_names", signal);
if (
!symbols.ok &&
!(symbols.error instanceof AnalysisCapabilityUnavailableError)
)
return symbols;
const result = categorizeSwiftTypes(
procedures.value,
input,
symbols.ok ? symbols.value : [],
);
return ok(
symbols.ok
? result
: {
...result,
symbol_inventory_error: projectAnalysisError(symbols.error),
limitations: [
...result.limitations,
"The provider's symbol inventory is unavailable; demangled procedures could not be joined to their Swift aliases.",
],
},
);
}
async #findXrefs(name: string, signal?: AbortSignal): EnhancedResult {