std::lock_guard<std::recursive_mutex> Lock(SerializersMutex);
// FIXME: Move capture Serialize once we have C++14.
Serializers[ErrorInfoT::classID()] =
- [KeyName, Serialize](ChannelT &C, const ErrorInfoBase &EIB) -> Error {
- assert(EIB.dynamicClassID() == ErrorInfoT::classID() &&
- "Serializer called for wrong error type");
- if (auto Err = serializeSeq(C, *KeyName))
- return Err;
- return Serialize(C, static_cast<const ErrorInfoT&>(EIB));
- };
+ [KeyName, Serialize](ChannelT &C, const ErrorInfoBase &EIB) -> Error {
+ assert(EIB.dynamicClassID() == ErrorInfoT::classID() &&
+ "Serializer called for wrong error type");
+ if (auto Err = serializeSeq(C, *KeyName))
+ return Err;
+ return Serialize(C, static_cast<const ErrorInfoT &>(EIB));
+ };
}
}
std::sort(GVEs.begin(), GVEs.end(),
[](DwarfCompileUnit::GlobalExpr A, DwarfCompileUnit::GlobalExpr B) {
if (A.Expr != B.Expr && A.Expr && B.Expr) {
- auto FragmentA = A.Expr->getFragmentInfo();
- auto FragmentB = B.Expr->getFragmentInfo();
- if (FragmentA && FragmentB)
- return FragmentA->OffsetInBits < FragmentB->OffsetInBits;
- }
+ auto FragmentA = A.Expr->getFragmentInfo();
+ auto FragmentB = B.Expr->getFragmentInfo();
+ if (FragmentA && FragmentB)
+ return FragmentA->OffsetInBits < FragmentB->OffsetInBits;
+ }
return false;
});
GVEs.erase(std::unique(GVEs.begin(), GVEs.end(),
DwarfRegs.push_back(
{Reg, std::min<unsigned>(Size, MaxSize - Offset), "sub-register"});
if (Offset >= MaxSize)
- break;
+ break;
// Mark it as emitted.
Coverage.set(Offset, Offset + Size);
bool removeModule(Module *M) override {
for (auto I = LocalModules.begin(), E = LocalModules.end(); I != E; ++I) {
if (I->get() == M) {
- ShouldDelete[M] = false;
- LocalModules.erase(I);
- return true;
+ ShouldDelete[M] = false;
+ LocalModules.erase(I);
+ return true;
}
}
return false;
assert((StrLoc.getPointer() != NULL) &&
"Argument to the function cannot be a NULL value");
const char *CharPtr = StrLoc.getPointer();
- while ((*CharPtr != '>') && (*CharPtr != '\n') &&
- (*CharPtr != '\r') && (*CharPtr != '\0')){
- if(*CharPtr == '!')
- CharPtr++;
+ while ((*CharPtr != '>') && (*CharPtr != '\n') && (*CharPtr != '\r') &&
+ (*CharPtr != '\0')) {
+ if (*CharPtr == '!')
+ CharPtr++;
CharPtr++;
}
if (*CharPtr == '>') {
"past the end of the file");
if (Error Err = checkOverlappingElement(Elements, Dysymtab.modtaboff,
Dysymtab.nmodtab * sizeof_modtab,
- "module table"))
+ "module table"))
return Err;
if (Dysymtab.extrefsymoff > FileSize)
return malformedError("extrefsymoff field of LC_DYSYMTAB command " +
"past the end of the file");
if (Error Err = checkOverlappingElement(Elements, Dysymtab.extrefsymoff,
Dysymtab.nextrefsyms *
- sizeof(MachO::dylib_reference),
- "reference table"))
+ sizeof(MachO::dylib_reference),
+ "reference table"))
return Err;
if (Dysymtab.indirectsymoff > FileSize)
return malformedError("indirectsymoff field of LC_DYSYMTAB command " +
"the file");
if (Error Err = checkOverlappingElement(Elements, Dysymtab.extreloff,
Dysymtab.nextrel *
- sizeof(MachO::relocation_info),
- "external relocation table"))
+ sizeof(MachO::relocation_info),
+ "external relocation table"))
return Err;
if (Dysymtab.locreloff > FileSize)
return malformedError("locreloff field of LC_DYSYMTAB command " +
"the file");
if (Error Err = checkOverlappingElement(Elements, Dysymtab.locreloff,
Dysymtab.nlocrel *
- sizeof(MachO::relocation_info),
- "local relocation table"))
+ sizeof(MachO::relocation_info),
+ "local relocation table"))
return Err;
*DysymtabLoadCmd = Load.Ptr;
return Error::success();
Twine(error) + " for opcode at: 0x" +
Twine::utohexstr(OpcodeStart - Opcodes.begin()));
moveToEnd();
- return;
+ return;
}
DEBUG_WITH_TYPE(
"mach-o-rebase",
Twine(error) + " for opcode at: 0x" +
Twine::utohexstr(OpcodeStart - Opcodes.begin()));
moveToEnd();
- return;
+ return;
}
DEBUG_WITH_TYPE(
"mach-o-rebase",
Twine(error) + " for opcode at: 0x" +
Twine::utohexstr(OpcodeStart - Opcodes.begin()));
moveToEnd();
- return;
+ return;
}
DEBUG_WITH_TYPE(
"mach-o-rebase",
Twine(error) + " for opcode at: 0x" +
Twine::utohexstr(OpcodeStart - Opcodes.begin()));
moveToEnd();
- return;
+ return;
}
DEBUG_WITH_TYPE(
"mach-o-rebase",
Twine(error) + " for opcode at: 0x" +
Twine::utohexstr(OpcodeStart - Opcodes.begin()));
moveToEnd();
- return;
+ return;
}
DEBUG_WITH_TYPE(
"mach-o-bind",
static constexpr uint32_t get_max_thread_name_length_impl() {
#if defined(__NetBSD__)
- return PTHREAD_MAX_NAMELEN_NP;
+ return PTHREAD_MAX_NAMELEN_NP;
#elif defined(__APPLE__)
- return 64;
+ return 64;
#elif defined(__linux__)
#if HAVE_PTHREAD_SETNAME_NP
- return 16;
+ return 16;
#else
- return 0;
+ return 0;
#endif
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
return 16;
}
std::error_code create_hard_link(const Twine &to, const Twine &from) {
- return create_link(to, from);
+ return create_link(to, from);
}
std::error_code remove(const Twine &path, bool IgnoreNonExisting) {
Elements.push_back(CI);
if (CI != I)
Changed = true;
- } else
+ } else
return nullptr;
if (!Changed)
// Assume wildcards for unspecified instrs.
unsigned FirstOpcode =
- FirstMI ? FirstMI->getOpcode()
- : static_cast<unsigned>(AArch64::INSTRUCTION_LIST_END);
+ FirstMI ? FirstMI->getOpcode()
+ : static_cast<unsigned>(AArch64::INSTRUCTION_LIST_END);
unsigned SecondOpcode = SecondMI.getOpcode();
if (ST.hasArithmeticBccFusion())
Options.EABIVersion == EABI::Unknown) {
// musl is compatible with glibc with regard to EABI version
if ((TargetTriple.getEnvironment() == Triple::GNUEABI ||
- TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
- TargetTriple.getEnvironment() == Triple::MuslEABI ||
- TargetTriple.getEnvironment() == Triple::MuslEABIHF) &&
- !(TargetTriple.isOSWindows() || TargetTriple.isOSDarwin()))
+ TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
+ TargetTriple.getEnvironment() == Triple::MuslEABI ||
+ TargetTriple.getEnvironment() == Triple::MuslEABIHF) &&
+ !(TargetTriple.isOSWindows() || TargetTriple.isOSDarwin()))
this->Options.EABIVersion = EABI::GNU;
else
this->Options.EABIVersion = EABI::EABI5;
if (CallInst *CI = dyn_cast<CallInst>(J)) {
// Inline ASM is okay, unless it clobbers the ctr register.
if (InlineAsm *IA = dyn_cast<InlineAsm>(CI->getCalledValue())) {
- if (asmClobbersCTR(IA))
- return true;
+ if (asmClobbersCTR(IA))
+ return true;
continue;
}
Args2.push_back(ExpType);
Args1.push_back(ExpType);
}
- AsanErrorCallbackSized[AccessIsWrite][Exp] =
- checkSanitizerInterfaceFunction(M.getOrInsertFunction(
- kAsanReportErrorTemplate + ExpStr + TypeStr + SuffixStr +
- EndingStr,
- FunctionType::get(IRB.getVoidTy(), Args2, false)));
-
- AsanMemoryAccessCallbackSized[AccessIsWrite][Exp] =
- checkSanitizerInterfaceFunction(M.getOrInsertFunction(
- ClMemoryAccessCallbackPrefix + ExpStr + TypeStr + "N" + EndingStr,
- FunctionType::get(IRB.getVoidTy(), Args2, false)));
-
- for (size_t AccessSizeIndex = 0; AccessSizeIndex < kNumberOfAccessSizes;
- AccessSizeIndex++) {
- const std::string Suffix = TypeStr + itostr(1ULL << AccessSizeIndex);
- AsanErrorCallback[AccessIsWrite][Exp][AccessSizeIndex] =
- checkSanitizerInterfaceFunction(M.getOrInsertFunction(
- kAsanReportErrorTemplate + ExpStr + Suffix + EndingStr,
- FunctionType::get(IRB.getVoidTy(), Args1, false)));
-
- AsanMemoryAccessCallback[AccessIsWrite][Exp][AccessSizeIndex] =
- checkSanitizerInterfaceFunction(M.getOrInsertFunction(
- ClMemoryAccessCallbackPrefix + ExpStr + Suffix + EndingStr,
- FunctionType::get(IRB.getVoidTy(), Args1, false)));
- }
- }
+ AsanErrorCallbackSized[AccessIsWrite][Exp] =
+ checkSanitizerInterfaceFunction(M.getOrInsertFunction(
+ kAsanReportErrorTemplate + ExpStr + TypeStr + SuffixStr +
+ EndingStr,
+ FunctionType::get(IRB.getVoidTy(), Args2, false)));
+
+ AsanMemoryAccessCallbackSized[AccessIsWrite][Exp] =
+ checkSanitizerInterfaceFunction(M.getOrInsertFunction(
+ ClMemoryAccessCallbackPrefix + ExpStr + TypeStr + "N" + EndingStr,
+ FunctionType::get(IRB.getVoidTy(), Args2, false)));
+
+ for (size_t AccessSizeIndex = 0; AccessSizeIndex < kNumberOfAccessSizes;
+ AccessSizeIndex++) {
+ const std::string Suffix = TypeStr + itostr(1ULL << AccessSizeIndex);
+ AsanErrorCallback[AccessIsWrite][Exp][AccessSizeIndex] =
+ checkSanitizerInterfaceFunction(M.getOrInsertFunction(
+ kAsanReportErrorTemplate + ExpStr + Suffix + EndingStr,
+ FunctionType::get(IRB.getVoidTy(), Args1, false)));
+
+ AsanMemoryAccessCallback[AccessIsWrite][Exp][AccessSizeIndex] =
+ checkSanitizerInterfaceFunction(M.getOrInsertFunction(
+ ClMemoryAccessCallbackPrefix + ExpStr + Suffix + EndingStr,
+ FunctionType::get(IRB.getVoidTy(), Args1, false)));
+ }
+ }
}
const std::string MemIntrinCallbackPrefix =
uint64_t Size = Fragment.Size;
if (ExprFragment) {
uint64_t AbsEnd =
- ExprFragment->OffsetInBits + ExprFragment->SizeInBits;
+ ExprFragment->OffsetInBits + ExprFragment->SizeInBits;
if (Start >= AbsEnd)
// No need to describe a SROAed padding.
continue;
IndirectStubsManagerBuilder IndirectStubsMgrBuilder,
bool InlineStubs)
: TM(std::move(TM)), DL(this->TM->createDataLayout()),
- CCMgr(std::move(CCMgr)),
- ObjectLayer([]() { return std::make_shared<SectionMemoryManager>(); }),
+ CCMgr(std::move(CCMgr)),
+ ObjectLayer([]() { return std::make_shared<SectionMemoryManager>(); }),
CompileLayer(ObjectLayer, orc::SimpleCompiler(*this->TM)),
IRDumpLayer(CompileLayer, createDebugDumper()),
CODLayer(IRDumpLayer, extractSingleFunction, *this->CCMgr,
std::move(RemoteMM));
// Forward MCJIT's symbol resolution calls to the remote.
- static_cast<ForwardingMemoryManager*>(RTDyldMM)->setResolver(
- orc::createLambdaResolver(
- [](const std::string &Name) { return nullptr; },
- [&](const std::string &Name) {
- if (auto Addr = ExitOnErr(R->getSymbolAddress(Name)))
- return JITSymbol(Addr, JITSymbolFlags::Exported);
- return JITSymbol(nullptr);
- }
- ));
+ static_cast<ForwardingMemoryManager *>(RTDyldMM)->setResolver(
+ orc::createLambdaResolver(
+ [](const std::string &Name) { return nullptr; },
+ [&](const std::string &Name) {
+ if (auto Addr = ExitOnErr(R->getSymbolAddress(Name)))
+ return JITSymbol(Addr, JITSymbolFlags::Exported);
+ return JITSymbol(nullptr);
+ }));
// Grab the target address of the JIT'd main function on the remote and call
// it.
if (Disassemble) {
if (MachOOF->getHeader().filetype == MachO::MH_KEXT_BUNDLE &&
- MachOOF->getHeader().cputype == MachO::CPU_TYPE_ARM64)
+ MachOOF->getHeader().cputype == MachO::CPU_TYPE_ARM64)
DisassembleMachO(FileName, MachOOF, "__TEXT_EXEC", "__text");
else
DisassembleMachO(FileName, MachOOF, "__TEXT", "__text");
xp = xar_iter_new();
if(!xp){
errs() << "Can't obtain an xar iterator for xar archive "
- << XarFilename.c_str() << "\n";
+ << XarFilename.c_str() << "\n";
xar_close(xar);
return;
}
#if 0 // Useful for debugging.
outs() << "key: " << key << " value: " << val << "\n";
#endif
- if(strcmp(key, "name") == 0)
- member_name = val;
- if(strcmp(key, "type") == 0)
- member_type = val;
- if(strcmp(key, "data/size") == 0)
- member_size_string = val;
+ if (strcmp(key, "name") == 0)
+ member_name = val;
+ if (strcmp(key, "type") == 0)
+ member_type = val;
+ if (strcmp(key, "data/size") == 0)
+ member_size_string = val;
}
/*
* If we find a file with a name, date/size and type properties
char *endptr;
member_size = strtoul(member_size_string, &endptr, 10);
if (*endptr == '\0' && member_size != 0) {
- char *buffer = (char *) ::operator new (member_size);
- if (xar_extract_tobuffersz(xar, xf, &buffer, &member_size) == 0) {
+ char *buffer = (char *)::operator new(member_size);
+ if (xar_extract_tobuffersz(xar, xf, &buffer, &member_size) == 0) {
#if 0 // Useful for debugging.
outs() << "xar member: " << member_name << " extracted\n";
#endif
// Set the XarMemberName we want to see printed in the header.
- std::string OldXarMemberName;
- // If XarMemberName is already set this is nested. So
- // save the old name and create the nested name.
- if (!XarMemberName.empty()) {
- OldXarMemberName = XarMemberName;
+ std::string OldXarMemberName;
+ // If XarMemberName is already set this is nested. So
+ // save the old name and create the nested name.
+ if (!XarMemberName.empty()) {
+ OldXarMemberName = XarMemberName;
XarMemberName =
- (Twine("[") + XarMemberName + "]" + member_name).str();
- } else {
- OldXarMemberName = "";
- XarMemberName = member_name;
- }
- // See if this is could be a xar file (nested).
- if (member_size >= sizeof(struct xar_header)) {
+ (Twine("[") + XarMemberName + "]" + member_name).str();
+ } else {
+ OldXarMemberName = "";
+ XarMemberName = member_name;
+ }
+ // See if this is could be a xar file (nested).
+ if (member_size >= sizeof(struct xar_header)) {
#if 0 // Useful for debugging.
outs() << "could be a xar file: " << member_name << "\n";
#endif
- memcpy((char *)&XarHeader, buffer, sizeof(struct xar_header));
+ memcpy((char *)&XarHeader, buffer, sizeof(struct xar_header));
if (sys::IsLittleEndianHost)
- swapStruct(XarHeader);
- if(XarHeader.magic == XAR_HEADER_MAGIC)
- DumpBitcodeSection(O, buffer, member_size, verbose,
+ swapStruct(XarHeader);
+ if (XarHeader.magic == XAR_HEADER_MAGIC)
+ DumpBitcodeSection(O, buffer, member_size, verbose,
PrintXarHeader, PrintXarFileHeaders,
- XarMemberName);
- }
- XarMemberName = OldXarMemberName;
- }
+ XarMemberName);
+ }
+ XarMemberName = OldXarMemberName;
+ }
delete buffer;
}
}
if (!DisSymName.empty() && DisSymName == SymName) {
outs() << "-dis-symname: " << DisSymName << " not in the section\n";
return;
- }
+ }
continue;
}
// The __mh_execute_header is special and we need to deal with that fact
EXPECT_TRUE(test.bitwiseIsEqual(expected));
for (unsigned j = 0, je = GetZeroTest[i].bitPatternLength; j < je; ++j) {
EXPECT_EQ(GetZeroTest[i].bitPattern[j],
- test.bitcastToAPInt().getRawData()[j]);
+ test.bitcastToAPInt().getRawData()[j]);
}
}
}
bool needsToReserveAllocationSpace() override { return true; }
void reserveAllocationSpace(uintptr_t CodeSize, uint32_t CodeAlign,
- uintptr_t DataSizeRO, uint32_t RODataAlign,
- uintptr_t DataSizeRW, uint32_t RWDataAlign) override {
+ uintptr_t DataSizeRO, uint32_t RODataAlign,
+ uintptr_t DataSizeRW,
+ uint32_t RWDataAlign) override {
ReservedCodeSize = CodeSize;
ReservedDataSizeRO = DataSizeRO;
ReservedDataSizeRW = DataSizeRW;
// TEST 1: Verify commit case.
SmallString<128> File1(TestDirectory);
- File1.append("/file1");
+ File1.append("/file1");
{
ErrorOr<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
FileOutputBuffer::create(File1, 8192);
// TEST 3: Verify sizing down case.
SmallString<128> File3(TestDirectory);
- File3.append("/file3");
+ File3.append("/file3");
{
ErrorOr<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
FileOutputBuffer::create(File3, 8192000);
// TEST 4: Verify file can be made executable.
SmallString<128> File4(TestDirectory);
- File4.append("/file4");
+ File4.append("/file4");
{
ErrorOr<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
FileOutputBuffer::create(File4, 8192, FileOutputBuffer::F_executable);