[clang] [clang-tools-extra] [PAC][clang] Define `PointerAuthQualifier` and `PointerAuthenticationMode` (PR #84384)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 18 07:43:40 PDT 2024


AaronBallman wrote:

> I've fixed the build failure https://buildkite.com/llvm-project/github-pull-requests/builds/55986 in clang-tidy by only taking fast qualifiers from the `uint64_t` opaque value and casting the value to `unsigned` - see [e3cb910](https://github.com/llvm/llvm-project/commit/e3cb910ebce1ffa187816a20ce52e6303799665a). It should be OK to strip bits which not present in `FastMask` since `QualType` constructor seems to expect fast qualifiers only - see this in `QualType` definition:
> 
> ```
> llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
>                      Qualifiers::FastWidth> Value;
> // ...
> QualType(const Type *Ptr, unsigned Quals) : Value(Ptr, Quals) {}
> QualType(const ExtQuals *Ptr, unsigned Quals) : Value(Ptr, Quals) {}
> ```
> 
> @AaronBallman Please let me know if the approach from [e3cb910](https://github.com/llvm/llvm-project/commit/e3cb910ebce1ffa187816a20ce52e6303799665a) is correct or if we should fix the issue somehow differently.

This seems like the correct approach to me. Maybe someday we can use a strong typedef for the fast qualifiers so there's less risk of accidents here, but that's by no means something you need to handle.

https://github.com/llvm/llvm-project/pull/84384


More information about the cfe-commits mailing list