[Assignment Tracking] Fix -fexperimental-assignment-tracking cc1 flag

This change allows `-fexperimental-assignment-tracking` to be negated using the
negative equivalent `-fno-experimental-assignment-tracking`, and fixes the flag
so that the default behaviour can be changed (currently the default is still
false / disabled).

Reviewed By: StephenTozer

Differential Revision: https://reviews.llvm.org/D142029
This commit is contained in:
OCHyams
2023-01-20 14:30:58 +00:00
parent 8421004cd5
commit 0a996c82a7
2 changed files with 19 additions and 12 deletions

View File

@@ -5702,10 +5702,11 @@ def fctor_dtor_return_this : Flag<["-"], "fctor-dtor-return-this">,
"and non-deleting destructors. (No effect on Microsoft ABI)">,
MarshallingInfoFlag<CodeGenOpts<"CtorDtorReturnThis">>;
def fexperimental_assignment_tracking :
Flag<["-"], "fexperimental-assignment-tracking">, Group<f_Group>,
HelpText<"Enable assignment tracking debug info">,
MarshallingInfoFlag<CodeGenOpts<"EnableAssignmentTracking">>;
defm experimental_assignment_tracking :
BoolOption<"f", "experimental-assignment-tracking",
CodeGenOpts<"EnableAssignmentTracking">, DefaultFalse,
PosFlag<SetTrue, [CC1Option]>, NegFlag<SetFalse>, BothFlags<[CoreOption]>>,
Group<f_Group>;
} // let Flags = [CC1Option, NoDriverOption]

View File

@@ -1,18 +1,24 @@
//// Explicitly enabled:
// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone -O0 \
// RUN: -emit-llvm -fexperimental-assignment-tracking %s -o - \
// RUN: | FileCheck %s --check-prefixes=FLAG
// RUN: | FileCheck %s --check-prefixes=ENABLE
//// Disabled by default:
// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone -O0 \
// RUN: -emit-llvm %s -o - \
// RUN: | FileCheck %s --check-prefixes=NO-FLAG
// RUN: | FileCheck %s --check-prefixes=DISABLE
//// Explicitly disabled:
// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -debug-info-kind=standalone -O0 \
// RUN: -emit-llvm %s -o - -fno-experimental-assignment-tracking \
// RUN: | FileCheck %s --check-prefixes=DISABLE
// Check some assignment-tracking stuff appears in the output when the flag
// -fexperimental-assignment-tracking is used, and that it doesn't when
// the flag is not used (default behaviour: no assignment tracking).
// -fexperimental-assignment-tracking is used, that it doesn't when
// -fno-experimental-assignment-tracking is used or neither flag is specified.
// FLAG: DIAssignID
// FLAG: dbg.assign
// ENABLE: DIAssignID
// ENABLE: dbg.assign
// NO-FLAG-NOT: DIAssignID
// NO-FLAG-NOT: dbg.assign
// DISABLE-NOT: DIAssignID
// DISABLE-NOT: dbg.assign
void fun(int a) {}