mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
Fix extra commentability on prototype return value
This commit is contained in:
committed by
Pietro Fezzardi
parent
381c834cce
commit
ae17e8987a
@@ -82,10 +82,18 @@ private:
|
||||
return Name;
|
||||
}
|
||||
|
||||
std::optional<ptml::CTokenEmitter::Region> commentableReturnValueGuard() {
|
||||
std::optional<ptml::CTokenEmitter::Region>
|
||||
commentableReturnValueGuard(DeclaratorInfo const *Declarator) {
|
||||
if (OutermostFunctionType == nullptr)
|
||||
return std::nullopt;
|
||||
|
||||
// Only emitting the return value guard when parameters are available might
|
||||
// look weird at the first sight, but when we are emitting a prototype
|
||||
// without parameter information (the typedef), it's weird to allow adding
|
||||
// comments to a return type that will show up elsewhere.
|
||||
if (not Declarator->Parameters)
|
||||
return std::nullopt;
|
||||
|
||||
auto FTHandle = OutermostFunctionType.getHandle();
|
||||
auto FTLoc = pipeline::locationFromString(revng::ranks::TypeDefinition,
|
||||
FTHandle);
|
||||
@@ -141,7 +149,7 @@ private:
|
||||
}
|
||||
|
||||
{
|
||||
auto Guard = commentableReturnValueGuard();
|
||||
auto Guard = commentableReturnValueGuard(Declarator);
|
||||
|
||||
// Recurse through the declaration, pushing each level onto the stack
|
||||
// until a terminal type is encountered. Primitive types as well as
|
||||
|
||||
Reference in New Issue
Block a user