Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/docs/AllocToken.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ The default mode to calculate tokens is:
pointers.

Other token ID assignment modes are supported, but they may be subject to
change or removal. These may (experimentally) be selected with ``-Xclang
-falloc-token-mode=<mode>``:
change or removal. These may (experimentally) be selected with
``-falloc-token-mode=<mode>``:

* ``typehash``: This mode assigns a token ID based on the hash of the allocated
type's name.
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Options/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -2776,7 +2776,7 @@ def falloc_token_max_EQ : Joined<["-"], "falloc-token-max=">,
HelpText<"Limit to maximum N allocation tokens (0 = target SIZE_MAX)">;

def falloc_token_mode_EQ : Joined<["-"], "falloc-token-mode=">,
Group<f_Group>, Visibility<[CC1Option]>,
Group<f_Group>, Visibility<[ClangOption, CC1Option]>, Flags<[HelpHidden]>,
HelpText<"Set the allocation token mode (experimental)">;

def fallow_runtime_check_skip_hot_cutoff_EQ
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7583,6 +7583,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
SanitizeArgs.addArgs(TC, Args, CmdArgs, InputType);

Args.AddLastArg(CmdArgs, options::OPT_falloc_token_max_EQ);
Args.AddLastArg(CmdArgs, options::OPT_falloc_token_mode_EQ);

#if CLANG_ENABLE_CIR
// Forward -mmlir arguments to to the MLIR option parser.
Expand Down
10 changes: 5 additions & 5 deletions clang/test/Driver/fsanitize-alloc-token.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
// RUN: not %clang --target=x86_64-linux-gnu -fsanitize=alloc-token -falloc-token-max=-1 %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-MAX %s
// CHECK-INVALID-MAX: error: invalid value

// RUN: %clang --target=x86_64-linux-gnu -Xclang -falloc-token-mode=increment %s -### 2>&1 | FileCheck -check-prefix=CHECK-MODE-INCREMENT %s
// RUN: %clang --target=x86_64-linux-gnu -falloc-token-mode=increment %s -### 2>&1 | FileCheck -check-prefix=CHECK-MODE-INCREMENT %s
// CHECK-MODE-INCREMENT: "-falloc-token-mode=increment"
// RUN: %clang --target=x86_64-linux-gnu -Xclang -falloc-token-mode=random %s -### 2>&1 | FileCheck -check-prefix=CHECK-MODE-RANDOM %s
// RUN: %clang --target=x86_64-linux-gnu -falloc-token-mode=random %s -### 2>&1 | FileCheck -check-prefix=CHECK-MODE-RANDOM %s
// CHECK-MODE-RANDOM: "-falloc-token-mode=random"
// RUN: %clang --target=x86_64-linux-gnu -Xclang -falloc-token-mode=typehash %s -### 2>&1 | FileCheck -check-prefix=CHECK-MODE-TYPEHASH %s
// RUN: %clang --target=x86_64-linux-gnu -falloc-token-mode=typehash %s -### 2>&1 | FileCheck -check-prefix=CHECK-MODE-TYPEHASH %s
// CHECK-MODE-TYPEHASH: "-falloc-token-mode=typehash"
// RUN: %clang --target=x86_64-linux-gnu -Xclang -falloc-token-mode=typehashpointersplit %s -### 2>&1 | FileCheck -check-prefix=CHECK-MODE-TYPEHASHPTRSPLIT %s
// RUN: %clang --target=x86_64-linux-gnu -falloc-token-mode=typehashpointersplit %s -### 2>&1 | FileCheck -check-prefix=CHECK-MODE-TYPEHASHPTRSPLIT %s
// CHECK-MODE-TYPEHASHPTRSPLIT: "-falloc-token-mode=typehashpointersplit"
// RUN: not %clang --target=x86_64-linux-gnu -Xclang -falloc-token-mode=asdf %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-MODE %s
// RUN: not %clang --target=x86_64-linux-gnu -falloc-token-mode=asdf %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-MODE %s
// CHECK-INVALID-MODE: error: invalid value 'asdf'
Loading