================ @@ -0,0 +1,63 @@ +//===--- CGPointerAuth.cpp - IR generation for pointer authentication -----===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file contains common routines relating to the emission of +// pointer authentication operations. +// +//===----------------------------------------------------------------------===// + +#include "CodeGenModule.h" +#include "clang/CodeGen/CodeGenABITypes.h" + +using namespace clang; +using namespace CodeGen; + +/// Build a signed-pointer "ptrauth" constant. +static llvm::ConstantPtrAuth * +buildConstantAddress(CodeGenModule &CGM, llvm::Constant *Pointer, unsigned Key, + llvm::Constant *StorageAddress, + llvm::Constant *OtherDiscriminator) { + llvm::Constant *AddressDiscriminator = nullptr; ---------------- kovdan01 wrote:
Do we need to set this to `nullptr`? We 100% define this in either `if` or `else` branch and do not use the unitialized value before. Same applies to `IntegerDiscriminator` below. You can also use smth like ``` llvm::Constant *AddressDiscriminator = (StorageAddress ? StorageAddress : llvm::Constant::getNullValue(CGM.UnqualPtrTy)); assert(!StorageAddress || (StorageAddress->getType() == CGM.UnqualPtrTy)); ``` https://github.com/llvm/llvm-project/pull/93904 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits