[PATCH] D145848: [Driver] Correct -f(no-)xray-function-index behavior

Oleksii Lozovskyi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 11 00:28:09 PDT 2023


ilammy updated this revision to Diff 530284.
ilammy added a comment.

Addressing feedback by @MaskRay:

- Moved `// REQUIRES:` directive to the top of the test file


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145848/new/

https://reviews.llvm.org/D145848

Files:
  clang/include/clang/Driver/Options.td
  clang/test/CodeGen/xray-function-index.cpp


Index: clang/test/CodeGen/xray-function-index.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGen/xray-function-index.cpp
@@ -0,0 +1,9 @@
+// REQUIRES: x86-registered-target
+// 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", at progbits,_Z3foov
+// CHECK-ENABLED: .section xray_fn_idx,"awo", at progbits,_Z3foov
+// CHECK-DISABLED-NOT: .section xray_fn_idx
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2216,10 +2216,10 @@
   NegFlag<SetFalse>>;
 
 defm xray_function_index : BoolFOption<"xray-function-index",
-  CodeGenOpts<"XRayOmitFunctionIndex">, DefaultTrue,
-  NegFlag<SetFalse, [CC1Option], "Omit function index section at the"
+  CodeGenOpts<"XRayOmitFunctionIndex">, DefaultFalse,
+  NegFlag<SetTrue, [CC1Option], "Omit function index section at the"
           " expense of single-function patching performance">,
-  PosFlag<SetTrue>>;
+  PosFlag<SetFalse>>;
 
 def fxray_link_deps : Flag<["-"], "fxray-link-deps">, Group<f_Group>,
   Flags<[CC1Option]>,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145848.530284.patch
Type: text/x-patch
Size: 1576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230611/51798431/attachment.bin>


More information about the cfe-commits mailing list