llvm.org GIT mirror llvm / cda2a14
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 Jeffrey Yasskin 9 years ago
6 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
2020 uint8_t numOperands;
2121 uint8_t operandTypes[EDIS_MAX_OPERANDS];
2222 uint8_t operandFlags[EDIS_MAX_OPERANDS];
23 const char operandOrders[EDIS_MAX_SYNTAXES][EDIS_MAX_OPERANDS];
23 const signed char operandOrders[EDIS_MAX_SYNTAXES][EDIS_MAX_OPERANDS];
2424 };
2525
2626 } // namespace llvm
7272 std::string String;
7373 /// The order in which operands from the InstInfo's operand information appear
7474 /// in String
75 const char* OperandOrder;
75 const signed char* OperandOrder;
7676
7777 /// The result of the parseOperands() function
7878 CachedResult ParseResult;
8686
8787 int EDToken::tokenize(std::vector &tokens,
8888 std::string &str,
89 const char *operandOrder,
89 const signed char *operandOrder,
9090 EDDisassembler &disassembler) {
9191 SmallVector parsedOperands;
9292 SmallVector asmTokens;
124124 // assembly syntax
125125 static int tokenize(std::vector &tokens,
126126 std::string &str,
127 const char *operandOrder,
127 const signed char *operandOrder,
128128 EDDisassembler &disassembler);
129129
130130 /// getString - Directs a character pointer to the string, returning 0 on
503503 // .indirect_symbol _foo
504504 OutStreamer.EmitSymbolAttribute(Stubs[i].second.getPointer(),
505505 MCSA_IndirectSymbol);
506 // hlt; hlt; hlt; hlt; hlt hlt = 0xf4 = -12.
507 const char HltInsts[] = { -12, -12, -12, -12, -12 };
506 // hlt; hlt; hlt; hlt; hlt hlt = 0xf4.
507 const char HltInsts[] = "\xf4\xf4\xf4\xf4\xf4";
508508 OutStreamer.EmitBytes(StringRef(HltInsts, 5), 0/*addrspace*/);
509509 }
510510
6262
6363 // Test printing of MDString with non-printable characters.
6464 TEST_F(MDStringTest, PrintingComplex) {
65 char str[5] = {0, '\n', '"', '\\', -1};
65 char str[5] = {0, '\n', '"', '\\', (char)-1};
6666 MDString *s = MDString::get(Context, StringRef(str+0, 5));
6767 std::string Str;
6868 raw_string_ostream oss(Str);