[llvm] r294837 - Move symbols from the global namespace into (anonymous) namespaces. NFC.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 11 03:06:56 PST 2017


Author: d0k
Date: Sat Feb 11 05:06:55 2017
New Revision: 294837

URL: http://llvm.org/viewvc/llvm-project?rev=294837&view=rev
Log:
Move symbols from the global namespace into (anonymous) namespaces. NFC.

Modified:
    llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
    llvm/trunk/lib/ObjectYAML/DWARFEmitter.cpp
    llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
    llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.h
    llvm/trunk/lib/Target/PowerPC/PPCExpandISEL.cpp
    llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp
    llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
    llvm/trunk/lib/XRay/Trace.cpp

Modified: llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp?rev=294837&r1=294836&r2=294837&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp Sat Feb 11 05:06:55 2017
@@ -567,7 +567,7 @@ public:
   void shrinkTo(unsigned N) { MetadataList.shrinkTo(N); }
 };
 
-Error error(const Twine &Message) {
+static Error error(const Twine &Message) {
   return make_error<StringError>(
       Message, make_error_code(BitcodeError::CorruptedBitcode));
 }

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=294837&r1=294836&r2=294837&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Sat Feb 11 05:06:55 2017
@@ -3739,7 +3739,7 @@ void IndexBitcodeWriter::writeCombinedGl
 
 /// Create the "IDENTIFICATION_BLOCK_ID" containing a single string with the
 /// current llvm version, and a record for the epoch number.
-void writeIdentificationBlock(BitstreamWriter &Stream) {
+static void writeIdentificationBlock(BitstreamWriter &Stream) {
   Stream.EnterSubblock(bitc::IDENTIFICATION_BLOCK_ID, 5);
 
   // Write the "user readable" string identifying the bitcode producer

Modified: llvm/trunk/lib/ObjectYAML/DWARFEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/DWARFEmitter.cpp?rev=294837&r1=294836&r2=294837&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/DWARFEmitter.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/DWARFEmitter.cpp Sat Feb 11 05:06:55 2017
@@ -24,14 +24,14 @@
 using namespace llvm;
 
 template <typename T>
-void writeInteger(T Integer, raw_ostream &OS, bool IsLittleEndian) {
+static void writeInteger(T Integer, raw_ostream &OS, bool IsLittleEndian) {
   if (IsLittleEndian != sys::IsLittleEndianHost)
     sys::swapByteOrder(Integer);
   OS.write(reinterpret_cast<char *>(&Integer), sizeof(T));
 }
 
-void writeVariableSizedInteger(uint64_t Integer, size_t Size, raw_ostream &OS,
-                               bool IsLittleEndian) {
+static void writeVariableSizedInteger(uint64_t Integer, size_t Size,
+                                      raw_ostream &OS, bool IsLittleEndian) {
   if (8 == Size)
     writeInteger((uint64_t)Integer, OS, IsLittleEndian);
   else if (4 == Size)
@@ -44,7 +44,7 @@ void writeVariableSizedInteger(uint64_t
     assert(false && "Invalid integer write size.");
 }
 
-void ZeroFillBytes(raw_ostream &OS, size_t Size) {
+static void ZeroFillBytes(raw_ostream &OS, size_t Size) {
   std::vector<uint8_t> FillData;
   FillData.insert(FillData.begin(), Size, 0);
   OS.write(reinterpret_cast<char *>(FillData.data()), Size);
@@ -236,7 +236,7 @@ void DWARFYAML::EmitDebugInfo(raw_ostrea
   }
 }
 
-void EmitFileEntry(raw_ostream &OS, const DWARFYAML::File &File) {
+static void EmitFileEntry(raw_ostream &OS, const DWARFYAML::File &File) {
   OS.write(File.Name.data(), File.Name.size());
   OS.write('\0');
   encodeULEB128(File.DirIdx, OS);
@@ -245,7 +245,7 @@ void EmitFileEntry(raw_ostream &OS, cons
 }
 
 void DWARFYAML::EmitDebugLine(raw_ostream &OS, const DWARFYAML::Data &DI) {
-  for (const auto LineTable : DI.DebugLines) {
+  for (const auto &LineTable : DI.DebugLines) {
     writeInteger((uint32_t)LineTable.TotalLength, OS, DI.IsLittleEndian);
     uint64_t SizeOfPrologueLength = 4;
     if (LineTable.TotalLength == UINT32_MAX) {
@@ -333,9 +333,10 @@ void DWARFYAML::EmitDebugLine(raw_ostrea
 
 typedef void (*EmitFuncType)(raw_ostream &, const DWARFYAML::Data &);
 
-void EmitDebugSectionImpl(
-    const DWARFYAML::Data &DI, EmitFuncType EmitFunc, StringRef Sec,
-    StringMap<std::unique_ptr<MemoryBuffer>> &OutputBuffers) {
+static void
+EmitDebugSectionImpl(const DWARFYAML::Data &DI, EmitFuncType EmitFunc,
+                     StringRef Sec,
+                     StringMap<std::unique_ptr<MemoryBuffer>> &OutputBuffers) {
   std::string Data;
   raw_string_ostream DebugInfoStream(Data);
   EmitFunc(DebugInfoStream, DI);

Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp?rev=294837&r1=294836&r2=294837&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp Sat Feb 11 05:06:55 2017
@@ -101,10 +101,7 @@ StringRef Hexagon_MC::selectHexagonCPU(c
   return ArchV;
 }
 
-unsigned HexagonGetLastSlot() {
-  return HexagonItinerariesV4FU::SLOT3;
-}
-
+unsigned llvm::HexagonGetLastSlot() { return HexagonItinerariesV4FU::SLOT3; }
 
 namespace {
 

Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.h?rev=294837&r1=294836&r2=294837&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.h (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.h Sat Feb 11 05:06:55 2017
@@ -65,10 +65,11 @@ MCAsmBackend *createHexagonAsmBackend(co
 
 MCObjectWriter *createHexagonELFObjectWriter(raw_pwrite_stream &OS,
                                              uint8_t OSABI, StringRef CPU);
-} // End llvm namespace
 
 unsigned HexagonGetLastSlot();
 
+} // End llvm namespace
+
 // Define symbolic names for Hexagon registers.  This defines a mapping from
 // register name to register number.
 //

Modified: llvm/trunk/lib/Target/PowerPC/PPCExpandISEL.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCExpandISEL.cpp?rev=294837&r1=294836&r2=294837&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCExpandISEL.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCExpandISEL.cpp Sat Feb 11 05:06:55 2017
@@ -42,6 +42,7 @@ static cl::opt<bool>
                  cl::desc("Enable generating the ISEL instruction."),
                  cl::init(true), cl::Hidden);
 
+namespace {
 class PPCExpandISEL : public MachineFunctionPass {
   DebugLoc dl;
   MachineFunction *MF;
@@ -143,6 +144,7 @@ public:
     return true;
   }
 };
+} // end anonymous namespace
 
 void PPCExpandISEL::initialize(MachineFunction &MFParam) {
   MF = &MFParam;

Modified: llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp?rev=294837&r1=294836&r2=294837&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp Sat Feb 11 05:06:55 2017
@@ -19,6 +19,7 @@
 
 using namespace llvm;
 
+namespace {
 /// \brief This class holds necessary information to represent an interleaved
 /// access group and supports utilities to lower the group into
 /// X86-specific instructions/intrinsics.
@@ -27,7 +28,6 @@ using namespace llvm;
 ///        %wide.vec = load <8 x i32>, <8 x i32>* %ptr
 ///        %v0 = shuffle <8 x i32> %wide.vec, <8 x i32> undef, <0, 2, 4, 6>
 ///        %v1 = shuffle <8 x i32> %wide.vec, <8 x i32> undef, <1, 3, 5, 7>
-
 class X86InterleavedAccessGroup {
   /// \brief Reference to the wide-load instruction of an interleaved access
   /// group.
@@ -95,6 +95,7 @@ public:
   /// instructions/intrinsics.
   bool lowerIntoOptimizedSequence();
 };
+} // end anonymous namespace
 
 bool X86InterleavedAccessGroup::isSupported() const {
   VectorType *ShuffleVecTy = Shuffles[0]->getType();

Modified: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp?rev=294837&r1=294836&r2=294837&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Sat Feb 11 05:06:55 2017
@@ -200,6 +200,7 @@ template <> struct DenseMapInfo<const Ex
 };
 } // end namespace llvm
 
+namespace {
 class NewGVN : public FunctionPass {
   DominatorTree *DT;
   const DataLayout *DL;
@@ -380,6 +381,7 @@ private:
   void verifyMemoryCongruency() const;
   bool singleReachablePHIPath(const MemoryAccess *, const MemoryAccess *) const;
 };
+} // end anonymous namespace
 
 char NewGVN::ID = 0;
 
@@ -749,15 +751,6 @@ const StoreExpression *NewGVN::createSto
   return E;
 }
 
-// Utility function to check whether the congruence class has a member other
-// than the given instruction.
-bool hasMemberOtherThanUs(const CongruenceClass *CC, Instruction *I) {
-  // Either it has more than one store, in which case it must contain something
-  // other than us (because it's indexed by value), or if it only has one store
-  // right now, that member should not be us.
-  return CC->StoreCount > 1 || CC->Members.count(I) == 0;
-}
-
 const Expression *NewGVN::performSymbolicStoreEvaluation(Instruction *I) {
   // Unlike loads, we never try to eliminate stores, so we do not check if they
   // are simple and avoid value numbering them.

Modified: llvm/trunk/lib/XRay/Trace.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/XRay/Trace.cpp?rev=294837&r1=294836&r2=294837&view=diff
==============================================================================
--- llvm/trunk/lib/XRay/Trace.cpp (original)
+++ llvm/trunk/lib/XRay/Trace.cpp Sat Feb 11 05:06:55 2017
@@ -24,8 +24,8 @@ using llvm::yaml::Input;
 using XRayRecordStorage =
     std::aligned_storage<sizeof(XRayRecord), alignof(XRayRecord)>::type;
 
-Error NaiveLogLoader(StringRef Data, XRayFileHeader &FileHeader,
-                     std::vector<XRayRecord> &Records) {
+static Error NaiveLogLoader(StringRef Data, XRayFileHeader &FileHeader,
+                            std::vector<XRayRecord> &Records) {
   // FIXME: Maybe deduce whether the data is little or big-endian using some
   // magic bytes in the beginning of the file?
 
@@ -98,8 +98,8 @@ Error NaiveLogLoader(StringRef Data, XRa
   return Error::success();
 }
 
-Error YAMLLogLoader(StringRef Data, XRayFileHeader &FileHeader,
-                    std::vector<XRayRecord> &Records) {
+static Error YAMLLogLoader(StringRef Data, XRayFileHeader &FileHeader,
+                           std::vector<XRayRecord> &Records) {
 
   // Load the documents from the MappedFile.
   YAMLXRayTrace Trace;




More information about the llvm-commits mailing list