mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
abi::FunctionType: preserve return value comments
This commit is contained in:
committed by
Alessandro Di Federico
parent
9f732513c3
commit
55ed35d5d1
@@ -156,6 +156,20 @@ tryConvertToCABI(const model::RawFunctionType &FunctionType,
|
||||
|
||||
revng_log(Log, "Conversion successful:\n" << serializeToString(NewType));
|
||||
|
||||
// Since CABI-FT only have one field for return value comments - we have no
|
||||
// choice but to resort to concatenation in order to preserve as much
|
||||
// information as possible.
|
||||
for (model::TypedRegister ReturnValue : FunctionType.ReturnValues()) {
|
||||
if (!ReturnValue.Comment().empty()) {
|
||||
if (!NewType.ReturnValueComment().empty())
|
||||
NewType.ReturnValueComment() += '\n';
|
||||
model::Register::Values RVLoc = ReturnValue.Location();
|
||||
NewType.ReturnValueComment() += model::Register::getRegisterName(RVLoc);
|
||||
NewType.ReturnValueComment() += ": ";
|
||||
NewType.ReturnValueComment() += ReturnValue.Comment();
|
||||
}
|
||||
}
|
||||
|
||||
// To finish up the conversion, remove all the references to the old type by
|
||||
// carefully replacing them with references to the new one.
|
||||
replaceAllUsesWith(FunctionType.key(), NewTypePath, Binary);
|
||||
|
||||
Reference in New Issue
Block a user