[clang][ExtractAPI] Declaration fragments should show types as shown in the source code.
For Objective-C APIs that use typedefs, ExtractAPI emits declarations with the original’s type’s name rather than its typedef name.
For example, in:
typedef struct MyStruct * MyTypeDef;
void foo(MyTypeDef x) {}
The declaration for foo is the following:
void foo(struct MyStruct * x)
Rather than:
void foo(MyTypeDef x)
Resolving this issue will align the declaration we generate to the one that’s in the original source code.
@llvm/issue-subscribers-good-first-issue
I'd like to work on this.
Go for it!
Hey @karan0handa feel free to reach out to me if you need any help with this.
Hey @karan0handa are you still working on this? I would also like to work on this issue!
I'm not working on this anymore. Feel free to take it up! @ayushi-8102
I'd like to give this a shot if no one has found a fix yet
Anyone working, I will like to work on it, I have work on one issue which involve ExtractAPI before.
Hi , anyone still working on it ? if not I'd like to have a crack at it. I am a beginner so advice and help would be most welcome and appreciated
Hey, is anyone still working on this issue ? If not I would like to give it a try.
Hey @daniel-grumberg I think this is issue is already solved. Here is the output I get when reproducing your example:
The command I used was clang -x objective-c -extract-api test.h
test.h
typedef struct MyStruct
{
} MyTypDef;
void func(MyTypDef *typ);
output.json
# 1 "test.h"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 395 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "test.h" 2
typedef struct MyStruct
{
} MyTypDef;
void func(MyTypDef *typ);
The declaration of func emitted by ExtractAPI is already using the typdefs name.
Sorry I think the description is not quite detailed enough, this happens when a typedef to a type related to the struct is used exactly as per the example in the original description of the issue.
Thank you!
Hi, I would love to work on this issue
Hi, I was looking at this, and it looks like it has already been fixed? I copied the example exactly to test.h, and the output to command
clang -extract-api -x objective-c test.h
# 1 "test.h"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 419 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "test.h" 2
typedef struct MyStruct *MyTypeDef;
void foo(MyTypeDef x) {}
Let me know if I am misunderstanding the issue. Thank you!
Hi, I'm looking at this for the CS3423 Compilers II hackathon at IIT Hyderabad. I see #167319 is open but looks stalled. Is it still being worked on, or is it okay if I take this over?