mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
MSVC build fix following r211749
Avoid strndup() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211752 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f93fe90504
commit
45f166017c
@ -86,8 +86,10 @@ LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
|
|||||||
if (Action == LLVMAbortProcessAction && Result)
|
if (Action == LLVMAbortProcessAction && Result)
|
||||||
report_fatal_error("Broken module found, compilation aborted!");
|
report_fatal_error("Broken module found, compilation aborted!");
|
||||||
|
|
||||||
if (OutMessages)
|
if (OutMessages) {
|
||||||
*OutMessages = strndup(MsgsOS.str().data(), MsgsOS.str().size());
|
MsgsOS << '\0';
|
||||||
|
*OutMessages = strdup(MsgsOS.str().data());
|
||||||
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
@ -62,9 +62,9 @@ void LLVMShutdown() {
|
|||||||
|
|
||||||
/*===-- Error handling ----------------------------------------------------===*/
|
/*===-- Error handling ----------------------------------------------------===*/
|
||||||
|
|
||||||
static char *LLVMCreateMessage(StringRef Message) {
|
static char *LLVMCreateMessage(string_ostream &OS) {
|
||||||
assert(Message.find('\0') == Message.npos);
|
OS << '\0';
|
||||||
return strndup(Message.data(), Message.size());
|
return strdup(OS.str().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
char *LLVMCreateMessage(const char *Message) {
|
char *LLVMCreateMessage(const char *Message) {
|
||||||
@ -118,7 +118,7 @@ char *LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI) {
|
|||||||
string_ostream Msg;
|
string_ostream Msg;
|
||||||
DiagnosticPrinterRawOStream DP(Msg);
|
DiagnosticPrinterRawOStream DP(Msg);
|
||||||
unwrap(DI)->print(DP);
|
unwrap(DI)->print(DP);
|
||||||
return LLVMCreateMessage(Msg.str());
|
return LLVMCreateMessage(Msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI){
|
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI){
|
||||||
@ -204,7 +204,7 @@ LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
|
|||||||
char *LLVMPrintModuleToString(LLVMModuleRef M) {
|
char *LLVMPrintModuleToString(LLVMModuleRef M) {
|
||||||
string_ostream os;
|
string_ostream os;
|
||||||
unwrap(M)->print(os, nullptr);
|
unwrap(M)->print(os, nullptr);
|
||||||
return LLVMCreateMessage(os.str());
|
return LLVMCreateMessage(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--.. Operations on inline assembler ......................................--*/
|
/*--.. Operations on inline assembler ......................................--*/
|
||||||
@ -282,7 +282,7 @@ char *LLVMPrintTypeToString(LLVMTypeRef Ty) {
|
|||||||
else
|
else
|
||||||
os << "Printing <null> Type";
|
os << "Printing <null> Type";
|
||||||
|
|
||||||
return strndup(os.str().data(), os.str().size());
|
return LLVMCreateMessage(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--.. Operations on integer types .........................................--*/
|
/*--.. Operations on integer types .........................................--*/
|
||||||
@ -533,7 +533,7 @@ char* LLVMPrintValueToString(LLVMValueRef Val) {
|
|||||||
else
|
else
|
||||||
os << "Printing <null> Value";
|
os << "Printing <null> Value";
|
||||||
|
|
||||||
return strndup(os.str().data(), os.str().size());
|
return LLVMCreateMessage(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal) {
|
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal) {
|
||||||
|
@ -110,7 +110,8 @@ LLVMBool LLVMParseIRInContext(LLVMContextRef ContextRef,
|
|||||||
if (OutMessage) {
|
if (OutMessage) {
|
||||||
string_ostream os;
|
string_ostream os;
|
||||||
Diag.print(nullptr, os, false);
|
Diag.print(nullptr, os, false);
|
||||||
*OutMessage = strndup(os.str().data(), os.str().size());
|
os << '\0';
|
||||||
|
*OutMessage = strdup(os.str().data());
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user