Skip to content

Commit 0bc0209

Browse files
[clang] Upstream clang::CodeGen::getConstantSignedPointer (#154453)
This function was introduced to Swift's fork in swiftlang@a9dd959e60c32#diff-db27b2738ad84e3f1093f9174710710478f853804d995a6de2816d1caaad30d1. The Swift compiler cannot use `CodeGenModule::getConstantSignedPointer`, to which it forwards, because that is a private interface.
1 parent 6167b1e commit 0bc0209

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

clang/include/clang/CodeGen/CodeGenABITypes.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
namespace llvm {
3333
class AttrBuilder;
3434
class Constant;
35+
class ConstantInt;
3536
class Function;
3637
class FunctionType;
3738
class Type;
@@ -126,6 +127,12 @@ uint16_t getPointerAuthDeclDiscriminator(CodeGenModule &CGM, GlobalDecl GD);
126127
uint16_t getPointerAuthTypeDiscriminator(CodeGenModule &CGM,
127128
QualType FunctionType);
128129

130+
/// Return a signed constant pointer.
131+
llvm::Constant *getConstantSignedPointer(CodeGenModule &CGM,
132+
llvm::Constant *Pointer, unsigned Key,
133+
llvm::Constant *StorageAddress,
134+
llvm::ConstantInt *OtherDiscriminator);
135+
129136
/// Given the language and code-generation options that Clang was configured
130137
/// with, set the default LLVM IR attributes for a function definition.
131138
/// The attributes set here are mostly global target-configuration and

clang/lib/CodeGen/CGPointerAuth.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,14 @@ llvm::Constant *CodeGenModule::getConstantSignedPointer(
466466
OtherDiscriminator);
467467
}
468468

469+
llvm::Constant *
470+
CodeGen::getConstantSignedPointer(CodeGenModule &CGM, llvm::Constant *Pointer,
471+
unsigned Key, llvm::Constant *StorageAddress,
472+
llvm::ConstantInt *OtherDiscriminator) {
473+
return CGM.getConstantSignedPointer(Pointer, Key, StorageAddress,
474+
OtherDiscriminator);
475+
}
476+
469477
/// If applicable, sign a given constant function pointer with the ABI rules for
470478
/// functionType.
471479
llvm::Constant *CodeGenModule::getFunctionPointer(llvm::Constant *Pointer,

0 commit comments

Comments
 (0)