Skip to content

[Clang] FunctionDecl::getFunctionTypeLoc returns None when function attributes present #118290

@v01dXYZ

Description

@v01dXYZ

Use case

I try to add a custom Function Attribute that implies the function returns an int. In the case of the user using void as return type, I would like to add at least a fix-it hint to replace void by int. Unfortunately, the current implementation won't try to walk the AttributedTypeLoc chain and returns an empty FunctionTypeLoc. Thus getReturnTypeLoc returns None too.

Discussion

I don't know if it is an acceptable behavior to make it go through the AttributeTypeLoc chain to extract the final FunctionTypeLoc. If it is, I would like to submit a few-lines patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions