From 7504cefa1431705e1db5d89d448359fe167d8fad Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Mon, 18 Mar 2013 17:03:05 +0000 Subject: [PATCH] Fix integer comparison in DIEInteger::BestForm. The always-true "(int)Int == (signed)Int" comparison was found while experimenting with a potential new Clang warning. llvm-svn: 177290 --- llvm/lib/CodeGen/AsmPrinter/DIE.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.h b/llvm/lib/CodeGen/AsmPrinter/DIE.h index 9907b01ceb6a..d087c540f2c4 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DIE.h +++ b/llvm/lib/CodeGen/AsmPrinter/DIE.h @@ -235,9 +235,10 @@ namespace llvm { /// static unsigned BestForm(bool IsSigned, uint64_t Int) { if (IsSigned) { - if ((char)Int == (signed)Int) return dwarf::DW_FORM_data1; - if ((short)Int == (signed)Int) return dwarf::DW_FORM_data2; - if ((int)Int == (signed)Int) return dwarf::DW_FORM_data4; + const int64_t SignedInt = Int; + if ((char)Int == SignedInt) return dwarf::DW_FORM_data1; + if ((short)Int == SignedInt) return dwarf::DW_FORM_data2; + if ((int)Int == SignedInt) return dwarf::DW_FORM_data4; } else { if ((unsigned char)Int == Int) return dwarf::DW_FORM_data1; if ((unsigned short)Int == Int) return dwarf::DW_FORM_data2;