This is an archive of the discontinued LLVM Phabricator instance.

Comment AST: Declare function pointer variables as functions
ClosedPublic

Authored by aaronpuchert on Oct 6 2021, 1:17 PM.

Details

Summary

We were doing this already for type aliases, and it deduplicates the
code looking through aliases and pointers to find a function type. As
a side effect, this finds two warnings that we apparently missed before.

Diff Detail

Event Timeline

aaronpuchert requested review of this revision.Oct 6 2021, 1:17 PM
aaronpuchert created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2021, 1:17 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
gribozavr2 accepted this revision.Nov 8 2021, 3:50 AM

I feel uneasy about claiming that variable decls of function type are FunctionKind for the purposes of comment parsing (even doing it for typedefs is questionable). It seems like a better way would be to make "is function like" an extra dimension that can be combined with any decl kind.

However since no tests break, it might be not an issue in practice.

This revision is now accepted and ready to land.Nov 8 2021, 3:50 AM

I feel uneasy about claiming that variable decls of function type are FunctionKind for the purposes of comment parsing (even doing it for typedefs is questionable). It seems like a better way would be to make "is function like" an extra dimension that can be combined with any decl kind.

Agreed, I'll try to write a patch for that. Essentially we want to know if some kind of function type (or maybe just FunctionProtoType?) is involved in that declaration (without desugaring), either of a type declaration, or of the declared type of a non-type declaration. That's pretty much orthogonal to the kind. (Though it's of course incompatible with some kinds, such as EnumKind or NamespaceKind.)

I'm wondering about global lambdas declarations. These should have class type, but also have parameters like a function.

This revision was landed with ongoing or failed builds.Nov 9 2021, 1:30 PM
This revision was automatically updated to reflect the committed changes.