[PATCH] D81420: Fix size for _ExtInt types with builtins

Mott, Jeffrey T via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 15:35:33 PDT 2020


jtmott-intel marked an inline comment as done.
jtmott-intel added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:337
+      QualType Ty =
+          I < 2 ? Arg.get()->getType()
+                : Arg.get()->getType()->getAs<PointerType>()->getPointeeType();
----------------
erichkeane wrote:
> Try:
> 
> Type *Ty = ArgExpr->getType()->getPointeeOrArrayElementType();
> 
> instead of the ternary.
A complication I'm seeing is that `getPointeeOrArrayElementType` returns a `Type` but getIntWidth wants a `QualType`. Some options that occurred to me:

- Is it acceptable to just wrap a `Type` in a `QualType`?
- I might be able to add a `getIntWidth(const Type*)` overload.
- Looks like I can skip the `getAs<PointerType>()` and just call `getPointeeType` directly. The line would be shorter but I would still need the ternary.


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

https://reviews.llvm.org/D81420





More information about the cfe-commits mailing list