[all-commits] [llvm/llvm-project] 150053: [AllocToken] Fix and clarify -falloc-token-max=0 (...

Marco Elver via All-commits all-commits at lists.llvm.org
Wed Nov 19 03:15:37 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 150053627d14679f3db52d78b640a3e8781de828
      https://github.com/llvm/llvm-project/commit/150053627d14679f3db52d78b640a3e8781de828
  Author: Marco Elver <elver at google.com>
  Date:   2025-11-19 (Wed, 19 Nov 2025)

  Changed paths:
    M clang/docs/AllocToken.rst
    M clang/include/clang/Basic/LangOptions.h
    M clang/include/clang/Options/Options.td
    M clang/lib/AST/ByteCode/InterpBuiltin.cpp
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/SemaCXX/alloc-token.cpp
    M llvm/lib/Transforms/Instrumentation/AllocToken.cpp

  Log Message:
  -----------
  [AllocToken] Fix and clarify -falloc-token-max=0 (#168689)

The option -falloc-token-max=0 is supposed to be usable to override
previous settings back to the target default max tokens (SIZE_MAX).

This did not work for the builtin:
```
| executed command: clang -cc1 [..] -nostdsysteminc -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -verify clang/test/SemaCXX/alloc-token.cpp -falloc-token-max=0
| clang: llvm/lib/Support/AllocToken.cpp:38: std::optional<uint64_t> llvm::getAllocToken(AllocTokenMode, const AllocTokenMetadata &, uint64_t): Assertion `MaxTokens && "Must provide non-zero max tokens"' failed.
```

Fix it by also picking the default if "0" is passed.

Improve the documentation to be clearer what the value of "0" means.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list