[llvm] r344468 - Move some helpers from the global namespace into anonymous ones.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 13 15:18:23 PDT 2018


Author: d0k
Date: Sat Oct 13 15:18:22 2018
New Revision: 344468

URL: http://llvm.org/viewvc/llvm-project?rev=344468&view=rev
Log:
Move some helpers from the global namespace into anonymous ones.

Modified:
    llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
    llvm/trunk/lib/Target/Mips/MipsCallLowering.cpp
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
    llvm/trunk/lib/Target/X86/X86CondBrFolding.cpp
    llvm/trunk/lib/Transforms/Instrumentation/ControlHeightReduction.cpp

Modified: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp?rev=344468&r1=344467&r2=344468&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Sat Oct 13 15:18:22 2018
@@ -652,7 +652,7 @@ Demangler::demangleLiteralOperatorIdenti
   return N;
 }
 
-IntrinsicFunctionKind
+static IntrinsicFunctionKind
 translateIntrinsicFunctionCode(char CH, FunctionIdentifierCodeGroup Group) {
   // Not all ? identifiers are intrinsics *functions*.  This function only maps
   // operator codes for the special functions, all others are handled elsewhere,
@@ -1220,7 +1220,7 @@ static void outputEscapedChar(OutputStre
   outputHex(OS, C);
 }
 
-unsigned countTrailingNullBytes(const uint8_t *StringBytes, int Length) {
+static unsigned countTrailingNullBytes(const uint8_t *StringBytes, int Length) {
   const uint8_t *End = StringBytes + Length - 1;
   unsigned Count = 0;
   while (Length > 0 && *End == 0) {
@@ -1231,7 +1231,8 @@ unsigned countTrailingNullBytes(const ui
   return Count;
 }
 
-unsigned countEmbeddedNulls(const uint8_t *StringBytes, unsigned Length) {
+static unsigned countEmbeddedNulls(const uint8_t *StringBytes,
+                                   unsigned Length) {
   unsigned Result = 0;
   for (unsigned I = 0; I < Length; ++I) {
     if (*StringBytes++ == 0)
@@ -1240,8 +1241,8 @@ unsigned countEmbeddedNulls(const uint8_
   return Result;
 }
 
-unsigned guessCharByteSize(const uint8_t *StringBytes, unsigned NumChars,
-                           unsigned NumBytes) {
+static unsigned guessCharByteSize(const uint8_t *StringBytes, unsigned NumChars,
+                                  unsigned NumBytes) {
   assert(NumBytes > 0);
 
   // If the number of bytes is odd, this is guaranteed to be a char string.

Modified: llvm/trunk/lib/Target/Mips/MipsCallLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsCallLowering.cpp?rev=344468&r1=344467&r2=344468&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsCallLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsCallLowering.cpp Sat Oct 13 15:18:22 2018
@@ -298,8 +298,8 @@ static bool isSupportedType(Type *T) {
   return false;
 }
 
-CCValAssign::LocInfo determineLocInfo(const MVT RegisterVT, const EVT VT,
-                                      const ISD::ArgFlagsTy &Flags) {
+static CCValAssign::LocInfo determineLocInfo(const MVT RegisterVT, const EVT VT,
+                                             const ISD::ArgFlagsTy &Flags) {
   // > does not mean loss of information as type RegisterVT can't hold type VT,
   // it means that type VT is split into multiple registers of type RegisterVT
   if (VT.getSizeInBits() >= RegisterVT.getSizeInBits())
@@ -312,8 +312,8 @@ CCValAssign::LocInfo determineLocInfo(co
 }
 
 template <typename T>
-void setLocInfo(SmallVectorImpl<CCValAssign> &ArgLocs,
-                const SmallVectorImpl<T> &Arguments) {
+static void setLocInfo(SmallVectorImpl<CCValAssign> &ArgLocs,
+                       const SmallVectorImpl<T> &Arguments) {
   for (unsigned i = 0; i < ArgLocs.size(); ++i) {
     const CCValAssign &VA = ArgLocs[i];
     CCValAssign::LocInfo LocInfo = determineLocInfo(

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp?rev=344468&r1=344467&r2=344468&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp Sat Oct 13 15:18:22 2018
@@ -59,7 +59,7 @@ FunctionPass *llvm::createWebAssemblyLat
 // possible search paths should be the same.
 // Returns nullptr in case it does not find any EH pad in the search, or finds
 // multiple different EH pads.
-MachineBasicBlock *GetMatchingEHPad(MachineInstr *MI) {
+static MachineBasicBlock *GetMatchingEHPad(MachineInstr *MI) {
   MachineFunction *MF = MI->getParent()->getParent();
   SmallVector<MachineBasicBlock *, 2> WL;
   SmallPtrSet<MachineBasicBlock *, 2> Visited;

Modified: llvm/trunk/lib/Target/X86/X86CondBrFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CondBrFolding.cpp?rev=344468&r1=344467&r2=344468&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CondBrFolding.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86CondBrFolding.cpp Sat Oct 13 15:18:22 2018
@@ -84,6 +84,7 @@ FunctionPass *llvm::createX86CondBrFoldi
   return new X86CondBrFoldingPass();
 }
 
+namespace {
 // A class the stores the auxiliary information for each MBB.
 struct TargetMBBInfo {
   MachineBasicBlock *TBB;
@@ -129,6 +130,7 @@ private:
     return MBBInfos[MBB->getNumber()].get();
   }
 };
+} // namespace
 
 // Find a valid path that we can reuse the CondCode.
 // The resulted path (if return true) is stored in BranchPath.

Modified: llvm/trunk/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/ControlHeightReduction.cpp?rev=344468&r1=344467&r2=344468&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/ControlHeightReduction.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/ControlHeightReduction.cpp Sat Oct 13 15:18:22 2018
@@ -621,9 +621,10 @@ static BranchProbability getCHRBiasThres
 // CHRBiasThreshold, put Key into TrueSet and return true. If FalseProb >=
 // CHRBiasThreshold, put Key into FalseSet and return true. Otherwise, return
 // false.
-template<typename K, typename S, typename M>
-bool checkBias(K *Key, BranchProbability TrueProb, BranchProbability FalseProb,
-               S &TrueSet, S &FalseSet, M &BiasMap) {
+template <typename K, typename S, typename M>
+static bool checkBias(K *Key, BranchProbability TrueProb,
+                      BranchProbability FalseProb, S &TrueSet, S &FalseSet,
+                      M &BiasMap) {
   BranchProbability Threshold = getCHRBiasThreshold();
   if (TrueProb >= Threshold) {
     TrueSet.insert(Key);




More information about the llvm-commits mailing list