[llvm-branch-commits] [llvm] 1635dea - [AsmPrinter] Replace a reachable report_fatal_error with MCContext::reportError

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Dec 20 23:49:55 PST 2020


Author: Fangrui Song
Date: 2020-12-20T23:45:49-08:00
New Revision: 1635dea266cc600bd8c8d99e75b60a3c2e27bd2c

URL: https://github.com/llvm/llvm-project/commit/1635dea266cc600bd8c8d99e75b60a3c2e27bd2c
DIFF: https://github.com/llvm/llvm-project/commit/1635dea266cc600bd8c8d99e75b60a3c2e27bd2c.diff

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/test/CodeGen/X86/equiv_with_vardef.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index b7ab796272e7..7f7ea18e72b8 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -534,8 +534,8 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
 
   GVSym->redefineIfPossible();
   if (GVSym->isDefined() || GVSym->isVariable())
-    report_fatal_error("symbol '" + Twine(GVSym->getName()) +
-                       "' is already defined");
+    OutContext.reportError(SMLoc(), "symbol '" + Twine(GVSym->getName()) +
+                                        "' is already defined");
 
   if (MAI->hasDotTypeDotSizeDirective())
     OutStreamer->emitSymbolAttribute(EmittedSym, MCSA_ELF_TypeObject);

diff  --git a/llvm/test/CodeGen/X86/equiv_with_vardef.ll b/llvm/test/CodeGen/X86/equiv_with_vardef.ll
index e5ea3673b6d7..11adcb8610a5 100644
--- a/llvm/test/CodeGen/X86/equiv_with_vardef.ll
+++ b/llvm/test/CodeGen/X86/equiv_with_vardef.ll
@@ -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 triple = "x86_64-unknown-linux-gnu"
 
 module asm ".equiv var, __var"
 
 @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


        


More information about the llvm-branch-commits mailing list