Skip to content

Commit d1d2564

Browse files
authored
[clang][bytecode] Handle UETT_PtrAuthTypeDiscriminator (#122941)
1 parent 7201cae commit d1d2564

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,6 +2141,16 @@ bool Compiler<Emitter>::VisitUnaryExprOrTypeTraitExpr(
21412141
return this->emitConst(ASTCtx.toCharUnitsFromBits(Bits).getQuantity(), E);
21422142
}
21432143

2144+
if (Kind == UETT_PtrAuthTypeDiscriminator) {
2145+
if (E->getArgumentType()->isDependentType())
2146+
return this->emitInvalid(E);
2147+
2148+
return this->emitConst(
2149+
const_cast<ASTContext &>(ASTCtx).getPointerAuthTypeDiscriminator(
2150+
E->getArgumentType()),
2151+
E);
2152+
}
2153+
21442154
return false;
21452155
}
21462156

clang/test/SemaCXX/ptrauth-type-discriminator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++17 -Wno-vla -fsyntax-only -verify -fptrauth-intrinsics %s
22
// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++17 -Wno-vla -fsyntax-only -verify -fptrauth-intrinsics %s
33

4+
// RUN: %clang_cc1 -triple arm64-apple-ios -std=c++17 -Wno-vla -fsyntax-only -verify -fptrauth-intrinsics -fexperimental-new-constant-interpreter %s
5+
// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++17 -Wno-vla -fsyntax-only -verify -fptrauth-intrinsics -fexperimental-new-constant-interpreter %s
6+
47
// RUN: not %clang_cc1 -triple arm64-apple-ios -std=c++17 -Wno-vla -fsyntax-only %s 2>&1 | FileCheck %s
58
// CHECK: this target does not support pointer authentication
69

0 commit comments

Comments
 (0)