[PATCH] D146385: [clang][ExtractAPI] Complete declaration fragments for TagDecl types defined in a typedef

R4444 via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 25 22:10:55 PDT 2023


Ruturaj4 marked 2 inline comments as done.
Ruturaj4 added inline comments.


================
Comment at: clang/lib/ExtractAPI/ExtractAPIVisitor.cpp:347
+        if (TagTy->getDecl()->isStruct()) {
+          for (const auto &Struct : API.getStructs()) {
+            if (Decl->getName() == Struct.second.get()->Name) {
----------------
dang wrote:
> What happens if the visitation hasn't already encountered the definition of the struct? We wouldn't find it in the the APISet and this doesn't work. The approach I would suggest here is to generate the fragments for the underlying Decl directly. For example what happens for the following code:
> 
> ```c
> struct Foo;
> typedef struct Foo TypedefedFoo;
> struct Foo {
>     int bar;
> };
> ```
Actually added an example for this. Our code works fine. Please take a look.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146385/new/

https://reviews.llvm.org/D146385



More information about the cfe-commits mailing list