[llvm-branch-commits] [clang] [MSVC] work-around for compile time issue 102513 (PR #111314)
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/111314 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [clang] Don't evaluate the initializer of constexpr-unknown parameters. (#142498) (PR #142648)
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/142648 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Clang] Implement constexpr evaluation for __builtin_infer_alloc_token() (PR #163639)
@@ -1306,6 +1308,44 @@ interp__builtin_ptrauth_string_discriminator(InterpState
&S, CodePtr OpPC,
return true;
}
+static bool interp__builtin_infer_alloc_token(InterpState &S, CodePtr OpPC,
+ const InterpFrame *Frame,
+ const CallExpr *Call) {
+ const ASTContext &Ctx = S.getASTContext();
+ const uint64_t BitWidth = Ctx.getTypeSize(Ctx.getSizeType());
+ const auto Mode =
+ Ctx.getLangOpts().AllocTokenMode.value_or(llvm::DefaultAllocTokenMode);
+ const uint64_t MaxTokens =
+ Ctx.getLangOpts().AllocTokenMax.value_or(~0ULL >> (64 - BitWidth));
+
+ // We do not read any of the arguments; discard them.
+ for (int I = Call->getNumArgs() - 1; I >= 0; --I)
+discard(S.Stk, *S.getContext().classify(Call->getArg(I)));
+
+ // Note: Type inference from a surrounding cast is not supported in
+ // constexpr evaluation.
+ QualType AllocType = infer_alloc::inferPossibleType(Call, Ctx, nullptr);
+ if (AllocType.isNull()) {
+S.CCEDiag(Call) << "could not infer allocation type";
+return false;
+ }
+
+ auto ATMD = infer_alloc::getAllocTokenMetadata(AllocType, Ctx);
+ if (!ATMD) {
+S.CCEDiag(Call) << "could not get token metadata for type";
tbaederr wrote:
Do we not have diagnostic IDs for these?
https://github.com/llvm/llvm-project/pull/163639
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Clang] Implement constexpr evaluation for __builtin_infer_alloc_token() (PR #163639)
@@ -1306,6 +1308,44 @@ interp__builtin_ptrauth_string_discriminator(InterpState
&S, CodePtr OpPC,
return true;
}
+static bool interp__builtin_infer_alloc_token(InterpState &S, CodePtr OpPC,
+ const InterpFrame *Frame,
+ const CallExpr *Call) {
+ const ASTContext &Ctx = S.getASTContext();
+ const uint64_t BitWidth = Ctx.getTypeSize(Ctx.getSizeType());
+ const auto Mode =
+ Ctx.getLangOpts().AllocTokenMode.value_or(llvm::DefaultAllocTokenMode);
+ const uint64_t MaxTokens =
+ Ctx.getLangOpts().AllocTokenMax.value_or(~0ULL >> (64 - BitWidth));
tbaederr wrote:
```suggestion
uint64_t BitWidth = Ctx.getTypeSize(Ctx.getSizeType());
auto Mode =
Ctx.getLangOpts().AllocTokenMode.value_or(llvm::DefaultAllocTokenMode);
uint64_t MaxTokens =
Ctx.getLangOpts().AllocTokenMax.value_or(~0ULL >> (64 - BitWidth));
```
https://github.com/llvm/llvm-project/pull/163639
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Clang] Implement constexpr evaluation for __builtin_infer_alloc_token() (PR #163639)
@@ -1306,6 +1308,44 @@ interp__builtin_ptrauth_string_discriminator(InterpState
&S, CodePtr OpPC,
return true;
}
+static bool interp__builtin_infer_alloc_token(InterpState &S, CodePtr OpPC,
+ const InterpFrame *Frame,
+ const CallExpr *Call) {
+ const ASTContext &Ctx = S.getASTContext();
tbaederr wrote:
```suggestion
const ASTContext &ASTCtx = S.getASTContext();
```
https://github.com/llvm/llvm-project/pull/163639
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [Clang] Implement constexpr evaluation for __builtin_infer_alloc_token() (PR #163639)
https://github.com/tbaederr approved this pull request. https://github.com/llvm/llvm-project/pull/163639 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
