diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst --- a/clang/docs/ClangCommandLineReference.rst +++ b/clang/docs/ClangCommandLineReference.rst @@ -870,7 +870,7 @@ Enable ODR indicator globals to avoid false ODR violation reports in partially sanitized programs at the cost of an increase in binary size -.. option:: -fsanitize-address-destructor-kind= +.. option:: -fsanitize-address-destructor= Set the kind of module destructors emitted by AddressSanitizer instrumentation. These destructors are emitted to unregister instrumented global variables when diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1540,8 +1540,7 @@ NegFlag>, Group; def sanitize_address_destructor_kind_EQ - : Joined<["-"], "fsanitize-address-destructor-kind=">, - MetaVarName<"">, + : Joined<["-"], "fsanitize-address-destructor=">, Flags<[CC1Option]>, HelpText<"Set destructor type used in ASan instrumentation">, Group, diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp --- a/clang/lib/Driver/SanitizerArgs.cpp +++ b/clang/lib/Driver/SanitizerArgs.cpp @@ -1098,7 +1098,7 @@ // Only pass the option to the frontend if the user requested, // otherwise the frontend will just use the codegen default. if (AsanDtorKind != llvm::AsanDtorKind::Invalid) { - CmdArgs.push_back(Args.MakeArgString("-fsanitize-address-destructor-kind=" + + CmdArgs.push_back(Args.MakeArgString("-fsanitize-address-destructor=" + AsanDtorKindToString(AsanDtorKind))); } diff --git a/clang/test/CodeGen/asan-destructor-kind.cpp b/clang/test/CodeGen/asan-destructor-kind.cpp --- a/clang/test/CodeGen/asan-destructor-kind.cpp +++ b/clang/test/CodeGen/asan-destructor-kind.cpp @@ -1,9 +1,9 @@ // Frontend rejects invalid option // RUN: not %clang_cc1 -fsanitize=address \ -// RUN: -fsanitize-address-destructor-kind=bad_arg -emit-llvm -o - \ +// RUN: -fsanitize-address-destructor=bad_arg -emit-llvm -o - \ // RUN: -triple x86_64-apple-macosx10.15 %s 2>&1 | \ // RUN: FileCheck %s --check-prefixes=CHECK-BAD-ARG -// CHECK-BAD-ARG: invalid value 'bad_arg' in '-fsanitize-address-destructor-kind=bad_arg' +// CHECK-BAD-ARG: invalid value 'bad_arg' in '-fsanitize-address-destructor=bad_arg' // Default is global dtor // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - -triple x86_64-apple-macosx10.15 \ @@ -16,12 +16,12 @@ // Explictly ask for global dtor // RUN: %clang_cc1 -fsanitize=address \ -// RUN: -fsanitize-address-destructor-kind=global -emit-llvm -o - \ +// RUN: -fsanitize-address-destructor=global -emit-llvm -o - \ // RUN: -triple x86_64-apple-macosx10.15 -fno-legacy-pass-manager %s | \ // RUN: FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR // // RUN: %clang_cc1 -fsanitize=address \ -// RUN: -fsanitize-address-destructor-kind=global -emit-llvm -o - \ +// RUN: -fsanitize-address-destructor=global -emit-llvm -o - \ // RUN: -triple x86_64-apple-macosx10.15 -flegacy-pass-manager %s | \ // RUN: FileCheck %s --check-prefixes=CHECK-GLOBAL-DTOR @@ -30,12 +30,12 @@ // Explictly ask for no dtors // RUN: %clang_cc1 -fsanitize=address \ -// RUN: -fsanitize-address-destructor-kind=none -emit-llvm -o - \ +// RUN: -fsanitize-address-destructor=none -emit-llvm -o - \ // RUN: -triple x86_64-apple-macosx10.15 -fno-legacy-pass-manager %s | \ // RUN: FileCheck %s --check-prefixes=CHECK-NONE-DTOR // // RUN: %clang_cc1 -fsanitize=address \ -// RUN: -fsanitize-address-destructor-kind=none -emit-llvm -o - \ +// RUN: -fsanitize-address-destructor=none -emit-llvm -o - \ // RUN: -triple x86_64-apple-macosx10.15 -flegacy-pass-manager %s | \ // RUN: FileCheck %s --check-prefixes=CHECK-NONE-DTOR diff --git a/clang/test/Driver/darwin-asan-mkernel-kext.c b/clang/test/Driver/darwin-asan-mkernel-kext.c --- a/clang/test/Driver/darwin-asan-mkernel-kext.c +++ b/clang/test/Driver/darwin-asan-mkernel-kext.c @@ -5,11 +5,11 @@ // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \ // RUN: -mkernel -### %s 2>&1 | FileCheck %s -// CHECK: "-fsanitize-address-destructor-kind=none" +// CHECK: "-fsanitize-address-destructor=none" // Check it's possible to override the driver's decision. // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=address -fapple-kext \ -// RUN: -mkernel -### -fsanitize-address-destructor-kind=global %s 2>&1 | \ +// RUN: -mkernel -### -fsanitize-address-destructor=global %s 2>&1 | \ // RUN: FileCheck -check-prefix=CHECK-OVERRIDE %s -// CHECK-OVERRIDE: "-fsanitize-address-destructor-kind=global" +// CHECK-OVERRIDE: "-fsanitize-address-destructor=global" diff --git a/clang/test/Driver/fsanitize-address-destructor-kind.c b/clang/test/Driver/fsanitize-address-destructor.c rename from clang/test/Driver/fsanitize-address-destructor-kind.c rename to clang/test/Driver/fsanitize-address-destructor.c --- a/clang/test/Driver/fsanitize-address-destructor-kind.c +++ b/clang/test/Driver/fsanitize-address-destructor.c @@ -2,19 +2,19 @@ // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address %s \ // RUN: -### 2>&1 | \ // RUN: FileCheck %s -// CHECK-NOT: -fsanitize-address-destructor-kind +// CHECK-NOT: -fsanitize-address-destructor // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \ -// RUN: -fsanitize-address-destructor-kind=none %s -### 2>&1 | \ +// RUN: -fsanitize-address-destructor=none %s -### 2>&1 | \ // RUN: FileCheck -check-prefix=CHECK-NONE-ARG %s -// CHECK-NONE-ARG: "-fsanitize-address-destructor-kind=none" +// CHECK-NONE-ARG: "-fsanitize-address-destructor=none" // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \ -// RUN: -fsanitize-address-destructor-kind=global %s -### 2>&1 | \ +// RUN: -fsanitize-address-destructor=global %s -### 2>&1 | \ // RUN: FileCheck -check-prefix=CHECK-GLOBAL-ARG %s -// CHECK-GLOBAL-ARG: "-fsanitize-address-destructor-kind=global" +// CHECK-GLOBAL-ARG: "-fsanitize-address-destructor=global" // RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \ -// RUN: -fsanitize-address-destructor-kind=bad_arg %s -### 2>&1 | \ +// RUN: -fsanitize-address-destructor=bad_arg %s -### 2>&1 | \ // RUN: FileCheck -check-prefix=CHECK-INVALID-ARG %s -// CHECK-INVALID-ARG: error: unsupported argument 'bad_arg' to option 'fsanitize-address-destructor-kind=' +// CHECK-INVALID-ARG: error: unsupported argument 'bad_arg' to option 'fsanitize-address-destructor='