diff options
| author | bit-aloo <sshourya17@gmail.com> | 2025-04-20 15:45:30 +0530 | 
|---|---|---|
| committer | bit-aloo <sshourya17@gmail.com> | 2025-04-25 11:09:52 +0530 | 
| commit | f319dd909ed3ec1c0d04ede06b5864badddefb15 (patch) | |
| tree | 6f1f8027e5dc940c5212aceb9256652075e2766a /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 847e3ee6b0e614937eee4e6d8f61094411eadcc0 (diff) | |
| download | rust-f319dd909ed3ec1c0d04ede06b5864badddefb15.tar.gz rust-f319dd909ed3ec1c0d04ede06b5864badddefb15.zip | |
add llvm wrappers and corresponding methods in attribute
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 19 | 
1 files changed, 19 insertions, 0 deletions
| diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 5f0e4d745e8..2871b3c0293 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -973,6 +973,25 @@ extern "C" LLVMMetadataRef LLVMRustDIGetInstMetadata(LLVMValueRef x) { return nullptr; } +extern "C" void +LLVMRustRemoveEnumAttributeAtIndex(LLVMValueRef F, size_t index, + LLVMRustAttributeKind RustAttr) { + LLVMRemoveEnumAttributeAtIndex(F, index, fromRust(RustAttr)); +} + +extern "C" bool LLVMRustHasFnAttribute(LLVMValueRef F, const char *Name) { + if (auto *Fn = dyn_cast<Function>(unwrap<Value>(F))) { + return Fn->hasFnAttribute(Name); + } + return false; +} + +extern "C" void LLVMRustRemoveFnAttribute(LLVMValueRef Fn, const char *Name) { + if (auto *F = dyn_cast<Function>(unwrap<Value>(Fn))) { + F->removeFnAttr(Name); + } +} + extern "C" void LLVMRustGlobalAddMetadata(LLVMValueRef Global, unsigned Kind, LLVMMetadataRef MD) { unwrap<GlobalObject>(Global)->addMetadata(Kind, *unwrap<MDNode>(MD)); | 
