kfdtest: Check for NULL at MCABackend creation

The function can return NULL if it fails to create the backend, so check
for NULL before using it.

Change-Id: I4d6501bffd6dd0fc0d0f2224720f7d6dca1646f3
Signed-off-by: Kent Russell <kent.russell@amd.com>
Этот коммит содержится в:
Kent Russell
2024-09-03 08:30:09 -04:00
родитель 7e13b9e62f
Коммит 545467be04
+5
Просмотреть файл
@@ -350,6 +350,11 @@ int Assembler::RunAssemble(const char* const AssemblySource) {
#endif
MCAsmBackend* MAB = TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions);
if (!MAB) {
outs() << "ASM Error: Unable to create MCA Backend\n";
return -1;
}
std::unique_ptr<MCStreamer> Streamer(TheTarget->createMCObjectStreamer(
TheTriple, Ctx,
std::unique_ptr<MCAsmBackend>(MAB), MAB->createObjectWriter(*OS),