From: Benjamin Kramer Date: Mon, 11 Feb 2019 15:16:21 +0000 (+0000) Subject: Move some classes into anonymous namespaces. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e258a8039332a3e29d3b528278adf09715a9af48;p=llvm Move some classes into anonymous namespaces. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353710 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index d242d3c159a..ee0d7fdd056 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -19404,10 +19404,12 @@ SDValue DAGCombiner::FindBetterChain(LSBaseSDNode *N, SDValue OldChain) { return DAG.getNode(ISD::TokenFactor, SDLoc(N), MVT::Other, Aliases); } +namespace { // TODO: Replace with with std::monostate when we move to C++17. struct UnitT { } Unit; bool operator==(const UnitT &, const UnitT &) { return true; } bool operator!=(const UnitT &, const UnitT &) { return false; } +} // namespace // This function tries to collect a bunch of potentially interesting // nodes to improve the chains of, all at once. This might seem diff --git a/lib/DebugInfo/CodeView/CodeViewError.cpp b/lib/DebugInfo/CodeView/CodeViewError.cpp index 277db228071..69390c708f5 100644 --- a/lib/DebugInfo/CodeView/CodeViewError.cpp +++ b/lib/DebugInfo/CodeView/CodeViewError.cpp @@ -13,6 +13,7 @@ using namespace llvm; using namespace llvm::codeview; +namespace { // FIXME: This class is only here to support the transition to llvm::Error. It // will be removed once this transition is complete. Clients should prefer to // deal with the Error value directly, rather than converting to error_code. @@ -38,6 +39,7 @@ public: llvm_unreachable("Unrecognized cv_error_code"); } }; +} // namespace static llvm::ManagedStatic CodeViewErrCategory; const std::error_category &llvm::codeview::CVErrorCategory() { diff --git a/lib/DebugInfo/MSF/MSFError.cpp b/lib/DebugInfo/MSF/MSFError.cpp index 34bbc7f094b..b368b802c56 100644 --- a/lib/DebugInfo/MSF/MSFError.cpp +++ b/lib/DebugInfo/MSF/MSFError.cpp @@ -13,6 +13,7 @@ using namespace llvm; using namespace llvm::msf; +namespace { // FIXME: This class is only here to support the transition to llvm::Error. It // will be removed once this transition is complete. Clients should prefer to // deal with the Error value directly, rather than converting to error_code. @@ -38,6 +39,7 @@ public: llvm_unreachable("Unrecognized msf_error_code"); } }; +} // namespace static llvm::ManagedStatic MSFCategory; const std::error_category &llvm::msf::MSFErrCategory() { return *MSFCategory; } diff --git a/lib/DebugInfo/PDB/GenericError.cpp b/lib/DebugInfo/PDB/GenericError.cpp index 586f300e172..70dc094c42e 100644 --- a/lib/DebugInfo/PDB/GenericError.cpp +++ b/lib/DebugInfo/PDB/GenericError.cpp @@ -13,6 +13,7 @@ using namespace llvm; using namespace llvm::pdb; +namespace { // FIXME: This class is only here to support the transition to llvm::Error. It // will be removed once this transition is complete. Clients should prefer to // deal with the Error value directly, rather than converting to error_code. @@ -39,6 +40,7 @@ public: llvm_unreachable("Unrecognized generic_error_code"); } }; +} // namespace static llvm::ManagedStatic PDBCategory; const std::error_category &llvm::pdb::PDBErrCategory() { return *PDBCategory; } diff --git a/lib/DebugInfo/PDB/Native/RawError.cpp b/lib/DebugInfo/PDB/Native/RawError.cpp index dec9797088f..ed6cf083967 100644 --- a/lib/DebugInfo/PDB/Native/RawError.cpp +++ b/lib/DebugInfo/PDB/Native/RawError.cpp @@ -5,6 +5,7 @@ using namespace llvm; using namespace llvm::pdb; +namespace { // FIXME: This class is only here to support the transition to llvm::Error. It // will be removed once this transition is complete. Clients should prefer to // deal with the Error value directly, rather than converting to error_code. @@ -44,6 +45,7 @@ public: llvm_unreachable("Unrecognized raw_error_code"); } }; +} // namespace static llvm::ManagedStatic RawCategory; const std::error_category &llvm::pdb::RawErrCategory() { return *RawCategory; } diff --git a/lib/Target/AArch64/AArch64InstructionSelector.cpp b/lib/Target/AArch64/AArch64InstructionSelector.cpp index 3ca599532a1..e1352c366e8 100644 --- a/lib/Target/AArch64/AArch64InstructionSelector.cpp +++ b/lib/Target/AArch64/AArch64InstructionSelector.cpp @@ -179,9 +179,9 @@ getRegClassForTypeOnBank(LLT Ty, const RegisterBank &RB, /// Given a register bank, and size in bits, return the smallest register class /// that can represent that combination. -const TargetRegisterClass *getMinClassForRegBank(const RegisterBank &RB, - unsigned SizeInBits, - bool GetAllRegSet = false) { +static const TargetRegisterClass * +getMinClassForRegBank(const RegisterBank &RB, unsigned SizeInBits, + bool GetAllRegSet = false) { unsigned RegBankID = RB.getID(); if (RegBankID == AArch64::GPRRegBankID) { diff --git a/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp b/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp index d059ef69915..b7fc65401fc 100644 --- a/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp +++ b/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp @@ -223,7 +223,7 @@ static Function *createWrapper(Function *F, FunctionType *Ty) { // Test whether a main function with type FuncTy should be rewritten to have // type MainTy. -bool shouldFixMainFunction(FunctionType *FuncTy, FunctionType *MainTy) { +static bool shouldFixMainFunction(FunctionType *FuncTy, FunctionType *MainTy) { // Only fix the main function if it's the standard zero-arg form. That way, // the standard cases will work as expected, and users will see signature // mismatches from the linker for non-standard cases.