AaronBallman wrote:

> > Thanks! However, for the following piece of code
> > `getOriginalDecl()` called on the pointed-to type gives the 
> > forward-declaration from the 3rd line, and the forward-declaration from the 
> > 1st line for its canonical type.
> 
> Yes that is correct.
> 
> The 3rd line is what declaration was found by type lookup at that point, and 
> the canonical declaration has long been established in clang as the first 
> declaration.

The comments in this area are confusing me, FWIW:
```
  /// Stores the TagDecl associated with this type. The decl may point to any
  /// TagDecl that declares the entity.
  TagDecl *decl;

  ...

  TagDecl *getOriginalDecl() const { return decl; }
```
The function is called "get original decl" which implies you get the first 
declaration seen in the TU, but the data member it returns has a comment saying 
it may point to any declaration in the redeclaration chain. One of these is 
wrong, correct?

https://github.com/llvm/llvm-project/pull/147835
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to