diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index bdbdb7d4ccc..af430bd70b7 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -23,8 +23,7 @@ #include "llvm/SymbolTable.h" #include "llvm/iOther.h" #include "llvm/Assembly/Writer.h" - -namespace llvm { +using namespace llvm; // Error - Simple wrapper function to conditionally assign to E and return true. // This just makes error return conditions a little bit simpler... @@ -842,7 +841,7 @@ static bool LinkAppendingVars(Module *M, // the problem. Upon failure, the Dest module could be in a modified state, and // shouldn't be relied on to be consistent. // -bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { +bool llvm::LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { if (Dest->getEndianness() == Module::AnyEndianness) Dest->setEndianness(Src->getEndianness()); if (Dest->getPointerSize() == Module::AnyPointerSize) @@ -909,4 +908,3 @@ bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { return false; } -} // End llvm namespace diff --git a/lib/Transforms/Hello/Hello.cpp b/lib/Transforms/Hello/Hello.cpp index 4ed281a40af..b6262118efa 100644 --- a/lib/Transforms/Hello/Hello.cpp +++ b/lib/Transforms/Hello/Hello.cpp @@ -14,8 +14,7 @@ #include "llvm/Pass.h" #include "llvm/Function.h" - -namespace llvm { +using namespace llvm; namespace { // Hello - The first implementation, without getAnalysisUsage. @@ -41,5 +40,3 @@ namespace { }; RegisterOpt Y("hello2", "Hello World Pass (with getAnalysisUsage implemented)"); } - -} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp index 90ef14df7ec..7b38d70d9e3 100644 --- a/lib/Transforms/Instrumentation/BlockProfiling.cpp +++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp @@ -24,8 +24,7 @@ #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/Pass.h" - -namespace llvm { +using namespace llvm; static void insertInitializationCall(Function *MainFn, const char *FnName, GlobalValue *Array) { @@ -184,4 +183,3 @@ bool BlockProfiler::run(Module &M) { return true; } -} // End llvm namespace diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp index c802f736046..30904a627e6 100644 --- a/lib/Transforms/Instrumentation/TraceValues.cpp +++ b/lib/Transforms/Instrumentation/TraceValues.cpp @@ -25,8 +25,7 @@ #include "Support/StringExtras.h" #include #include - -namespace llvm { +using namespace llvm; static cl::opt DisablePtrHashing("tracedisablehashdisable", cl::Hidden, @@ -112,11 +111,11 @@ namespace { } // end anonymous namespace -Pass *createTraceValuesPassForFunction() { // Just trace functions +Pass *llvm::createTraceValuesPassForFunction() { // Just trace functions return new FunctionTracer(); } -Pass *createTraceValuesPassForBasicBlocks() { // Trace BB's and functions +Pass *llvm::createTraceValuesPassForBasicBlocks() { // Trace BB's and functions return new BasicBlockTracer(); } @@ -435,5 +434,3 @@ bool InsertTraceCode::runOnFunction(Function &F) { return true; } - -} // End llvm namespace diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp index 5fb54693325..945e15fd0b9 100644 --- a/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -18,14 +18,13 @@ #include "llvm/Constant.h" #include "llvm/Type.h" #include - -namespace llvm { +using namespace llvm; // ReplaceInstWithValue - Replace all uses of an instruction (specified by BI) // with a value, then remove and delete the original instruction. // -void ReplaceInstWithValue(BasicBlock::InstListType &BIL, - BasicBlock::iterator &BI, Value *V) { +void llvm::ReplaceInstWithValue(BasicBlock::InstListType &BIL, + BasicBlock::iterator &BI, Value *V) { Instruction &I = *BI; // Replaces all of the uses of the instruction with uses of the value I.replaceAllUsesWith(V); @@ -45,8 +44,8 @@ void ReplaceInstWithValue(BasicBlock::InstListType &BIL, // instruction specified by I. The original instruction is deleted and BI is // updated to point to the new instruction. // -void ReplaceInstWithInst(BasicBlock::InstListType &BIL, - BasicBlock::iterator &BI, Instruction *I) { +void llvm::ReplaceInstWithInst(BasicBlock::InstListType &BIL, + BasicBlock::iterator &BI, Instruction *I) { assert(I->getParent() == 0 && "ReplaceInstWithInst: Instruction already inserted into basic block!"); @@ -63,7 +62,7 @@ void ReplaceInstWithInst(BasicBlock::InstListType &BIL, // ReplaceInstWithInst - Replace the instruction specified by From with the // instruction specified by To. // -void ReplaceInstWithInst(Instruction *From, Instruction *To) { +void llvm::ReplaceInstWithInst(Instruction *From, Instruction *To) { BasicBlock::iterator BI(From); ReplaceInstWithInst(From->getParent()->getInstList(), BI, To); } @@ -75,7 +74,7 @@ void ReplaceInstWithInst(Instruction *From, Instruction *To) { // deleted, a return instruction is inserted in its place which can cause a // surprising change in program behavior if it is not expected. // -void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) { +void llvm::RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) { assert(SuccNum < TI->getNumSuccessors() && "Trying to remove a nonexistant successor!"); @@ -115,4 +114,3 @@ void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) { ReplaceInstWithInst(TI, NewTI); } -} // End llvm namespace diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp index 1175b1053b2..178e8ca1957 100644 --- a/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp @@ -24,8 +24,7 @@ #include "llvm/iPHINode.h" #include "llvm/Support/CFG.h" #include "Support/Statistic.h" - -namespace llvm { +using namespace llvm; namespace { Statistic<> NumBroken("break-crit-edges", "Number of blocks inserted"); @@ -49,8 +48,8 @@ namespace { } // Publically exposed interface to pass... -const PassInfo *BreakCriticalEdgesID = X.getPassInfo(); -Pass *createBreakCriticalEdgesPass() { return new BreakCriticalEdges(); } +const PassInfo *llvm::BreakCriticalEdgesID = X.getPassInfo(); +Pass *llvm::createBreakCriticalEdgesPass() { return new BreakCriticalEdges(); } // runOnFunction - Loop over all of the edges in the CFG, breaking critical // edges as they are found. @@ -78,7 +77,7 @@ bool BreakCriticalEdges::runOnFunction(Function &F) { // Critical edges are edges from a block with multiple successors to a block // with multiple predecessors. // -bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum) { +bool llvm::isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum) { assert(SuccNum < TI->getNumSuccessors() && "Illegal edge specification!"); if (TI->getNumSuccessors() == 1) return false; @@ -97,7 +96,7 @@ bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum) { // calling this pass will not invalidate either of them. This returns true if // the edge was split, false otherwise. // -bool SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P) { +bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P) { if (!isCriticalEdge(TI, SuccNum)) return false; BasicBlock *TIBB = TI->getParent(); BasicBlock *DestBB = TI->getSuccessor(SuccNum); @@ -169,5 +168,3 @@ bool SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P) { } return true; } - -} // End llvm namespace diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp index d8aa9aebe43..17ad8c5175d 100644 --- a/lib/Transforms/Utils/CloneFunction.cpp +++ b/lib/Transforms/Utils/CloneFunction.cpp @@ -18,8 +18,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Function.h" #include "ValueMapper.h" - -namespace llvm { +using namespace llvm; // RemapInstruction - Convert the instruction operands from referencing the // current values into those specified by ValueMap. @@ -41,9 +40,9 @@ static inline void RemapInstruction(Instruction *I, } // CloneBasicBlock - See comments in Cloning.h -BasicBlock *CloneBasicBlock(const BasicBlock *BB, - std::map &ValueMap, - const char *NameSuffix) { +BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB, + std::map &ValueMap, + const char *NameSuffix) { BasicBlock *NewBB = new BasicBlock(""); if (BB->hasName()) NewBB->setName(BB->getName()+NameSuffix); @@ -62,10 +61,10 @@ BasicBlock *CloneBasicBlock(const BasicBlock *BB, // Clone OldFunc into NewFunc, transforming the old arguments into references to // ArgMap values. // -void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, - std::map &ValueMap, - std::vector &Returns, - const char *NameSuffix) { +void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc, + std::map &ValueMap, + std::vector &Returns, + const char *NameSuffix) { assert(NameSuffix && "NameSuffix cannot be null!"); #ifndef NDEBUG @@ -112,8 +111,8 @@ void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, /// updated to include mappings from all of the instructions and basicblocks in /// the function from their old to new values. /// -Function *CloneFunction(const Function *F, - std::map &ValueMap) { +Function *llvm::CloneFunction(const Function *F, + std::map &ValueMap) { std::vector ArgTypes; // The user might be deleting arguments to the function by specifying them in @@ -143,4 +142,3 @@ Function *CloneFunction(const Function *F, return NewF; } -} // End llvm namespace diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp index 21a8675f07b..f8ee99b3069 100644 --- a/lib/Transforms/Utils/CloneModule.cpp +++ b/lib/Transforms/Utils/CloneModule.cpp @@ -18,15 +18,14 @@ #include "llvm/SymbolTable.h" #include "llvm/Constant.h" #include "ValueMapper.h" - -namespace llvm { +using namespace llvm; /// CloneModule - Return an exact copy of the specified module. This is not as /// easy as it might seem because we have to worry about making copies of global /// variables and functions, and making their (initializers and references, /// respectively) refer to the right globals. /// -Module *CloneModule(const Module *M) { +Module *llvm::CloneModule(const Module *M) { // First off, we need to create the new module... Module *New = new Module(M->getModuleIdentifier()); New->setEndianness(M->getEndianness()); @@ -90,5 +89,3 @@ Module *CloneModule(const Module *M) { return New; } - -} // End llvm namespace diff --git a/lib/Transforms/Utils/CloneTrace.cpp b/lib/Transforms/Utils/CloneTrace.cpp index 990e54c783b..61186d38f9e 100644 --- a/lib/Transforms/Utils/CloneTrace.cpp +++ b/lib/Transforms/Utils/CloneTrace.cpp @@ -18,13 +18,11 @@ #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/iPHINode.h" #include "llvm/Function.h" - - -namespace llvm { +using namespace llvm; //Clones the trace (a vector of basic blocks) -std::vector CloneTrace(const std::vector &origTrace) { - +std::vector +llvm::CloneTrace(const std::vector &origTrace) { std::vector clonedTrace; std::map ValueMap; @@ -88,5 +86,3 @@ std::vector CloneTrace(const std::vector &origTrace) //return new vector of basic blocks return clonedTrace; } - -} // End llvm namespace diff --git a/lib/Transforms/Utils/DemoteRegToStack.cpp b/lib/Transforms/Utils/DemoteRegToStack.cpp index e35dca4de03..ec0b091f94c 100644 --- a/lib/Transforms/Utils/DemoteRegToStack.cpp +++ b/lib/Transforms/Utils/DemoteRegToStack.cpp @@ -21,16 +21,15 @@ #include "llvm/iTerminators.h" #include "llvm/Type.h" #include "Support/hash_set" - -namespace llvm { +using namespace llvm; typedef hash_set PhiSet; typedef hash_set::iterator PhiSetIterator; // Helper function to push a phi *and* all its operands to the worklist! // Do not push an instruction if it is already in the result set of Phis to go. -inline void PushOperandsOnWorkList(std::vector& workList, - PhiSet& phisToGo, PHINode* phiN) { +static inline void PushOperandsOnWorkList(std::vector& workList, + PhiSet& phisToGo, PHINode* phiN) { for (User::op_iterator OI = phiN->op_begin(), OE = phiN->op_end(); OI != OE; ++OI) { Instruction* opI = cast(OI); @@ -133,7 +132,7 @@ static void AddLoadsAndStores(AllocaInst* XSlot, Instruction& X, // // Returns the pointer to the alloca inserted to create a stack slot for X. // -AllocaInst* DemoteRegToStack(Instruction& X) { +AllocaInst* llvm::DemoteRegToStack(Instruction& X) { if (X.getType() == Type::VoidTy) return 0; // nothing to do! @@ -162,5 +161,3 @@ AllocaInst* DemoteRegToStack(Instruction& X) { return XSlot; } - -} // End llvm namespace diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index a0fc9bf1cff..ef473becaa3 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -23,11 +23,10 @@ #include "llvm/Intrinsics.h" #include "llvm/Support/CallSite.h" #include "llvm/Transforms/Utils/Local.h" +using namespace llvm; -namespace llvm { - -bool InlineFunction(CallInst *CI) { return InlineFunction(CallSite(CI)); } -bool InlineFunction(InvokeInst *II) { return InlineFunction(CallSite(II)); } +bool llvm::InlineFunction(CallInst *CI) { return InlineFunction(CallSite(CI)); } +bool llvm::InlineFunction(InvokeInst *II) {return InlineFunction(CallSite(II));} // InlineFunction - This function inlines the called function into the basic // block of the caller. This returns false if it is not possible to inline this @@ -38,7 +37,7 @@ bool InlineFunction(InvokeInst *II) { return InlineFunction(CallSite(II)); } // exists in the instruction stream. Similiarly this will inline a recursive // function by one level. // -bool InlineFunction(CallSite CS) { +bool llvm::InlineFunction(CallSite CS) { Instruction *TheCall = CS.getInstruction(); assert(TheCall->getParent() && TheCall->getParent()->getParent() && "Instruction not in function!"); @@ -280,5 +279,3 @@ bool InlineFunction(CallSite CS) { SimplifyCFG(AfterCallBB); return true; } - -} // End llvm namespace diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp index bdbdb7d4ccc..af430bd70b7 100644 --- a/lib/Transforms/Utils/Linker.cpp +++ b/lib/Transforms/Utils/Linker.cpp @@ -23,8 +23,7 @@ #include "llvm/SymbolTable.h" #include "llvm/iOther.h" #include "llvm/Assembly/Writer.h" - -namespace llvm { +using namespace llvm; // Error - Simple wrapper function to conditionally assign to E and return true. // This just makes error return conditions a little bit simpler... @@ -842,7 +841,7 @@ static bool LinkAppendingVars(Module *M, // the problem. Upon failure, the Dest module could be in a modified state, and // shouldn't be relied on to be consistent. // -bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { +bool llvm::LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { if (Dest->getEndianness() == Module::AnyEndianness) Dest->setEndianness(Src->getEndianness()); if (Dest->getPointerSize() == Module::AnyPointerSize) @@ -909,4 +908,3 @@ bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { return false; } -} // End llvm namespace diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 0859f699801..af4892fb915 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -24,13 +24,12 @@ #include "llvm/Constant.h" #include "llvm/Support/CFG.h" #include "Support/StringExtras.h" - -namespace llvm { +using namespace llvm; /// isAllocaPromotable - Return true if this alloca is legal for promotion. /// This is true if there are only loads and stores to the alloca... /// -bool isAllocaPromotable(const AllocaInst *AI, const TargetData &TD) { +bool llvm::isAllocaPromotable(const AllocaInst *AI, const TargetData &TD) { // FIXME: If the memory unit is of pointer or integer type, we can permit // assignments to subsections of the memory unit. @@ -454,12 +453,10 @@ void PromoteMem2Reg::RenamePass(BasicBlock *BB, BasicBlock *Pred, /// use of DominanceFrontier information. This function does not modify the CFG /// of the function at all. All allocas must be from the same function. /// -void PromoteMemToReg(const std::vector &Allocas, - DominatorTree &DT, DominanceFrontier &DF, - const TargetData &TD) { +void llvm::PromoteMemToReg(const std::vector &Allocas, + DominatorTree &DT, DominanceFrontier &DF, + const TargetData &TD) { // If there is nothing to do, bail out... if (Allocas.empty()) return; PromoteMem2Reg(Allocas, DT, DF, TD).run(); } - -} // End llvm namespace diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 158d9119ae5..b827123e609 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -20,8 +20,7 @@ #include "llvm/Support/CFG.h" #include #include - -namespace llvm { +using namespace llvm; // PropagatePredecessors - This gets "Succ" ready to have the predecessors from // "BB". This is a little tricky because "Succ" has PHI nodes, which need to @@ -98,7 +97,7 @@ static bool PropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) { // // WARNING: The entry node of a function may not be simplified. // -bool SimplifyCFG(BasicBlock *BB) { +bool llvm::SimplifyCFG(BasicBlock *BB) { bool Changed = false; Function *M = BB->getParent(); @@ -300,5 +299,3 @@ bool SimplifyCFG(BasicBlock *BB) { return Changed; } - -} // End llvm namespace diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 248ebace7a5..40dd58a1461 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -15,10 +15,9 @@ #include "ValueMapper.h" #include "llvm/Constants.h" #include "llvm/Instruction.h" +using namespace llvm; -namespace llvm { - -Value *MapValue(const Value *V, std::map &VM) { +Value *llvm::MapValue(const Value *V, std::map &VM) { Value *&VMSlot = VM[V]; if (VMSlot) return VMSlot; // Does it exist in the map yet? @@ -106,5 +105,3 @@ Value *MapValue(const Value *V, std::map &VM) { assert(0 && "Unknown value type: why didn't it get resolved?!"); return 0; } - -} // End llvm namespace diff --git a/lib/Transforms/Utils/ValueMapper.h b/lib/Transforms/Utils/ValueMapper.h index e67b3261dba..941a8b3c5db 100644 --- a/lib/Transforms/Utils/ValueMapper.h +++ b/lib/Transforms/Utils/ValueMapper.h @@ -18,11 +18,8 @@ #include namespace llvm { - -class Value; - -Value *MapValue(const Value *V, std::map &VM); - + class Value; + Value *MapValue(const Value *V, std::map &VM); } // End llvm namespace #endif diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp index bdbdb7d4ccc..af430bd70b7 100644 --- a/lib/VMCore/Linker.cpp +++ b/lib/VMCore/Linker.cpp @@ -23,8 +23,7 @@ #include "llvm/SymbolTable.h" #include "llvm/iOther.h" #include "llvm/Assembly/Writer.h" - -namespace llvm { +using namespace llvm; // Error - Simple wrapper function to conditionally assign to E and return true. // This just makes error return conditions a little bit simpler... @@ -842,7 +841,7 @@ static bool LinkAppendingVars(Module *M, // the problem. Upon failure, the Dest module could be in a modified state, and // shouldn't be relied on to be consistent. // -bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { +bool llvm::LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { if (Dest->getEndianness() == Module::AnyEndianness) Dest->setEndianness(Src->getEndianness()); if (Dest->getPointerSize() == Module::AnyPointerSize) @@ -909,4 +908,3 @@ bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { return false; } -} // End llvm namespace