diff options
| author | Anton Korobeynikov <asl@math.spbu.ru> | 2012-11-19 21:17:20 +0000 | 
|---|---|---|
| committer | Anton Korobeynikov <asl@math.spbu.ru> | 2012-11-19 21:17:20 +0000 | 
| commit | 097b0e9d6a8f2499617fe11059bdfbd7e136ad28 (patch) | |
| tree | a610c0eab9acc62125e6f2168a2eb8f4be59a3b9 /llvm/lib | |
| parent | 1ab34b3ad579f43f915cc3ae5c5e2d80fdd7191b (diff) | |
| download | bcm5719-llvm-097b0e9d6a8f2499617fe11059bdfbd7e136ad28.tar.gz bcm5719-llvm-097b0e9d6a8f2499617fe11059bdfbd7e136ad28.zip  | |
Make AsmPrinter::EmitTTypeReference() more robust - put
the zero GV check inside, so we won't forget it at the caller side.
llvm-svn: 168328
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/ARMException.cpp | 13 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp | 11 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp | 6 | 
3 files changed, 11 insertions, 19 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp b/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp index bbbdfd3c10f..dec80a43f66 100644 --- a/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp @@ -113,11 +113,7 @@ void ARMException::EmitTypeInfos(unsigned TTypeEncoding) {      const GlobalVariable *GV = *I;      if (VerboseAsm)        Asm->OutStreamer.AddComment("TypeInfo " + Twine(Entry--)); -    if (GV) -      Asm->EmitTTypeReference(GV, TTypeEncoding); -    else -      Asm->OutStreamer.EmitIntValue(0,Asm->GetSizeOfEncodedValue(TTypeEncoding), -                                    0); +    Asm->EmitTTypeReference(GV, TTypeEncoding);    }    // Emit the Exception Specifications. @@ -135,10 +131,7 @@ void ARMException::EmitTypeInfos(unsigned TTypeEncoding) {          Asm->OutStreamer.AddComment("FilterInfo " + Twine(Entry));      } -    if (TypeID == 0) -      Asm->OutStreamer.EmitIntValue(0,Asm->GetSizeOfEncodedValue(TTypeEncoding), -                                    0); -    else -      Asm->EmitTTypeReference(TypeInfos[TypeID - 1], TTypeEncoding);     +    Asm->EmitTTypeReference((TypeID == 0 ? 0 : TypeInfos[TypeID - 1]), +                            TTypeEncoding);    }  } diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp index b214f5a5b29..e88a7663231 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -120,11 +120,14 @@ unsigned AsmPrinter::GetSizeOfEncodedValue(unsigned Encoding) const {  }  void AsmPrinter::EmitTTypeReference(const GlobalValue *GV, unsigned Encoding)const{ -  const TargetLoweringObjectFile &TLOF = getObjFileLowering(); +  if (GV) { +    const TargetLoweringObjectFile &TLOF = getObjFileLowering(); -  const MCExpr *Exp = -    TLOF.getTTypeGlobalReference(GV, Mang, MMI, Encoding, OutStreamer); -  OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding), /*addrspace*/0); +    const MCExpr *Exp = +      TLOF.getTTypeGlobalReference(GV, Mang, MMI, Encoding, OutStreamer); +    OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding), /*addrspace*/0); +  } else +    OutStreamer.EmitIntValue(0, GetSizeOfEncodedValue(Encoding), 0);  }  /// EmitSectionOffset - Emit the 4-byte offset of Label from the start of its diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp index 4ebb75b9b80..0bcb1b5cc8f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -696,11 +696,7 @@ void DwarfException::EmitTypeInfos(unsigned TTypeEncoding) {      const GlobalVariable *GV = *I;      if (VerboseAsm)        Asm->OutStreamer.AddComment("TypeInfo " + Twine(Entry--)); -    if (GV) -      Asm->EmitTTypeReference(GV, TTypeEncoding); -    else -      Asm->OutStreamer.EmitIntValue(0,Asm->GetSizeOfEncodedValue(TTypeEncoding), -                                    0); +    Asm->EmitTTypeReference(GV, TTypeEncoding);    }    // Emit the Exception Specifications.  | 

