[clang] [PAuth] Use different discriminators for __int128_t / __uint128_t / _BitInt(n) (PR #140276)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 1 23:58:36 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,c -- clang/lib/AST/ASTContext.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Frontend/CompilerInvocation.cpp clang/test/CodeGen/ptrauth-function-type-discriminator.c
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index cdf239e37..f6a06e291 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -3402,7 +3402,8 @@ static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx,
case Type::BitInt:
if (Ctx.getLangOpts().PointerAuthFunctionTypeDiscrimination128) {
const auto *BtTy = T->castAs<BitIntType>();
- OS << "D" << (BtTy->isUnsigned() ? "U" : "B") << BtTy->getNumBits() << "_";
+ OS << "D" << (BtTy->isUnsigned() ? "U" : "B") << BtTy->getNumBits()
+ << "_";
} else
OS << "?";
return;
@@ -3414,14 +3415,16 @@ static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx,
#define SIGNED_TYPE(Id, SingletonId) \
case BuiltinType::Id: \
OS << (Kind == BuiltinType::Int128 && \
- Ctx.getLangOpts().PointerAuthFunctionTypeDiscrimination128 ? \
- "n" : "i"); \
+ Ctx.getLangOpts().PointerAuthFunctionTypeDiscrimination128 \
+ ? "n" \
+ : "i"); \
return;
#define UNSIGNED_TYPE(Id, SingletonId) \
case BuiltinType::Id: \
OS << (Kind == BuiltinType::UInt128 && \
- Ctx.getLangOpts().PointerAuthFunctionTypeDiscrimination128 ? \
- "o" : "i"); \
+ Ctx.getLangOpts().PointerAuthFunctionTypeDiscrimination128 \
+ ? "o" \
+ : "i"); \
return;
#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
#define BUILTIN_TYPE(Id, SingletonId)
``````````
</details>
https://github.com/llvm/llvm-project/pull/140276
More information about the cfe-commits
mailing list