Skip to content

Commit 6c1b359

Browse files
committed
Revert "[clang] Remove unused CodeGen:: ptrauth helpers. NFCI."
This reverts commit 6fe29b9.
1 parent b138afd commit 6c1b359

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

clang/include/clang/CodeGen/CodeGenABITypes.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,20 @@ llvm::Type *convertTypeForMemory(CodeGenModule &CGM, QualType T);
120120
unsigned getLLVMFieldNumber(CodeGenModule &CGM,
121121
const RecordDecl *RD, const FieldDecl *FD);
122122

123+
/// Return a declaration discriminator for the given global decl.
124+
uint16_t getPointerAuthDeclDiscriminator(CodeGenModule &CGM, GlobalDecl GD);
125+
126+
/// Return a type discriminator for the given function type.
127+
uint16_t getPointerAuthTypeDiscriminator(CodeGenModule &CGM,
128+
QualType FunctionType);
129+
130+
/// Return a signed constant pointer.
131+
llvm::Constant *getConstantSignedPointer(CodeGenModule &CGM,
132+
llvm::Constant *pointer,
133+
unsigned key,
134+
llvm::Constant *storageAddress,
135+
llvm::ConstantInt *otherDiscriminator);
136+
123137
/// Given the language and code-generation options that Clang was configured
124138
/// with, set the default LLVM IR attributes for a function definition.
125139
/// The attributes set here are mostly global target-configuration and

clang/lib/CodeGen/CGPointerAuth.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ llvm::ConstantInt *CodeGenModule::getPointerAuthOtherDiscriminator(
5353
llvm_unreachable("bad discrimination kind");
5454
}
5555

56+
uint16_t CodeGen::getPointerAuthTypeDiscriminator(CodeGenModule &CGM,
57+
QualType FunctionType) {
58+
return CGM.getContext().getPointerAuthTypeDiscriminator(FunctionType);
59+
}
60+
61+
uint16_t CodeGen::getPointerAuthDeclDiscriminator(CodeGenModule &CGM,
62+
GlobalDecl Declaration) {
63+
return CGM.getPointerAuthDeclDiscriminator(Declaration);
64+
}
65+
5666
/// Return the "other" decl-specific discriminator for the given decl.
5767
uint16_t
5868
CodeGenModule::getPointerAuthDeclDiscriminator(GlobalDecl Declaration) {
@@ -588,6 +598,15 @@ llvm::Constant *CodeGenModule::getConstantSignedPointer(
588598
OtherDiscriminator);
589599
}
590600

601+
llvm::Constant *
602+
CodeGen::getConstantSignedPointer(CodeGenModule &CGM,
603+
llvm::Constant *pointer, unsigned key,
604+
llvm::Constant *storageAddress,
605+
llvm::ConstantInt *otherDiscriminator) {
606+
return CGM.getConstantSignedPointer(pointer, key, storageAddress,
607+
otherDiscriminator);
608+
}
609+
591610
void CodeGenModule::destroyConstantSignedPointerCaches() {
592611
destroyCache<ByConstantCacheTy>(ConstantSignedPointersByConstant);
593612
destroyCache<ByDeclCacheTy>(ConstantSignedPointersByDecl);

0 commit comments

Comments
 (0)