mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 22:20:37 +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:
parent
2ac6b01854
commit
cda2a146d1
@ -21,7 +21,7 @@ struct EDInstInfo {
|
||||
uint8_t numOperands;
|
||||
uint8_t operandTypes[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
|
||||
|
@ -73,7 +73,7 @@ struct EDInst {
|
||||
std::string String;
|
||||
/// The order in which operands from the InstInfo's operand information appear
|
||||
/// in String
|
||||
const char* OperandOrder;
|
||||
const signed char* OperandOrder;
|
||||
|
||||
/// The result of the parseOperands() function
|
||||
CachedResult ParseResult;
|
||||
|
@ -87,7 +87,7 @@ int EDToken::registerID(unsigned ®isterID) const {
|
||||
|
||||
int EDToken::tokenize(std::vector<EDToken*> &tokens,
|
||||
std::string &str,
|
||||
const char *operandOrder,
|
||||
const signed char *operandOrder,
|
||||
EDDisassembler &disassembler) {
|
||||
SmallVector<MCParsedAsmOperand*, 5> parsedOperands;
|
||||
SmallVector<AsmToken, 10> asmTokens;
|
||||
|
@ -125,7 +125,7 @@ struct EDToken {
|
||||
// assembly syntax
|
||||
static int tokenize(std::vector<EDToken*> &tokens,
|
||||
std::string &str,
|
||||
const char *operandOrder,
|
||||
const signed char *operandOrder,
|
||||
EDDisassembler &disassembler);
|
||||
|
||||
/// getString - Directs a character pointer to the string, returning 0 on
|
||||
|
@ -504,8 +504,8 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
||||
// .indirect_symbol _foo
|
||||
OutStreamer.EmitSymbolAttribute(Stubs[i].second.getPointer(),
|
||||
MCSA_IndirectSymbol);
|
||||
// hlt; hlt; hlt; hlt; hlt hlt = 0xf4 = -12.
|
||||
const char HltInsts[] = { -12, -12, -12, -12, -12 };
|
||||
// hlt; hlt; hlt; hlt; hlt hlt = 0xf4.
|
||||
const char HltInsts[] = "\xf4\xf4\xf4\xf4\xf4";
|
||||
OutStreamer.EmitBytes(StringRef(HltInsts, 5), 0/*addrspace*/);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ TEST_F(MDStringTest, PrintingSimple) {
|
||||
|
||||
// Test printing of MDString with non-printable characters.
|
||||
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));
|
||||
std::string Str;
|
||||
raw_string_ostream oss(Str);
|
||||
|
Loading…
Reference in New Issue
Block a user