Skip to content

Commit 2a4f5b2

Browse files
authored
[NFC][LLVM][CodeGen] Namespace related cleanups (llvm#162999)
1 parent c10e79e commit 2a4f5b2

26 files changed

+165
-254
lines changed

llvm/lib/CodeGen/AsmPrinter/AIXException.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "llvm/Target/TargetLoweringObjectFile.h"
2121
#include "llvm/Target/TargetMachine.h"
2222

23-
namespace llvm {
23+
using namespace llvm;
2424

2525
AIXException::AIXException(AsmPrinter *A) : EHStreamer(A) {}
2626

@@ -90,5 +90,3 @@ void AIXException::endFunction(const MachineFunction *MF) {
9090

9191
emitExceptionInfoTable(LSDALabel, PerSym);
9292
}
93-
94-
} // End of namespace llvm

llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,14 @@ template <> struct llvm::DenseMapInfo<VariableID> {
8585

8686
using VarLocInsertPt = PointerUnion<const Instruction *, const DbgRecord *>;
8787

88-
namespace std {
89-
template <> struct hash<VarLocInsertPt> {
88+
template <> struct std::hash<VarLocInsertPt> {
9089
using argument_type = VarLocInsertPt;
9190
using result_type = std::size_t;
9291

9392
result_type operator()(const argument_type &Arg) const {
9493
return std::hash<void *>()(Arg.getOpaqueValue());
9594
}
9695
};
97-
} // namespace std
9896

9997
/// Helper class to build FunctionVarLocs, since that class isn't easy to
10098
/// modify. TODO: There's not a great deal of value in the split, it could be

llvm/lib/CodeGen/BasicBlockPathCloning.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,7 @@ bool ApplyCloning(MachineFunction &MF,
207207
}
208208
return AnyPathsCloned;
209209
}
210-
} // end anonymous namespace
211210

212-
namespace llvm {
213211
class BasicBlockPathCloning : public MachineFunctionPass {
214212
public:
215213
static char ID;
@@ -229,7 +227,7 @@ class BasicBlockPathCloning : public MachineFunctionPass {
229227
bool runOnMachineFunction(MachineFunction &MF) override;
230228
};
231229

232-
} // namespace llvm
230+
} // namespace
233231

234232
char BasicBlockPathCloning::ID = 0;
235233
INITIALIZE_PASS_BEGIN(

llvm/lib/CodeGen/BreakFalseDeps.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
using namespace llvm;
3333

34-
namespace llvm {
34+
namespace {
3535

3636
class BreakFalseDeps : public MachineFunctionPass {
3737
private:
@@ -95,7 +95,7 @@ class BreakFalseDeps : public MachineFunctionPass {
9595
void processUndefReads(MachineBasicBlock *);
9696
};
9797

98-
} // namespace llvm
98+
} // namespace
9999

100100
#define DEBUG_TYPE "break-false-deps"
101101

llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ hash_code hash_value(const ComplexValue &Arg) {
126126
} // end namespace
127127
typedef SmallVector<struct ComplexValue, 2> ComplexValues;
128128

129-
namespace llvm {
130-
template <> struct DenseMapInfo<ComplexValue> {
129+
template <> struct llvm::DenseMapInfo<ComplexValue> {
131130
static inline ComplexValue getEmptyKey() {
132131
return {DenseMapInfo<Value *>::getEmptyKey(),
133132
DenseMapInfo<Value *>::getEmptyKey()};
@@ -144,7 +143,6 @@ template <> struct DenseMapInfo<ComplexValue> {
144143
return LHS.Real == RHS.Real && LHS.Imag == RHS.Imag;
145144
}
146145
};
147-
} // end namespace llvm
148146

149147
namespace {
150148
template <typename T, typename IterT>

llvm/lib/CodeGen/EdgeBundles.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,10 @@ void EdgeBundles::init() {
8181
}
8282
}
8383

84-
namespace llvm {
85-
8684
/// Specialize WriteGraph, the standard implementation won't work.
87-
template<>
88-
raw_ostream &WriteGraph<>(raw_ostream &O, const EdgeBundles &G,
89-
bool ShortNames,
90-
const Twine &Title) {
85+
template <>
86+
raw_ostream &llvm::WriteGraph<>(raw_ostream &O, const EdgeBundles &G,
87+
bool ShortNames, const Twine &Title) {
9188
const MachineFunction *MF = G.getMachineFunction();
9289

9390
O << "digraph {\n";
@@ -107,8 +104,6 @@ raw_ostream &WriteGraph<>(raw_ostream &O, const EdgeBundles &G,
107104
return O;
108105
}
109106

110-
} // end namespace llvm
111-
112107
/// view - Visualize the annotated bipartite CFG with Graphviz.
113108
void EdgeBundles::view() const {
114109
ViewGraph(*this, "EdgeBundles");

llvm/lib/CodeGen/GlobalMergeFunctions.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -587,16 +587,12 @@ class GlobalMergeFuncPassWrapper : public ModulePass {
587587
} // namespace
588588

589589
char GlobalMergeFuncPassWrapper::ID = 0;
590-
INITIALIZE_PASS_BEGIN(GlobalMergeFuncPassWrapper, "global-merge-func",
591-
"Global merge function pass", false, false)
592-
INITIALIZE_PASS_END(GlobalMergeFuncPassWrapper, "global-merge-func",
593-
"Global merge function pass", false, false)
590+
INITIALIZE_PASS(GlobalMergeFuncPassWrapper, "global-merge-func",
591+
"Global merge function pass", false, false)
594592

595-
namespace llvm {
596-
ModulePass *createGlobalMergeFuncPass() {
593+
ModulePass *llvm::createGlobalMergeFuncPass() {
597594
return new GlobalMergeFuncPassWrapper();
598595
}
599-
} // namespace llvm
600596

601597
GlobalMergeFuncPassWrapper::GlobalMergeFuncPassWrapper() : ModulePass(ID) {
602598
initializeGlobalMergeFuncPassWrapperPass(

llvm/lib/CodeGen/LiveIntervals.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,11 @@ static cl::opt<bool> EnablePrecomputePhysRegs(
101101
static bool EnablePrecomputePhysRegs = false;
102102
#endif // NDEBUG
103103

104-
namespace llvm {
105-
106-
cl::opt<bool> UseSegmentSetForPhysRegs(
104+
cl::opt<bool> llvm::UseSegmentSetForPhysRegs(
107105
"use-segment-set-for-physregs", cl::Hidden, cl::init(true),
108106
cl::desc(
109107
"Use segment set for the computation of the live ranges of physregs."));
110108

111-
} // end namespace llvm
112-
113109
void LiveIntervalsWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
114110
AU.setPreservesCFG();
115111
AU.addPreserved<LiveVariablesWrapperPass>();

llvm/lib/CodeGen/MIR2Vec.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,17 @@ using namespace mir2vec;
2929
STATISTIC(MIRVocabMissCounter,
3030
"Number of lookups to MIR entities not present in the vocabulary");
3131

32-
namespace llvm {
33-
namespace mir2vec {
34-
cl::OptionCategory MIR2VecCategory("MIR2Vec Options");
32+
cl::OptionCategory llvm::mir2vec::MIR2VecCategory("MIR2Vec Options");
3533

3634
// FIXME: Use a default vocab when not specified
3735
static cl::opt<std::string>
3836
VocabFile("mir2vec-vocab-path", cl::Optional,
3937
cl::desc("Path to the vocabulary file for MIR2Vec"), cl::init(""),
4038
cl::cat(MIR2VecCategory));
41-
cl::opt<float> OpcWeight("mir2vec-opc-weight", cl::Optional, cl::init(1.0),
42-
cl::desc("Weight for machine opcode embeddings"),
43-
cl::cat(MIR2VecCategory));
44-
} // namespace mir2vec
45-
} // namespace llvm
39+
cl::opt<float>
40+
llvm::mir2vec::OpcWeight("mir2vec-opc-weight", cl::Optional, cl::init(1.0),
41+
cl::desc("Weight for machine opcode embeddings"),
42+
cl::cat(MIR2VecCategory));
4643

4744
//===----------------------------------------------------------------------===//
4845
// Vocabulary Implementation

llvm/lib/CodeGen/MIRFSDiscriminator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ cl::opt<bool> ImprovedFSDiscriminator(
4040
"improved-fs-discriminator", cl::Hidden, cl::init(false),
4141
cl::desc("New FS discriminators encoding (incompatible with the original "
4242
"encoding)"));
43-
}
43+
} // namespace llvm
4444

4545
char MIRAddFSDiscriminators::ID = 0;
4646

0 commit comments

Comments
 (0)