summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-03-06 07:08:21 +0000
committerDean Michael Berris <dberris@google.com>2017-03-06 07:08:21 +0000
commitf037bd533e9461b203548e6c1e8fca08155a0a51 (patch)
treedff62d158af1f9ccbf536c47fd6045657ae848e3 /lib/CodeGen/CodeGenFunction.cpp
parenta7325b067d8d0ebf370ffbffb0f861d9252c551c (diff)
[XRay] [clang] Allow logging the first argument of a function call.
Summary: Functions with the "xray_log_args" attribute will tell LLVM to emit a special XRay sled for compiler-rt to copy any call arguments to your logging handler. Reviewers: dberris Reviewed By: dberris Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29704 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296999 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 1ebfd798c5..bad963b6fa 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -779,6 +779,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
Fn->addFnAttr("function-instrument", "xray-always");
if (XRayAttr->neverXRayInstrument())
Fn->addFnAttr("function-instrument", "xray-never");
+ if (const auto *LogArgs = D->getAttr<XRayLogArgsAttr>()) {
+ Fn->addFnAttr("xray-log-args",
+ llvm::utostr(LogArgs->getArgumentCount()));
+ }
} else {
Fn->addFnAttr(
"xray-instruction-threshold",