Skip to content

Commit

Permalink
Move symbols from the global namespace into (anonymous) namespaces. NFC.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294837 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
d0k committed Feb 11, 2017
1 parent 02524a8 commit 3264d3f
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 30 deletions.
2 changes: 1 addition & 1 deletion lib/Bitcode/Reader/MetadataLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ class MetadataLoader::MetadataLoaderImpl {
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));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Bitcode/Writer/BitcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3739,7 +3739,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {

/// 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
Expand Down
19 changes: 10 additions & 9 deletions lib/ObjectYAML/DWARFEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -44,7 +44,7 @@ void writeVariableSizedInteger(uint64_t Integer, size_t Size, raw_ostream &OS,
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);
Expand Down Expand Up @@ -236,7 +236,7 @@ void DWARFYAML::EmitDebugInfo(raw_ostream &OS, const DWARFYAML::Data &DI) {
}
}

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);
Expand All @@ -245,7 +245,7 @@ void EmitFileEntry(raw_ostream &OS, const DWARFYAML::File &File) {
}

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) {
Expand Down Expand Up @@ -333,9 +333,10 @@ void DWARFYAML::EmitDebugLine(raw_ostream &OS, const DWARFYAML::Data &DI) {

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);
Expand Down
5 changes: 1 addition & 4 deletions lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ StringRef Hexagon_MC::selectHexagonCPU(const Triple &TT, StringRef CPU) {
return ArchV;
}

unsigned HexagonGetLastSlot() {
return HexagonItinerariesV4FU::SLOT3;
}

unsigned llvm::HexagonGetLastSlot() { return HexagonItinerariesV4FU::SLOT3; }

namespace {

Expand Down
3 changes: 2 additions & 1 deletion lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ MCAsmBackend *createHexagonAsmBackend(const Target &T,

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.
//
Expand Down
2 changes: 2 additions & 0 deletions lib/Target/PowerPC/PPCExpandISEL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -143,6 +144,7 @@ class PPCExpandISEL : public MachineFunctionPass {
return true;
}
};
} // end anonymous namespace

void PPCExpandISEL::initialize(MachineFunction &MFParam) {
MF = &MFParam;
Expand Down
3 changes: 2 additions & 1 deletion lib/Target/X86/X86InterleavedAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -95,6 +95,7 @@ class X86InterleavedAccessGroup {
/// instructions/intrinsics.
bool lowerIntoOptimizedSequence();
};
} // end anonymous namespace

bool X86InterleavedAccessGroup::isSupported() const {
VectorType *ShuffleVecTy = Shuffles[0]->getType();
Expand Down
11 changes: 2 additions & 9 deletions lib/Transforms/Scalar/NewGVN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ template <> struct DenseMapInfo<const Expression *> {
};
} // end namespace llvm

namespace {
class NewGVN : public FunctionPass {
DominatorTree *DT;
const DataLayout *DL;
Expand Down Expand Up @@ -380,6 +381,7 @@ class NewGVN : public FunctionPass {
void verifyMemoryCongruency() const;
bool singleReachablePHIPath(const MemoryAccess *, const MemoryAccess *) const;
};
} // end anonymous namespace

char NewGVN::ID = 0;

Expand Down Expand Up @@ -749,15 +751,6 @@ const StoreExpression *NewGVN::createStoreExpression(StoreInst *SI,
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.
Expand Down
8 changes: 4 additions & 4 deletions lib/XRay/Trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down Expand Up @@ -98,8 +98,8 @@ Error NaiveLogLoader(StringRef Data, XRayFileHeader &FileHeader,
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;
Expand Down

0 comments on commit 3264d3f

Please sign in to comment.