Skip to content

[sanitizer] Fix empty string in unsupported argument error for -fsanitize-trap #136549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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/lib/Driver/SanitizerArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ parseSanitizeArgs(const Driver &D, const llvm::opt::ArgList &Args,
Add & AlwaysOut & ~DiagnosedAlwaysOutViolations) {
if (DiagnoseErrors) {
SanitizerSet SetToDiagnose;
SetToDiagnose.Mask |= KindsToDiagnose;
SetToDiagnose.Mask |= expandSanitizerGroups(KindsToDiagnose);
D.Diag(diag::err_drv_unsupported_option_argument)
<< Arg->getSpelling() << toString(SetToDiagnose);
DiagnosedAlwaysOutViolations |= KindsToDiagnose;
Expand All @@ -302,7 +302,7 @@ parseSanitizeArgs(const Driver &D, const llvm::opt::ArgList &Args,
Remove & AlwaysIn & ~DiagnosedAlwaysInViolations) {
if (DiagnoseErrors) {
SanitizerSet SetToDiagnose;
SetToDiagnose.Mask |= KindsToDiagnose;
SetToDiagnose.Mask |= expandSanitizerGroups(KindsToDiagnose);
D.Diag(diag::err_drv_unsupported_option_argument)
<< Arg->getSpelling() << toString(SetToDiagnose);
DiagnosedAlwaysInViolations |= KindsToDiagnose;
Expand Down
3 changes: 3 additions & 0 deletions clang/test/Driver/fsanitize.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@
// RUN: not %clang --target=aarch64-linux -fsanitize=memtag -I +mte %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANMT-NOMT-1
// CHECK-SANMT-NOMT-1: '-fsanitize=memtag-stack' requires hardware support (+memtag)

// RUN: not %clang --target=aarch64-linux-android31 -fsanitize-trap=memtag -march=armv8-a+memtag -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANMT-TRAP
// CHECK-SANMT-TRAP: error: unsupported argument 'memtag-stack,memtag-heap,memtag-globals' to option '-fsanitize-trap='

// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-address-use-after-scope %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-USE-AFTER-SCOPE
// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fsanitize-address-use-after-scope -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-USE-AFTER-SCOPE
// CHECK-USE-AFTER-SCOPE: -cc1{{.*}}-fsanitize-address-use-after-scope
Expand Down