fix(generator): refuse --backend qt before validating --impl-class

The `backend == "qt"` refusal sat below the --impl-class / --impl-header
requirement checks, so `--backend qt` alone never reached it: it exited 1 with
"Error: --backend qt requires --impl-class <ClassName>", which reads as though
qt would work given one more flag. qt was removed; no flag rescues it.

Hoisted the refusal (and the unsupported-backend error) above those checks.
The cdylib branch returns on every path before this point, so the two checks
could only ever gate a backend that was about to be rejected anyway; they are
dropped rather than left unreachable.

`--backend qt` now exits 6 with the removal message, `--backend bogus` exits 1,
and cdylib is untouched. checks.generator-cli and checks.tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Dario Gabriel Lipicar
2026-08-19 12:44:56 -03:00
co-authored by Claude Opus 5
parent bc8fd5fa83
commit 79063d18e4
+6 -12
View File
@@ -743,18 +743,12 @@ int main(int argc, char* argv[])
return 0;
}
if (implClassIdx == -1 || implClassIdx + 1 >= args.size()) {
err << "Error: --backend " << backend << " requires --impl-class <ClassName>\n";
return 1;
}
if (implHeaderIdx == -1 || implHeaderIdx + 1 >= args.size()) {
err << "Error: --backend " << backend << " requires --impl-header <header.h>\n";
return 1;
}
QString implClass = args.at(implClassIdx + 1);
QString implHeader = args.at(implHeaderIdx + 1);
// The backend is not cdylib (that branch returned above), so the
// only thing left to do is refuse. This must come BEFORE any
// --impl-class / --impl-header validation: those flags cannot
// rescue a removed backend, and reporting them first told a user
// typing `--backend qt` that qt would work if they passed one more
// flag.
if (backend == "qt") {
err << "Error: --backend qt was removed. Qt-PLUGIN (provider) glue "
"generation moved to logos-qt-host-generator --backend cdylib "