From 170429e2905b3ee19e06f5549960be72183a69ac Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Wed, 24 May 2017 05:46:36 +0000 Subject: [XRay][clang] Allow imbuing arg1 logging attribute via -fxray-always-instrument= Summary: This change allows us to add arg1 logging support to functions through the special case list provided through -fxray-always-instrument=. This is useful for adding arg1 logging to functions that are either in headers that users don't have control over (i.e. cannot change the source) or would rather not do. It only takes effect when the pattern is matched through the "fun:" special case, as a category. As in: fun:*pattern=arg1 Reviewers: pelikan, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33392 llvm-svn: 303719 --- clang/lib/CodeGen/CodeGenModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 9d0f802ece0..db8f8d32abb 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1508,6 +1508,10 @@ bool CodeGenModule::imbueXRayAttrs(llvm::Function *Fn, SourceLocation Loc, case ImbueAttr::ALWAYS: Fn->addFnAttr("function-instrument", "xray-always"); break; + case ImbueAttr::ALWAYS_ARG1: + Fn->addFnAttr("function-instrument", "xray-always"); + Fn->addFnAttr("xray-log-args", "1"); + break; case ImbueAttr::NEVER: Fn->addFnAttr("function-instrument", "xray-never"); break; -- cgit v1.2.3