summaryrefslogtreecommitdiffstats
path: root/clang/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
commit418da3fe80230c26afaa29db0787f709c67c74c3 (patch)
treef79afaeafdf792497a8c5896f4d7c1708d8b36e5 /clang/lib/CodeGen/CodeGenFunction.cpp
parent7e8eea429f16c8a36befb9e2ea3c0fbf9a33f283 (diff)
downloadbcm5719-llvm-418da3fe80230c26afaa29db0787f709c67c74c3.tar.gz
bcm5719-llvm-418da3fe80230c26afaa29db0787f709c67c74c3.zip
[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 llvm-svn: 296999
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 1ebfd798c55..bad963b6fa3 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/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",
OpenPOWER on IntegriCloud