mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-10 18:11:26 +00:00
Remove some std stream usage from Support and TableGen
LLVM's coding standards recommend raw_ostream and MemoryBuffer for reading and writing text. This has the side effect of allowing clang to compile more of Support and TableGen in the Microsoft C++ ABI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187826 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2d66d4cf42
commit
47cfec0284
@ -41,10 +41,10 @@ bool llvm::sys::hasDisassembler()
|
|||||||
|
|
||||||
std::string llvm::sys::disassembleBuffer(uint8_t* start, size_t length,
|
std::string llvm::sys::disassembleBuffer(uint8_t* start, size_t length,
|
||||||
uint64_t pc) {
|
uint64_t pc) {
|
||||||
std::stringstream res;
|
|
||||||
|
|
||||||
#if (defined (__i386__) || defined (__amd64__) || defined (__x86_64__)) \
|
#if (defined (__i386__) || defined (__amd64__) || defined (__x86_64__)) \
|
||||||
&& USE_UDIS86
|
&& USE_UDIS86
|
||||||
|
std::stringstream res;
|
||||||
|
|
||||||
unsigned bits;
|
unsigned bits;
|
||||||
# if defined(__i386__)
|
# if defined(__i386__)
|
||||||
bits = 32;
|
bits = 32;
|
||||||
@ -66,9 +66,9 @@ std::string llvm::sys::disassembleBuffer(uint8_t* start, size_t length,
|
|||||||
while (ud_disassemble(&ud_obj)) {
|
while (ud_disassemble(&ud_obj)) {
|
||||||
res << ud_insn_off(&ud_obj) << ":\t" << ud_insn_asm(&ud_obj) << "\n";
|
res << ud_insn_off(&ud_obj) << ":\t" << ud_insn_asm(&ud_obj) << "\n";
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
res << "No disassembler available. See configure help for options.\n";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return res.str();
|
return res.str();
|
||||||
|
#else
|
||||||
|
return "No disassembler available. See configure help for options.\n";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
#include "llvm/Support/LockFileManager.h"
|
#include "llvm/Support/LockFileManager.h"
|
||||||
|
#include "llvm/ADT/STLExtras.h"
|
||||||
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/Support/FileSystem.h"
|
#include "llvm/Support/FileSystem.h"
|
||||||
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include <fstream>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#if LLVM_ON_WIN32
|
#if LLVM_ON_WIN32
|
||||||
@ -35,16 +37,18 @@ LockFileManager::readLockFile(StringRef LockFileName) {
|
|||||||
|
|
||||||
// Read the owning host and PID out of the lock file. If it appears that the
|
// Read the owning host and PID out of the lock file. If it appears that the
|
||||||
// owning process is dead, the lock file is invalid.
|
// owning process is dead, the lock file is invalid.
|
||||||
int PID = 0;
|
OwningPtr<MemoryBuffer> MB;
|
||||||
std::string Hostname;
|
if (MemoryBuffer::getFile(LockFileName, MB)) {
|
||||||
std::ifstream Input(LockFileName.str().c_str());
|
StringRef Hostname;
|
||||||
if (Input >> Hostname >> PID && PID > 0 &&
|
StringRef PIDStr;
|
||||||
processStillExecuting(Hostname, PID))
|
tie(Hostname, PIDStr) = getToken(MB->getBuffer(), " ");
|
||||||
return std::make_pair(Hostname, PID);
|
int PID;
|
||||||
|
if (PIDStr.getAsInteger(10, PID))
|
||||||
|
return std::make_pair(std::string(Hostname), PID);
|
||||||
|
}
|
||||||
|
|
||||||
// Delete the lock file. It's invalid anyway.
|
// Delete the lock file. It's invalid anyway.
|
||||||
bool Existed;
|
sys::fs::remove(LockFileName);
|
||||||
sys::fs::remove(LockFileName, Existed);
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1271,10 +1271,11 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType,
|
|||||||
if (ItemType != 0) {
|
if (ItemType != 0) {
|
||||||
ListRecTy *ListType = dyn_cast<ListRecTy>(ItemType);
|
ListRecTy *ListType = dyn_cast<ListRecTy>(ItemType);
|
||||||
if (ListType == 0) {
|
if (ListType == 0) {
|
||||||
std::stringstream s;
|
std::string s;
|
||||||
s << "Type mismatch for list, expected list type, got "
|
raw_string_ostream ss(s);
|
||||||
<< ItemType->getAsString();
|
ss << "Type mismatch for list, expected list type, got "
|
||||||
TokError(s.str());
|
<< ItemType->getAsString();
|
||||||
|
TokError(ss.str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
GivenListTy = ListType;
|
GivenListTy = ListType;
|
||||||
|
@ -2069,7 +2069,8 @@ static void emitIsSubclass(CodeGenTarget &Target,
|
|||||||
OS << " if (A == B)\n";
|
OS << " if (A == B)\n";
|
||||||
OS << " return true;\n\n";
|
OS << " return true;\n\n";
|
||||||
|
|
||||||
std::stringstream SS;
|
std::string OStr;
|
||||||
|
raw_string_ostream SS(OStr);
|
||||||
unsigned Count = 0;
|
unsigned Count = 0;
|
||||||
SS << " switch (A) {\n";
|
SS << " switch (A) {\n";
|
||||||
SS << " default:\n";
|
SS << " default:\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user