ICE macros: Use '<<' for error message

Lessens the friction of using these macros.
Also allows you to add a message to TINT_UNREACHABLE(), which you couldn't do before.

Change-Id: Ida4d63ec96e1d99af71503e8b80d7a5a712e6a47
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42020
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2021-02-18 16:33:38 +00:00
committed by Commit Bot service account
parent 41085503e1
commit 3a9a55eec6
8 changed files with 78 additions and 48 deletions

View File

@@ -45,7 +45,7 @@ Module::Module(const Source& source, std::vector<CastableBase*> global_decls)
global_variables_.push_back(var);
} else {
diag::List diagnostics;
TINT_ICE(diagnostics, "Unknown global declaration type");
TINT_ICE(diagnostics) << "Unknown global declaration type";
}
}
}
@@ -108,7 +108,7 @@ void Module::Copy(CloneContext* ctx, const Module* src) {
} else if (auto* var = decl->As<Variable>()) {
AddGlobalVariable(ctx->Clone(var));
} else {
TINT_ICE(ctx->dst->Diagnostics(), "Unknown global declaration type");
TINT_ICE(ctx->dst->Diagnostics()) << "Unknown global declaration type";
}
}
}