mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	Fix C++0x narrowing errors when char is unsigned.
In the case of EDInstInfo, this would actually cause a bug when -1 became 255 and was then compared >=0 in llvm-mc/Disassembler.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138825 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -21,7 +21,7 @@ struct EDInstInfo { | |||||||
|   uint8_t       numOperands; |   uint8_t       numOperands; | ||||||
|   uint8_t       operandTypes[EDIS_MAX_OPERANDS]; |   uint8_t       operandTypes[EDIS_MAX_OPERANDS]; | ||||||
|   uint8_t       operandFlags[EDIS_MAX_OPERANDS]; |   uint8_t       operandFlags[EDIS_MAX_OPERANDS]; | ||||||
|   const char    operandOrders[EDIS_MAX_SYNTAXES][EDIS_MAX_OPERANDS]; |   const signed char operandOrders[EDIS_MAX_SYNTAXES][EDIS_MAX_OPERANDS]; | ||||||
| }; | }; | ||||||
|    |    | ||||||
| } // namespace llvm | } // namespace llvm | ||||||
|   | |||||||
| @@ -73,7 +73,7 @@ struct EDInst { | |||||||
|   std::string String; |   std::string String; | ||||||
|   /// The order in which operands from the InstInfo's operand information appear |   /// The order in which operands from the InstInfo's operand information appear | ||||||
|   /// in String |   /// in String | ||||||
|   const char* OperandOrder; |   const signed char* OperandOrder; | ||||||
|    |    | ||||||
|   /// The result of the parseOperands() function |   /// The result of the parseOperands() function | ||||||
|   CachedResult ParseResult; |   CachedResult ParseResult; | ||||||
|   | |||||||
| @@ -87,7 +87,7 @@ int EDToken::registerID(unsigned ®isterID) const { | |||||||
|  |  | ||||||
| int EDToken::tokenize(std::vector<EDToken*> &tokens, | int EDToken::tokenize(std::vector<EDToken*> &tokens, | ||||||
|                       std::string &str, |                       std::string &str, | ||||||
|                       const char *operandOrder, |                       const signed char *operandOrder, | ||||||
|                       EDDisassembler &disassembler) { |                       EDDisassembler &disassembler) { | ||||||
|   SmallVector<MCParsedAsmOperand*, 5> parsedOperands; |   SmallVector<MCParsedAsmOperand*, 5> parsedOperands; | ||||||
|   SmallVector<AsmToken, 10> asmTokens; |   SmallVector<AsmToken, 10> asmTokens; | ||||||
|   | |||||||
| @@ -125,7 +125,7 @@ struct EDToken { | |||||||
|   //                      assembly syntax |   //                      assembly syntax | ||||||
|   static int tokenize(std::vector<EDToken*> &tokens, |   static int tokenize(std::vector<EDToken*> &tokens, | ||||||
|                       std::string &str, |                       std::string &str, | ||||||
|                       const char *operandOrder, |                       const signed char *operandOrder, | ||||||
|                       EDDisassembler &disassembler); |                       EDDisassembler &disassembler); | ||||||
|    |    | ||||||
|   /// getString - Directs a character pointer to the string, returning 0 on |   /// getString - Directs a character pointer to the string, returning 0 on | ||||||
|   | |||||||
| @@ -504,8 +504,8 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) { | |||||||
|         //   .indirect_symbol _foo |         //   .indirect_symbol _foo | ||||||
|         OutStreamer.EmitSymbolAttribute(Stubs[i].second.getPointer(), |         OutStreamer.EmitSymbolAttribute(Stubs[i].second.getPointer(), | ||||||
|                                         MCSA_IndirectSymbol); |                                         MCSA_IndirectSymbol); | ||||||
|         // hlt; hlt; hlt; hlt; hlt     hlt = 0xf4 = -12. |         // hlt; hlt; hlt; hlt; hlt     hlt = 0xf4. | ||||||
|         const char HltInsts[] = { -12, -12, -12, -12, -12 }; |         const char HltInsts[] = "\xf4\xf4\xf4\xf4\xf4"; | ||||||
|         OutStreamer.EmitBytes(StringRef(HltInsts, 5), 0/*addrspace*/); |         OutStreamer.EmitBytes(StringRef(HltInsts, 5), 0/*addrspace*/); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -63,7 +63,7 @@ TEST_F(MDStringTest, PrintingSimple) { | |||||||
|  |  | ||||||
| // Test printing of MDString with non-printable characters. | // Test printing of MDString with non-printable characters. | ||||||
| TEST_F(MDStringTest, PrintingComplex) { | TEST_F(MDStringTest, PrintingComplex) { | ||||||
|   char str[5] = {0, '\n', '"', '\\', -1}; |   char str[5] = {0, '\n', '"', '\\', (char)-1}; | ||||||
|   MDString *s = MDString::get(Context, StringRef(str+0, 5)); |   MDString *s = MDString::get(Context, StringRef(str+0, 5)); | ||||||
|   std::string Str; |   std::string Str; | ||||||
|   raw_string_ostream oss(Str); |   raw_string_ostream oss(Str); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user