diff options
| author | Oleksii Lozovskyi <me@ilammy.net> | 2022-09-24 21:54:47 +0900 |
|---|---|---|
| committer | Oleksii Lozovskyi <me@ilammy.net> | 2023-02-09 12:28:00 +0900 |
| commit | b3cadd2dcfe37836cdbfd6c5871bd8398748ac3f (patch) | |
| tree | 1dd9bdfe431429a803d51fd44cc9e7b392f53533 /compiler/rustc_codegen_llvm/src/attributes.rs | |
| parent | d748f085473a12fc6fdde3874a8f0f276c1657c6 (diff) | |
| download | rust-b3cadd2dcfe37836cdbfd6c5871bd8398748ac3f.tar.gz rust-b3cadd2dcfe37836cdbfd6c5871bd8398748ac3f.zip | |
Allow multiple instrumentation attributes
Four because that's the new reasonable maximum for XRay instrumentation attributes in the following commit.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/attributes.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/attributes.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 54ac7a46cf2..0494bd7a19b 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -118,7 +118,8 @@ pub fn frame_pointer_type_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attr /// Tell LLVM what instrument function to insert. #[inline] -fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> { +fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'ll Attribute; 4]> { + let mut attrs = SmallVec::new(); if cx.sess().opts.unstable_opts.instrument_mcount { // Similar to `clang -pg` behavior. Handled by the // `post-inline-ee-instrument` LLVM pass. @@ -127,14 +128,13 @@ fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribu // See test/CodeGen/mcount.c in clang. let mcount_name = cx.sess().target.mcount.as_ref(); - Some(llvm::CreateAttrStringValue( + attrs.push(llvm::CreateAttrStringValue( cx.llcx, "instrument-function-entry-inlined", &mcount_name, - )) - } else { - None + )); } + attrs } fn nojumptables_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> { |
