[PATCH] D45354: [XRay][clang] Add a flag to enable/disable linking XRay deps explicitly
Dean Michael Berris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 5 22:32:02 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329376: [XRay][clang] Add a flag to enable/disable linking XRay deps explicitly (authored by dberris, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D45354?vs=141279&id=141281#toc
Repository:
rL LLVM
https://reviews.llvm.org/D45354
Files:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/XRayArgs.h
cfe/trunk/lib/Driver/XRayArgs.cpp
cfe/trunk/test/Driver/XRay/xray-nolinkdeps.cpp
Index: cfe/trunk/include/clang/Driver/Options.td
===================================================================
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1107,6 +1107,12 @@
def fnoxray_always_emit_customevents : Flag<["-"], "fno-xray-always-emit-customevents">, Group<f_Group>,
Flags<[CC1Option]>;
+def fxray_link_deps : Flag<["-"], "fxray-link-deps">, Group<f_Group>,
+ Flags<[CC1Option]>,
+ HelpText<"Tells clang to add the link dependencies for XRay.">;
+def fnoxray_link_deps : Flag<["-"], "fnoxray-link-deps">, Group<f_Group>,
+ Flags<[CC1Option]>;
+
def ffine_grained_bitfield_accesses : Flag<["-"],
"ffine-grained-bitfield-accesses">, Group<f_clang_Group>, Flags<[CC1Option]>,
HelpText<"Use separate accesses for bitfields with legal widths and alignments.">;
Index: cfe/trunk/include/clang/Driver/XRayArgs.h
===================================================================
--- cfe/trunk/include/clang/Driver/XRayArgs.h
+++ cfe/trunk/include/clang/Driver/XRayArgs.h
@@ -25,14 +25,15 @@
bool XRayInstrument = false;
int InstructionThreshold = 200;
bool XRayAlwaysEmitCustomEvents = false;
+ bool XRayRT = true;
public:
/// Parses the XRay arguments from an argument list.
XRayArgs(const ToolChain &TC, const llvm::opt::ArgList &Args);
void addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs, types::ID InputType) const;
- bool needsXRayRt() const { return XRayInstrument; }
+ bool needsXRayRt() const { return XRayInstrument && XRayRT; }
};
} // namespace driver
Index: cfe/trunk/test/Driver/XRay/xray-nolinkdeps.cpp
===================================================================
--- cfe/trunk/test/Driver/XRay/xray-nolinkdeps.cpp
+++ cfe/trunk/test/Driver/XRay/xray-nolinkdeps.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang -v -o /dev/null -fxray-instrument -fnoxray-link-deps %s -### \
+// RUN: 2>&1 | FileCheck --check-prefix DISABLE %s
+// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-link-deps %s -### \
+// RUN: 2>&1 | FileCheck --check-prefix ENABLE %s
+// ENABLE: clang_rt.xray
+// DISABLE-NOT: clang_rt.xray
Index: cfe/trunk/lib/Driver/XRayArgs.cpp
===================================================================
--- cfe/trunk/lib/Driver/XRayArgs.cpp
+++ cfe/trunk/lib/Driver/XRayArgs.cpp
@@ -76,6 +76,10 @@
options::OPT_fnoxray_always_emit_customevents, false))
XRayAlwaysEmitCustomEvents = true;
+ if (!Args.hasFlag(options::OPT_fxray_link_deps,
+ options::OPT_fnoxray_link_deps, true))
+ XRayRT = false;
+
// Validate the always/never attribute files. We also make sure that they
// are treated as actual dependencies.
for (const auto &Filename :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45354.141281.patch
Type: text/x-patch
Size: 2822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180406/ded28de0/attachment.bin>
More information about the llvm-commits
mailing list