[llvm-branch-commits] [clang] [clang] Define ptrauth_sign_constant builtin. (PR #93904)

Ahmed Bougacha via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 18 18:30:17 PDT 2024


================
@@ -2030,8 +2030,25 @@ bool Sema::checkConstantPointerAuthKey(Expr *Arg, unsigned &Result) {
   return false;
 }
 
+static std::pair<const ValueDecl *, CharUnits>
+findConstantBaseAndOffset(Sema &S, Expr *E) {
+  // Must evaluate as a pointer.
+  Expr::EvalResult Result;
+  if (!E->EvaluateAsRValue(Result, S.Context) || !Result.Val.isLValue())
+    return std::make_pair(nullptr, CharUnits());
+
+  // Base must be a declaration and can't be weakly imported.
----------------
ahmedbougacha wrote:

I removed the weakref base pointer check because that's currently supported in the qualifier (and I think this should have also checked for weakimport as well for the cases I care about), so the backend has to deal with ptrauth weak refs anyway.  There's a higher-level set of problems around how we deal with weak refs in general, but that's a separate topic.

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


More information about the llvm-branch-commits mailing list