Permalink
Browse files

Merge pull request #140 from Kingcom/unique-move

Fix implicit base class conversions for unique_ptr
  • Loading branch information...
Kingcom committed Jun 30, 2018
2 parents 440465f + 92c18c2 commit 9efe3367284d2d1eeb14fc302a2c12c36e3e255e
@@ -49,7 +49,7 @@ std::unique_ptr<CAssemblerCommand> parseDirectivePool(Parser& parser, int flags)
seq->addCommand(make_unique<CDirectiveAlignFill>(4,CDirectiveAlignFill::Align));
seq->addCommand(make_unique<ArmPoolCommand>());
return seq;
return std::move(seq);
}
const wchar_t* msgTemplate =
@@ -201,6 +201,9 @@ bool CMipsInstruction::Validate()
if (immediateData.secondary.type == MipsImmediateType::Ins)
immediateData.secondary.value += immediateData.primary.value;
break;
case MipsImmediateType::Cop2BranchType:
default:
break;
}
}
@@ -291,6 +294,9 @@ void CMipsInstruction::encodeNormal() const
case MipsImmediateType::ImmediateHalfFloat:
encoding |= immediateData.primary.value;
break;
default:
// TODO: Assert?
break;
}
switch (immediateData.secondary.type)
@@ -305,6 +311,9 @@ void CMipsInstruction::encodeNormal() const
case MipsImmediateType::Cop2BranchType:
encoding |= immediateData.secondary.value << 18;
break;
default:
// TODO: Assert?
break;
}
if (opcodeData.opcode.flags & MO_VFPU_MIXED)
@@ -341,6 +350,9 @@ void CMipsInstruction::encodeVfpu() const
case MipsImmediateType::Immediate7:
encoding |= immediateData.primary.value << 0;
break;
default:
// TODO: Assert?
break;
}
g_fileManager->writeU32((uint32_t)encoding);
@@ -55,6 +55,8 @@ bool CDirectiveConditional::evaluate()
return label->isDefined();
case ConditionType::IFNDEF:
return !label->isDefined();
default:
break;
}
Logger::queueError(Logger::Error,L"Invalid conditional type");
@@ -123,6 +123,8 @@ size_t CDirectiveData::getUnitSize() const
case EncodingMode::U64:
case EncodingMode::Double:
return 8;
case EncodingMode::Invalid:
break;
}
return 0;
@@ -143,6 +145,8 @@ size_t CDirectiveData::getDataSize() const
case EncodingMode::Float:
case EncodingMode::Double:
return normalData.size()*getUnitSize();
case EncodingMode::Invalid:
break;
}
return 0;
@@ -366,6 +370,9 @@ void CDirectiveData::Encode() const
g_fileManager->writeU64((uint64_t)value);
}
break;
case EncodingMode::Invalid:
// TODO: Assert?
break;
}
}
@@ -421,6 +428,9 @@ void CDirectiveData::writeTempData(TempData& tempData) const
str += swprintf(str,20,L"0x%16llX,",(uint64_t)normalData[i]);
}
break;
case EncodingMode::Invalid:
// TODO: Assert?
break;
}
*(str-1) = 0;
@@ -451,5 +461,8 @@ void CDirectiveData::writeSymData(SymbolData& symData) const
case EncodingMode::Double:
symData.addData(position,getDataSize(),SymbolData::Data64);
break;
case EncodingMode::Invalid:
// TODO: Assert?
break;
}
}
@@ -70,6 +70,8 @@ bool CDirectiveFile::Validate()
closeFile = g_fileManager->getOpenFile();
g_fileManager->closeFile();
return false;
case Type::Invalid:
break;
}
return false;
@@ -87,6 +89,9 @@ void CDirectiveFile::Encode() const
case Type::Close:
g_fileManager->closeFile();
break;
case Type::Invalid:
// TODO: Assert?
break;
}
}
@@ -109,6 +114,9 @@ void CDirectiveFile::writeTempData(TempData& tempData) const
case Type::Close:
str = L".close";
break;
case Type::Invalid:
// TODO: Assert?
break;
}
tempData.writeLine(virtualAddress,str);
@@ -127,6 +135,9 @@ void CDirectiveFile::writeSymData(SymbolData& symData) const
if (closeFile)
closeFile->endSymData(symData);
break;
case Type::Invalid:
// TODO: Assert?
break;
}
}
@@ -270,7 +270,7 @@ std::unique_ptr<CAssemblerCommand> ElfRelocator::generateCtor(const std::wstring
auto func = ::make_unique<CDirectiveFunction>(ctorName,ctorName);
func->setContent(std::move(content));
return func;
return std::move(func);
}
void ElfRelocator::loadRelocation(Elf32_Rel& rel, ByteArray& data, int offset, Endianness endianness)
@@ -88,6 +88,8 @@ ExpressionValue ExpressionValue::operator-(const ExpressionValue& other) const
result.type = ExpressionValueType::Float;
result.floatValue = floatValue - other.floatValue;
break;
default:
break;
}
return result;
@@ -114,6 +116,8 @@ ExpressionValue ExpressionValue::operator*(const ExpressionValue& other) const
result.type = ExpressionValueType::Float;
result.floatValue = floatValue * other.floatValue;
break;
default:
break;
}
return result;
@@ -151,6 +155,8 @@ ExpressionValue ExpressionValue::operator/(const ExpressionValue& other) const
result.type = ExpressionValueType::Float;
result.floatValue = floatValue / other.floatValue;
break;
default:
break;
}
return result;
@@ -176,6 +182,8 @@ ExpressionValue ExpressionValue::operator%(const ExpressionValue& other) const
}
result.intValue = intValue % other.intValue;
break;
default:
break;
}
return result;
@@ -216,6 +224,8 @@ ExpressionValue ExpressionValue::operator<<(const ExpressionValue& other) const
result.type = ExpressionValueType::Integer;
result.intValue = ((uint64_t) intValue) << other.intValue;
break;
default:
break;
}
return result;
@@ -230,6 +240,8 @@ ExpressionValue ExpressionValue::operator>>(const ExpressionValue& other) const
result.type = ExpressionValueType::Integer;
result.intValue = ((uint64_t) intValue) >> other.intValue;
break;
default:
break;
}
return result;
@@ -247,6 +259,8 @@ bool ExpressionValue::operator<(const ExpressionValue& other) const
return intValue < other.floatValue;
case ExpressionValueCombination::FF:
return floatValue < other.floatValue;
default:
break;
}
return false;
@@ -264,6 +278,8 @@ bool ExpressionValue::operator<=(const ExpressionValue& other) const
return intValue <= other.floatValue;
case ExpressionValueCombination::FF:
return floatValue <= other.floatValue;
default:
break;
}
return false;
@@ -320,6 +336,8 @@ ExpressionValue ExpressionValue::operator&(const ExpressionValue& other) const
result.type = ExpressionValueType::Integer;
result.intValue = intValue & other.intValue;
break;
default:
break;
}
return result;
@@ -334,6 +352,8 @@ ExpressionValue ExpressionValue::operator|(const ExpressionValue& other) const
result.type = ExpressionValueType::Integer;
result.intValue = intValue | other.intValue;
break;
default:
break;
}
return result;
@@ -358,6 +378,8 @@ ExpressionValue ExpressionValue::operator&&(const ExpressionValue& other) const
case ExpressionValueCombination::FF:
result.floatValue = floatValue && other.floatValue;
break;
default:
break;
}
return result;
@@ -382,6 +404,8 @@ ExpressionValue ExpressionValue::operator||(const ExpressionValue& other) const
case ExpressionValueCombination::FF:
result.floatValue = floatValue || other.floatValue;
break;
default:
break;
}
return result;
@@ -396,6 +420,8 @@ ExpressionValue ExpressionValue::operator^(const ExpressionValue& other) const
result.type = ExpressionValueType::Integer;
result.intValue = intValue ^ other.intValue;
break;
default:
break;
}
return result;
@@ -440,6 +466,8 @@ ExpressionInternal::ExpressionInternal(const std::wstring& value, OperatorType t
break;
case OperatorType::String:
break;
default:
break;
}
}
@@ -599,6 +627,8 @@ bool ExpressionInternal::simplify(bool inUnknownOrFalseBlock)
if (isExpressionFunctionSafe(strValue, inUnknownOrFalseBlock) == false)
return false;
break;
default:
break;
}
// check if the same applies to all children
@@ -257,6 +257,8 @@ ExpressionValue expFuncAbs(const std::wstring& funcName, const std::vector<Expre
result.intValue = parameters[0].intValue >= 0 ?
parameters[0].intValue : -parameters[0].intValue;
break;
default:
break;
}
return result;
@@ -56,6 +56,8 @@ void Logger::setFlags(ErrorType type)
error = true;
fatalError = true;
break;
case Notice:
break;
}
}
@@ -41,10 +41,10 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveOpen(Parser& parser, int flags)
return nullptr;
file->initCopy(inputName,outputName,memoryAddress);
return file;
return std::move(file);
} else {
file->initOpen(inputName,memoryAddress);
return file;
return std::move(file);
}
}
@@ -65,14 +65,14 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveCreate(Parser& parser, int flag
auto file = make_unique<CDirectiveFile>();
file->initCreate(inputName,memoryAddress);
return file;
return std::move(file);
}
std::unique_ptr<CAssemblerCommand> parseDirectiveClose(Parser& parser, int flags)
{
auto file = make_unique<CDirectiveFile>();
file->initClose();
return file;
return std::move(file);
}
std::unique_ptr<CAssemblerCommand> parseDirectiveIncbin(Parser& parser, int flags)
@@ -92,7 +92,7 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveIncbin(Parser& parser, int flag
if (list.size() == 3)
incbin->setSize(list[2]);
return incbin;
return std::move(incbin);
}
std::unique_ptr<CAssemblerCommand> parseDirectivePosition(Parser& parser, int flags)
@@ -240,7 +240,7 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveConditional(Parser& parser, int
const Token &next = parser.nextToken();
const std::wstring stringValue = next.getStringValue();
ConditionalResult elseResult = condResult;
ConditionalResult elseResult;
switch (condResult)
{
case ConditionalResult::True:
@@ -249,6 +249,9 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveConditional(Parser& parser, int
case ConditionalResult::False:
elseResult = ConditionalResult::True;
break;
case ConditionalResult::Unknown:
elseResult = condResult;
break;
}
parser.pushConditionalResult(elseResult);
@@ -297,7 +300,7 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveConditional(Parser& parser, int
cond = make_unique<CDirectiveConditional>(type);
cond->setContent(std::move(ifBlock),std::move(elseBlock));
return cond;
return std::move(cond);
}
std::unique_ptr<CAssemblerCommand> parseDirectiveTable(Parser& parser, int flags)
@@ -376,7 +379,7 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveData(Parser& parser, int flags)
break;
}
return data;
return std::move(data);
}
std::unique_ptr<CAssemblerCommand> parseDirectiveMipsArch(Parser& parser, int flags)
@@ -451,7 +454,7 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveArea(Parser& parser, int flags)
parser.eatToken();
area->setContent(std::move(content));
return area;
return std::move(area);
}
std::unique_ptr<CAssemblerCommand> parseDirectiveErrorWarning(Parser& parser, int flags)
@@ -592,7 +595,7 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveFunction(Parser& parser, int fl
}
func->setContent(std::move(seq));
return func;
return std::move(func);
}
std::unique_ptr<CAssemblerCommand> parseDirectiveMessage(Parser& parser, int flags)
Oops, something went wrong.

0 comments on commit 9efe336

Please sign in to comment.