Move symbols from the global namespace into (anonymous) namespaces. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294837 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2017-02-11 11:06:55 +00:00
parent 02524a88e4
commit 3264d3f56b
9 changed files with 25 additions and 30 deletions

View File

@ -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));
}

View File

@ -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

View File

@ -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 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);
@ -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);
@ -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) {
@ -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);

View File

@ -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 {

View File

@ -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.
//

View File

@ -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;

View File

@ -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();

View File

@ -200,6 +200,7 @@ template <> struct DenseMapInfo<const Expression *> {
};
} // 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::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.

View File

@ -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, 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;