From a2a55def354df2cd4de0b1cbd6b2795a07e6905a Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 4 Mar 2021 16:14:53 -0800 Subject: [PATCH] Move llvm/Analysis/ObjCARCUtil.h to IR to fix layering. This is included from IR files, and IR doesn't/can't depend on Analysis (because Analysis depends on IR). Also fix the implementation - don't use non-member static in headers, as it leads to ODR violations, inaccurate "unused function" warnings, etc. And fix the header protection macro name (we don't generally include "LIB" in the names, so far as I can tell). --- llvm/include/llvm/{Analysis => IR}/ObjCARCUtil.h | 12 ++++++------ llvm/lib/IR/AutoUpgrade.cpp | 2 +- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 2 +- llvm/lib/Transforms/ObjCARC/ObjCARC.cpp | 2 +- llvm/lib/Transforms/ObjCARC/ObjCARC.h | 2 +- llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp | 2 +- llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp | 2 +- llvm/lib/Transforms/ObjCARC/PtrState.cpp | 2 +- llvm/lib/Transforms/Utils/InlineFunction.cpp | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) rename llvm/include/llvm/{Analysis => IR}/ObjCARCUtil.h (80%) diff --git a/llvm/include/llvm/Analysis/ObjCARCUtil.h b/llvm/include/llvm/IR/ObjCARCUtil.h similarity index 80% rename from llvm/include/llvm/Analysis/ObjCARCUtil.h rename to llvm/include/llvm/IR/ObjCARCUtil.h index 9345c89..5d04eba 100644 --- a/llvm/include/llvm/Analysis/ObjCARCUtil.h +++ b/llvm/include/llvm/IR/ObjCARCUtil.h @@ -11,8 +11,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_LIB_ANALYSIS_OBJCARCUTIL_H -#define LLVM_LIB_ANALYSIS_OBJCARCUTIL_H +#ifndef LLVM_IR_OBJCARCUTIL_H +#define LLVM_IR_OBJCARCUTIL_H #include "llvm/IR/InstrTypes.h" #include "llvm/IR/LLVMContext.h" @@ -20,18 +20,18 @@ namespace llvm { namespace objcarc { -static inline const char *getRVMarkerModuleFlagStr() { +inline const char *getRVMarkerModuleFlagStr() { return "clang.arc.retainAutoreleasedReturnValueMarker"; } enum AttachedCallOperandBundle : unsigned { RVOB_Retain, RVOB_Claim }; -static AttachedCallOperandBundle +inline AttachedCallOperandBundle getAttachedCallOperandBundleEnum(bool IsRetain) { return IsRetain ? RVOB_Retain : RVOB_Claim; } -static inline bool hasAttachedCallOpBundle(const CallBase *CB, bool IsRetain) { +inline bool hasAttachedCallOpBundle(const CallBase *CB, bool IsRetain) { auto B = CB->getOperandBundle(LLVMContext::OB_clang_arc_attachedcall); if (!B.hasValue()) return false; @@ -39,7 +39,7 @@ static inline bool hasAttachedCallOpBundle(const CallBase *CB, bool IsRetain) { getAttachedCallOperandBundleEnum(IsRetain); } -static inline bool hasAttachedCallOpBundle(const CallBase *CB) { +inline bool hasAttachedCallOpBundle(const CallBase *CB) { return CB->getOperandBundle(LLVMContext::OB_clang_arc_attachedcall) .hasValue(); } diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 8ca091d..06268c6 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -14,7 +14,7 @@ #include "llvm/IR/AutoUpgrade.h" #include "llvm/ADT/StringSwitch.h" -#include "llvm/Analysis/ObjCARCUtil.h" +#include "llvm/IR/ObjCARCUtil.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DIBuilder.h" #include "llvm/IR/DebugInfo.h" diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 3cc809e..8fdc521 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -29,7 +29,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" -#include "llvm/Analysis/ObjCARCUtil.h" +#include "llvm/IR/ObjCARCUtil.h" #include "llvm/Analysis/VectorUtils.h" #include "llvm/CodeGen/CallingConvLower.h" #include "llvm/CodeGen/MachineBasicBlock.h" diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp index 06b1214..e1bee81 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp @@ -14,7 +14,7 @@ #include "ObjCARC.h" #include "llvm-c/Initialization.h" -#include "llvm/Analysis/ObjCARCUtil.h" +#include "llvm/IR/ObjCARCUtil.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/InlineAsm.h" #include "llvm/IR/Instructions.h" diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARC.h b/llvm/lib/Transforms/ObjCARC/ObjCARC.h index 1f9d769..45ce188 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARC.h +++ b/llvm/lib/Transforms/ObjCARC/ObjCARC.h @@ -25,7 +25,7 @@ #include "ARCRuntimeEntryPoints.h" #include "llvm/Analysis/EHPersonalities.h" #include "llvm/Analysis/ObjCARCAnalysisUtils.h" -#include "llvm/Analysis/ObjCARCUtil.h" +#include "llvm/IR/ObjCARCUtil.h" #include "llvm/Transforms/Utils/Local.h" namespace llvm { diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp index 62161b5..c9c3fa2 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp @@ -32,7 +32,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/EHPersonalities.h" -#include "llvm/Analysis/ObjCARCUtil.h" +#include "llvm/IR/ObjCARCUtil.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/InlineAsm.h" #include "llvm/IR/InstIterator.h" diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp index 0769d46..e0abafe 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp @@ -41,7 +41,7 @@ #include "llvm/Analysis/ObjCARCAliasAnalysis.h" #include "llvm/Analysis/ObjCARCAnalysisUtils.h" #include "llvm/Analysis/ObjCARCInstKind.h" -#include "llvm/Analysis/ObjCARCUtil.h" +#include "llvm/IR/ObjCARCUtil.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CFG.h" #include "llvm/IR/Constant.h" diff --git a/llvm/lib/Transforms/ObjCARC/PtrState.cpp b/llvm/lib/Transforms/ObjCARC/PtrState.cpp index d10d5851..c15b23a 100644 --- a/llvm/lib/Transforms/ObjCARC/PtrState.cpp +++ b/llvm/lib/Transforms/ObjCARC/PtrState.cpp @@ -11,7 +11,7 @@ #include "ObjCARC.h" #include "llvm/Analysis/ObjCARCAnalysisUtils.h" #include "llvm/Analysis/ObjCARCInstKind.h" -#include "llvm/Analysis/ObjCARCUtil.h" +#include "llvm/IR/ObjCARCUtil.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 5f75ead..2745e0e 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -28,7 +28,7 @@ #include "llvm/Analysis/EHPersonalities.h" #include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/ObjCARCAnalysisUtils.h" -#include "llvm/Analysis/ObjCARCUtil.h" +#include "llvm/IR/ObjCARCUtil.h" #include "llvm/Analysis/ProfileSummaryInfo.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/Analysis/VectorUtils.h" -- 2.7.4