[AsmPrinter] Replace a reachable report_fatal_error with MCContext::reportError

This commit is contained in:
Fangrui Song 2020-12-20 23:45:48 -08:00
parent 8ffda237a6
commit 1635dea266
2 changed files with 5 additions and 4 deletions

View File

@ -534,8 +534,8 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
GVSym->redefineIfPossible(); GVSym->redefineIfPossible();
if (GVSym->isDefined() || GVSym->isVariable()) if (GVSym->isDefined() || GVSym->isVariable())
report_fatal_error("symbol '" + Twine(GVSym->getName()) + OutContext.reportError(SMLoc(), "symbol '" + Twine(GVSym->getName()) +
"' is already defined"); "' is already defined");
if (MAI->hasDotTypeDotSizeDirective()) if (MAI->hasDotTypeDotSizeDirective())
OutStreamer->emitSymbolAttribute(EmittedSym, MCSA_ELF_TypeObject); OutStreamer->emitSymbolAttribute(EmittedSym, MCSA_ELF_TypeObject);

View File

@ -1,8 +1,9 @@
; RUN: not --crash llc < %s 2>&1 | FileCheck %s ; RUN: not llc -filetype=null %s 2>&1 | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu" target triple = "x86_64-unknown-linux-gnu"
module asm ".equiv var, __var" module asm ".equiv var, __var"
@var = global i32 0 @var = global i32 0
; CHECK: symbol 'var' is already defined ; CHECK: <unknown>:0: error: symbol 'var' is already defined
; CHECK: <unknown>:0: error: invalid symbol redefinition