LLVM  13.0.0git
ObjCARCUtil.h
Go to the documentation of this file.
1 //===- ObjCARCUtil.h - ObjC ARC Utility Functions ---------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 /// This file defines ARC utility functions which are used by various parts of
10 /// the compiler.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_IR_OBJCARCUTIL_H
15 #define LLVM_IR_OBJCARCUTIL_H
16 
17 #include "llvm/IR/InstrTypes.h"
18 #include "llvm/IR/LLVMContext.h"
19 
20 namespace llvm {
21 namespace objcarc {
22 
23 inline const char *getRVMarkerModuleFlagStr() {
24  return "clang.arc.retainAutoreleasedReturnValueMarker";
25 }
26 
28 
31  return IsRetain ? RVOB_Retain : RVOB_Claim;
32 }
33 
34 inline bool hasAttachedCallOpBundle(const CallBase *CB, bool IsRetain) {
36  if (!B.hasValue())
37  return false;
38  return cast<ConstantInt>(B->Inputs[0])->getZExtValue() ==
40 }
41 
42 inline bool hasAttachedCallOpBundle(const CallBase *CB) {
44  .hasValue();
45 }
46 
47 } // end namespace objcarc
48 } // end namespace llvm
49 
50 #endif
llvm
Definition: AllocatorList.h:23
llvm::CallBase::getOperandBundle
Optional< OperandBundleUse > getOperandBundle(StringRef Name) const
Return an operand bundle by name, if present.
Definition: InstrTypes.h:1973
llvm::objcarc::getAttachedCallOperandBundleEnum
AttachedCallOperandBundle getAttachedCallOperandBundleEnum(bool IsRetain)
Definition: ObjCARCUtil.h:30
llvm::objcarc::AttachedCallOperandBundle
AttachedCallOperandBundle
Definition: ObjCARCUtil.h:27
InstrTypes.h
llvm::objcarc::hasAttachedCallOpBundle
bool hasAttachedCallOpBundle(const CallBase *CB, bool IsRetain)
Definition: ObjCARCUtil.h:34
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::objcarc::RVOB_Retain
@ RVOB_Retain
Definition: ObjCARCUtil.h:27
llvm::objcarc::IsRetain
bool IsRetain(ARCInstKind Class)
Test if the given class is objc_retain or equivalent.
Definition: ObjCARCInstKind.cpp:345
llvm::objcarc::getRVMarkerModuleFlagStr
const char * getRVMarkerModuleFlagStr()
Definition: ObjCARCUtil.h:23
llvm::objcarc::RVOB_Claim
@ RVOB_Claim
Definition: ObjCARCUtil.h:27
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1164
LLVMContext.h
llvm::LLVMContext::OB_clang_arc_attachedcall
@ OB_clang_arc_attachedcall
Definition: LLVMContext.h:96