[PATCH] D111199: [Clang][LLVM][Attr] support btf_type_tag attribute

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 3 04:19:01 PDT 2021


aaron.ballman added a comment.

In D111199#3104804 <https://reviews.llvm.org/D111199#3104804>, @yonghong-song wrote:

> @aaron.ballman I checked the source. Looks like we can easily get TypeLoc from TypeSourceInfo, but not from TypeSourceInfo to TypeLoc. But We need TypeLoc so we can get attr information and also traverse TypeLoc's.. We might be able to pass TypeSourceInfo in a few functions e.g., createFieldType(), but we still need to do TSI->getTypeLoc() and pass TypeLoc to other functions like getOrCreateType(), createType() etc. So I am inclined to just use TypeLoc.
>
> @dblaikie Based on the discussion so far, I suspect we might have to use TypeLoc. Please let me know what you think.

That sounds reasonable to me, but one possibility would be to change `createType()` and `getOrCreateType()` to take a `TypeSourceInfo *` rather than a `QualType` (because you can go from the `TypeSourceInfo *` back to the `QualType` by calling `getType()` on it). However, that could also be a heavier lift due to the number of call sites.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111199



More information about the cfe-commits mailing list