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 @@ -2173,10 +2173,10 @@ NegFlag>; defm xray_function_index : BoolFOption<"xray-function-index", - CodeGenOpts<"XRayOmitFunctionIndex">, DefaultTrue, - NegFlag, DefaultFalse, + NegFlag, - PosFlag>; + PosFlag>; def fxray_link_deps : Flag<["-"], "fxray-link-deps">, Group, Flags<[CC1Option]>, diff --git a/clang/test/CodeGen/xray-function-index.cpp b/clang/test/CodeGen/xray-function-index.cpp new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/xray-function-index.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fxray-instrument -x c++ -std=c++11 -triple x86_64-unknown-linux-gnu -S -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-ENABLED +// RUN: %clang_cc1 -fxray-instrument -fno-xray-function-index -x c++ -std=c++11 -triple x86_64-unknown-linux-gnu -S -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DISABLED + +[[clang::xray_always_instrument]] void foo() {} + +// CHECK-LABEL: .section xray_instr_map,"ao",@progbits,_Z3foov +// CHECK-ENABLED: .section xray_fn_idx,"awo",@progbits,_Z3foov +// CHECK-DISABLED-NOT: xray_fn_idx