From 3da94aec4d429b2ba0f65fa040c33650cade196b Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Fri, 22 Apr 2005 00:00:37 +0000 Subject: Remove trailing whitespace git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21428 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/analyze/AnalysisWrappers.cpp | 6 +-- tools/analyze/GraphPrinters.cpp | 10 ++-- tools/analyze/analyze.cpp | 12 ++--- tools/bugpoint/BugDriver.cpp | 6 +-- tools/bugpoint/BugDriver.h | 8 +-- tools/bugpoint/CrashDebugger.cpp | 40 +++++++-------- tools/bugpoint/ExecutionDriver.cpp | 10 ++-- tools/bugpoint/ExtractFunction.cpp | 10 ++-- tools/bugpoint/ListReducer.h | 8 +-- tools/bugpoint/Miscompilation.cpp | 46 ++++++++--------- tools/bugpoint/OptimizerDriver.cpp | 6 +-- tools/bugpoint/TestPasses.cpp | 4 +- tools/bugpoint/bugpoint.cpp | 4 +- tools/extract/extract.cpp | 10 ++-- tools/gccas/gccas.cpp | 16 +++--- tools/gccld/GenerateCode.cpp | 12 ++--- tools/gccld/gccld.cpp | 34 ++++++------- tools/gccld/gccld.h | 8 +-- tools/llc/llc.cpp | 18 +++---- tools/lli/lli.cpp | 4 +- tools/llvm-ar/llvm-ar.cpp | 74 ++++++++++++++-------------- tools/llvm-as/llvm-as.cpp | 20 ++++---- tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp | 26 +++++----- tools/llvm-db/CLICommand.h | 8 +-- tools/llvm-db/CLIDebugger.cpp | 28 +++++------ tools/llvm-db/CLIDebugger.h | 8 +-- tools/llvm-db/Commands.cpp | 34 ++++++------- tools/llvm-db/llvm-db.cpp | 8 +-- tools/llvm-dis/llvm-dis.cpp | 8 +-- tools/llvm-extract/llvm-extract.cpp | 10 ++-- tools/llvm-ld/Optimize.cpp | 28 +++++------ tools/llvm-ld/llvm-ld.cpp | 40 +++++++-------- tools/llvm-link/llvm-link.cpp | 6 +-- tools/llvm-nm/llvm-nm.cpp | 10 ++-- tools/llvm-prof/llvm-prof.cpp | 22 ++++----- tools/llvm-ranlib/llvm-ranlib.cpp | 12 ++--- tools/llvmc/CompilerDriver.cpp | 82 +++++++++++++++---------------- tools/llvmc/CompilerDriver.h | 18 +++---- tools/llvmc/ConfigLexer.h | 10 ++-- tools/llvmc/Configuration.cpp | 70 +++++++++++++------------- tools/llvmc/Configuration.h | 14 +++--- tools/llvmc/llvmc.cpp | 22 ++++----- tools/opt/AnalysisWrappers.cpp | 6 +-- tools/opt/GraphPrinters.cpp | 10 ++-- tools/opt/opt.cpp | 6 +-- 45 files changed, 426 insertions(+), 426 deletions(-) (limited to 'tools') diff --git a/tools/analyze/AnalysisWrappers.cpp b/tools/analyze/AnalysisWrappers.cpp index 46ede0a153..dcbd349ff2 100644 --- a/tools/analyze/AnalysisWrappers.cpp +++ b/tools/analyze/AnalysisWrappers.cpp @@ -1,10 +1,10 @@ //===- AnalysisWrappers.cpp - Wrappers around non-pass analyses -----------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines pass wrappers around LLVM analyses that don't make sense to @@ -56,7 +56,7 @@ namespace { } void print(std::ostream &OS) const {} - + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } diff --git a/tools/analyze/GraphPrinters.cpp b/tools/analyze/GraphPrinters.cpp index 9fd09c94fd..6f2ca5dd81 100644 --- a/tools/analyze/GraphPrinters.cpp +++ b/tools/analyze/GraphPrinters.cpp @@ -1,10 +1,10 @@ //===- GraphPrinters.cpp - DOT printers for various graph types -----------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines several printers for various different types of graphs used @@ -27,7 +27,7 @@ static void WriteGraphToFile(std::ostream &O, const std::string &GraphName, std::string Filename = GraphName + ".dot"; O << "Writing '" << Filename << "'..."; std::ofstream F(Filename.c_str()); - + if (F.good()) WriteGraph(F, GT); else @@ -46,7 +46,7 @@ namespace llvm { static std::string getGraphName(CallGraph *F) { return "Call Graph"; } - + static std::string getNodeLabel(CallGraphNode *Node, CallGraph *Graph) { if (Node->getFunction()) return ((Value*)Node->getFunction())->getName(); @@ -65,7 +65,7 @@ namespace { } void print(std::ostream &OS) const {} - + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.setPreservesAll(); diff --git a/tools/analyze/analyze.cpp b/tools/analyze/analyze.cpp index 0ac70687da..2e73e345e0 100644 --- a/tools/analyze/analyze.cpp +++ b/tools/analyze/analyze.cpp @@ -1,14 +1,14 @@ //===- analyze.cpp - The LLVM analyze utility -----------------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility is designed to print out the results of running various analysis -// passes on a program. This is useful for understanding a program, or for +// passes on a program. This is useful for understanding a program, or for // debugging an analysis pass. // // analyze --help - Output information about command line switches @@ -37,11 +37,11 @@ struct ModulePassPrinter : public ModulePass { virtual bool runOnModule(Module &M) { std::cout << "Printing analysis '" << PassToPrint->getPassName() << "':\n"; getAnalysisID(PassToPrint).print(std::cout, &M); - + // Get and print pass... return false; } - + virtual const char *getPassName() const { return "'Pass' Printer"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -150,7 +150,7 @@ int main(int argc, char **argv) { // Create a new optimization pass for each one specified on the command line for (unsigned i = 0; i < AnalysesList.size(); ++i) { const PassInfo *Analysis = AnalysesList[i]; - + if (Analysis->getNormalCtor()) { Pass *P = Analysis->getNormalCtor()(); Passes.add(P); diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index ad520d7678..17e3374117 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -1,10 +1,10 @@ //===- BugDriver.cpp - Top-Level BugPoint class implementation ------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This class contains all of the shared state and information that is used by @@ -35,7 +35,7 @@ namespace { // otherwise the raw input run through an interpreter is used as the reference // source. // - cl::opt + cl::opt OutputFile("output", cl::desc("Specify a reference program output " "(for miscompilation detection)")); } diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h index 5e78145b6f..e610c67f70 100644 --- a/tools/bugpoint/BugDriver.h +++ b/tools/bugpoint/BugDriver.h @@ -1,10 +1,10 @@ //===- BugDriver.h - Top-Level BugPoint class -------------------*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This class contains all of the shared state and information that is used by @@ -76,7 +76,7 @@ public: /// reasonable, and figure out exactly which pass is crashing. /// bool debugOptimizerCrash(); - + /// debugCodeGeneratorCrash - This method is called when the code generator /// crashes on an input. It attempts to reduce the input as much as possible /// while still causing the code generator to crash. @@ -139,7 +139,7 @@ public: void switchToInterpreter(AbstractInterpreter *AI) { Interpreter = AI; } - + /// setNewProgram - If we reduce or update the program somehow, call this /// method to update bugdriver with it. This deletes the old module and sets /// the specified one as the current program. diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index 4d8011df28..6f0e3de0f4 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -1,10 +1,10 @@ //===- CrashDebugger.cpp - Debug compilation crashes ----------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines the bugpoint internals that narrow down compilation crashes @@ -36,7 +36,7 @@ namespace llvm { BugDriver &BD; public: ReducePassList(BugDriver &bd) : BD(bd) {} - + // doTest - Return true iff running the "removed" passes succeeds, and // running the "Kept" passes fail when run on the output of the "removed" // passes. If we return true, we update the current module of bugpoint. @@ -72,7 +72,7 @@ ReducePassList::doTest(std::vector &Prefix, std::cout << "Checking to see if these passes crash: " << getPassesString(Suffix) << ": "; - + if (BD.runPasses(Suffix)) { delete OrigProgram; // The suffix crashes alone... return KeepSuffix; @@ -94,7 +94,7 @@ namespace llvm { ReduceCrashingFunctions(BugDriver &bd, bool (*testFn)(BugDriver &, Module *)) : BD(bd), TestFn(testFn) {} - + virtual TestResult doTest(std::vector &Prefix, std::vector &Kept) { if (!Kept.empty() && TestFuncs(Kept)) @@ -103,7 +103,7 @@ namespace llvm { return KeepPrefix; return NoFailure; } - + bool TestFuncs(std::vector &Prefix); }; } @@ -111,11 +111,11 @@ namespace llvm { bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) { // Clone the program to try hacking it apart... Module *M = CloneModule(BD.getProgram()); - + // Convert list to set for fast lookup... std::set Functions; for (unsigned i = 0, e = Funcs.size(); i != e; ++i) { - Function *CMF = M->getFunction(Funcs[i]->getName(), + Function *CMF = M->getFunction(Funcs[i]->getName(), Funcs[i]->getFunctionType()); assert(CMF && "Function not in module?!"); Functions.insert(CMF); @@ -157,7 +157,7 @@ namespace { public: ReduceCrashingBlocks(BugDriver &bd, bool (*testFn)(BugDriver &, Module *)) : BD(bd), TestFn(testFn) {} - + virtual TestResult doTest(std::vector &Prefix, std::vector &Kept) { if (!Kept.empty() && TestBlocks(Kept)) @@ -166,7 +166,7 @@ namespace { return KeepPrefix; return NoFailure; } - + bool TestBlocks(std::vector &Prefix); }; } @@ -174,7 +174,7 @@ namespace { bool ReduceCrashingBlocks::TestBlocks(std::vector &BBs) { // Clone the program to try hacking it apart... Module *M = CloneModule(BD.getProgram()); - + // Convert list to set for fast lookup... std::set Blocks; for (unsigned i = 0, e = BBs.size(); i != e; ++i) { @@ -214,7 +214,7 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector &BBs) { // Delete the old terminator instruction... BB->getInstList().pop_back(); - + // Add a new return instruction of the appropriate type... const Type *RetTy = BB->getParent()->getReturnType(); new ReturnInst(RetTy == Type::VoidTy ? 0 : @@ -274,7 +274,7 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { I->setLinkage(GlobalValue::ExternalLinkage); DeletedInit = true; } - + if (!DeletedInit) { delete M; // No change made... } else { @@ -290,7 +290,7 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { } } } - + // Now try to reduce the number of functions in the module to something small. std::vector Functions; for (Module::iterator I = BD.getProgram()->begin(), @@ -343,7 +343,7 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { // unsigned InstructionsToSkipBeforeDeleting = 0; TryAgain: - + // Loop over all of the (non-terminator) instructions remaining in the // function, attempting to delete them. unsigned CurInstructionNum = 0; @@ -359,7 +359,7 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { } else { std::cout << "Checking instruction '" << I->getName() << "': "; Module *M = BD.deleteInstructionFromProgram(I, Simplification); - + // Find out if the pass still crashes on this pass... if (TestFn(BD, M)) { // Yup, it does, we delete the old module, and continue trying @@ -369,7 +369,7 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { InstructionsToSkipBeforeDeleting = CurInstructionNum; goto TryAgain; // I wish I had a multi-level break here! } - + // This pass didn't crash without this instruction, try the next // one. delete M; @@ -379,14 +379,14 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { InstructionsToSkipBeforeDeleting = 0; goto TryAgain; } - + } while (Simplification); // Try to clean up the testcase by running funcresolve and globaldce... std::cout << "\n*** Attempting to perform final cleanups: "; Module *M = CloneModule(BD.getProgram()); M = BD.performFinalCleanups(M, true); - + // Find out if the pass still crashes on the cleaned up program... if (TestFn(BD, M)) { BD.setNewProgram(M); // Yup, it does, keep the reduced version... @@ -398,7 +398,7 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { if (AnyReduction) BD.EmitProgressBytecode("reduced-simplified"); - return false; + return false; } static bool TestForOptimizerCrash(BugDriver &BD, Module *M) { diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp index 966902cec8..972338acad 100644 --- a/tools/bugpoint/ExecutionDriver.cpp +++ b/tools/bugpoint/ExecutionDriver.cpp @@ -1,10 +1,10 @@ //===- ExecutionDriver.cpp - Allow execution of LLVM program --------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file contains code used to execute the program utilizing one of the @@ -276,7 +276,7 @@ std::string BugDriver::compileSharedObject(const std::string &BytecodeFile) { #endif std::string SharedObjectFile; - if (gcc->MakeSharedObject(OutputCFile.toString(), GCC::CFile, + if (gcc->MakeSharedObject(OutputCFile.toString(), GCC::CFile, SharedObjectFile)) exit(1); @@ -303,7 +303,7 @@ bool BugDriver::diffProgram(const std::string &BytecodeFile, // If we're checking the program exit code, assume anything nonzero is bad. if (CheckProgramExitCode && ProgramExitedNonzero) { Output.destroyFile(); - if (RemoveBytecode) + if (RemoveBytecode) sys::Path(BytecodeFile).destroyFile(); return true; } @@ -319,7 +319,7 @@ bool BugDriver::diffProgram(const std::string &BytecodeFile, } FilesDifferent = true; } - + // Remove the generated output. Output.destroyFile(); diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index 1c7225d73f..7f9005a19f 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -1,10 +1,10 @@ //===- ExtractFunction.cpp - Extract a function from Program --------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file implements several methods that are used to extract functions, @@ -104,7 +104,7 @@ Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) { // Make all functions external, so GlobalDCE doesn't delete them... for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) I->setLinkage(GlobalValue::ExternalLinkage); - + std::vector CleanupPasses; CleanupPasses.push_back(getPI(createFunctionResolvingPass())); CleanupPasses.push_back(getPI(createGlobalDCEPass())); @@ -155,7 +155,7 @@ Module *BugDriver::ExtractLoop(Module *M) { for (unsigned i = 0, e = M->size(); i != e; ++i) ++MI; } - + return NewM; } @@ -251,7 +251,7 @@ bool BlockExtractorPass::runOnModule(Module &M) { for (unsigned i = 0, e = BlocksToExtract.size(); i != e; ++i) ExtractBasicBlock(BlocksToExtract[i]); - + return !BlocksToExtract.empty(); } diff --git a/tools/bugpoint/ListReducer.h b/tools/bugpoint/ListReducer.h index 4057a0f454..daeadba885 100644 --- a/tools/bugpoint/ListReducer.h +++ b/tools/bugpoint/ListReducer.h @@ -1,10 +1,10 @@ //===- ListReducer.h - Trim down list while retaining property --*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This class is to be used as a base class for operations that want to zero in @@ -48,7 +48,7 @@ struct ListReducer { case KeepPrefix: if (TheList.size() == 1) // we are done, it's the base case and it fails return true; - else + else break; // there's definitely an error, but we need to narrow it down case KeepSuffix: @@ -107,7 +107,7 @@ struct ListReducer { Changed = true; } } - // This can take a long time if left uncontrolled. For now, don't + // This can take a long time if left uncontrolled. For now, don't // iterate. break; } diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index e72563be53..c7f954df3c 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -1,10 +1,10 @@ //===- Miscompilation.cpp - Debug program miscompilations -----------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file implements optimizer and code generation miscompilation debugging @@ -37,7 +37,7 @@ namespace { BugDriver &BD; public: ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {} - + virtual TestResult doTest(std::vector &Prefix, std::vector &Suffix); }; @@ -56,7 +56,7 @@ ReduceMiscompilingPasses::doTest(std::vector &Prefix, std::string BytecodeResult; if (BD.runPasses(Suffix, BytecodeResult, false/*delete*/, true/*quiet*/)) { - std::cerr << " Error running this sequence of passes" + std::cerr << " Error running this sequence of passes" << " on the input program!\n"; BD.setPassesToRun(Suffix); BD.EmitProgressBytecode("pass-error", false); @@ -89,7 +89,7 @@ ReduceMiscompilingPasses::doTest(std::vector &Prefix, // prefix passes, then discard the prefix passes. // if (BD.runPasses(Prefix, BytecodeResult, false/*delete*/, true/*quiet*/)) { - std::cerr << " Error running this sequence of passes" + std::cerr << " Error running this sequence of passes" << " on the input program!\n"; BD.setPassesToRun(Prefix); BD.EmitProgressBytecode("pass-error", false); @@ -118,14 +118,14 @@ ReduceMiscompilingPasses::doTest(std::vector &Prefix, // Don't check if there are no passes in the suffix. if (Suffix.empty()) return NoFailure; - + std::cout << "Checking to see if '" << getPassesString(Suffix) << "' passes compile correctly after the '" << getPassesString(Prefix) << "' passes: "; Module *OriginalInput = BD.swapProgramIn(PrefixOutput); if (BD.runPasses(Suffix, BytecodeResult, false/*delete*/, true/*quiet*/)) { - std::cerr << " Error running this sequence of passes" + std::cerr << " Error running this sequence of passes" << " on the input program!\n"; BD.setPassesToRun(Suffix); BD.EmitProgressBytecode("pass-error", false); @@ -153,7 +153,7 @@ namespace { ReduceMiscompilingFunctions(BugDriver &bd, bool (*F)(BugDriver &, Module *, Module *)) : BD(bd), TestFn(F) {} - + virtual TestResult doTest(std::vector &Prefix, std::vector &Suffix) { if (!Suffix.empty() && TestFuncs(Suffix)) @@ -162,7 +162,7 @@ namespace { return KeepPrefix; return NoFailure; } - + bool TestFuncs(const std::vector &Prefix); }; } @@ -280,7 +280,7 @@ static bool ExtractLoops(BugDriver &BD, return MadeChange; } BD.switchToInterpreter(AI); - + std::cout << " Testing after loop extraction:\n"; // Clone modules, the tester function will free them. Module *TOLEBackup = CloneModule(ToOptimizeLoopExtracted); @@ -343,7 +343,7 @@ namespace { bool (*F)(BugDriver &, Module *, Module *), const std::vector &Fns) : BD(bd), TestFn(F), FunctionsBeingTested(Fns) {} - + virtual TestResult doTest(std::vector &Prefix, std::vector &Suffix) { if (!Suffix.empty() && TestFuncs(Suffix)) @@ -352,7 +352,7 @@ namespace { return KeepPrefix; return NoFailure; } - + bool TestFuncs(const std::vector &Prefix); }; } @@ -506,7 +506,7 @@ DebugAMiscompilation(BugDriver &BD, // Do the reduction... ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions); - + std::cout << "\n*** The following function" << (MiscompiledFunctions.size() == 1 ? " is" : "s are") << " being miscompiled: "; @@ -525,7 +525,7 @@ DebugAMiscompilation(BugDriver &BD, // Do the reduction... ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions); - + std::cout << "\n*** The following function" << (MiscompiledFunctions.size() == 1 ? " is" : "s are") << " being miscompiled: "; @@ -586,7 +586,7 @@ bool BugDriver::debugMiscompilation() { ToNotOptimize = swapProgramIn(ToNotOptimize); EmitProgressBytecode("tonotoptimize", true); setNewProgram(ToNotOptimize); // Delete hacked module. - + std::cout << " Portion that is input to optimizer: "; ToOptimize = swapProgramIn(ToOptimize); EmitProgressBytecode("tooptimize"); @@ -614,12 +614,12 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // Rename it oldMain->setName("llvm_bugpoint_old_main"); // Create a NEW `main' function with same type in the test module. - Function *newMain = new Function(oldMain->getFunctionType(), + Function *newMain = new Function(oldMain->getFunctionType(), GlobalValue::ExternalLinkage, "main", Test); // Create an `oldmain' prototype in the test module, which will // corresponds to the real main function in the same module. - Function *oldMainProto = new Function(oldMain->getFunctionType(), + Function *oldMainProto = new Function(oldMain->getFunctionType(), GlobalValue::ExternalLinkage, oldMain->getName(), Test); // Set up and remember the argument list for the main function. @@ -634,7 +634,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // Call the old main function and return its result BasicBlock *BB = new BasicBlock("entry", newMain); CallInst *call = new CallInst(oldMainProto, args, "", BB); - + // If the type of old function wasn't void, return value of call new ReturnInst(call, BB); } @@ -643,14 +643,14 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // module cannot directly reference any functions defined in the test // module. Instead, we use a JIT API call to dynamically resolve the // symbol. - + // Add the resolver to the Safe module. // Prototype: void *getPointerToNamedFunction(const char* Name) - Function *resolverFunc = + Function *resolverFunc = Safe->getOrInsertFunction("getPointerToNamedFunction", PointerType::get(Type::SByteTy), PointerType::get(Type::SByteTy), 0); - + // Use the function we just added to get addresses of functions we need. for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) { if (F->isExternal() && !F->use_empty() && &*F != resolverFunc && @@ -663,7 +663,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, Constant *InitArray = ConstantArray::get(F->getName()); GlobalVariable *funcName = new GlobalVariable(InitArray->getType(), true /*isConstant*/, - GlobalValue::InternalLinkage, InitArray, + GlobalValue::InternalLinkage, InitArray, F->getName() + "_name", Safe); // 2. Use `GetElementPtr *funcName, 0, 0' to convert the string to an @@ -690,7 +690,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // Resolve the call to function F via the JIT API: // // call resolver(GetElementPtr...) - CallInst *resolve = new CallInst(resolverFunc, ResolverArgs, + CallInst *resolve = new CallInst(resolverFunc, ResolverArgs, "resolver"); Header->getInstList().push_back(resolve); // cast the result from the resolver to correctly-typed function diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index 27698bd6fb..7feccab6ba 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -1,10 +1,10 @@ //===- OptimizerDriver.cpp - Allow BugPoint to run passes safely ----------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines an interface that allows bugpoint to run various passes @@ -195,7 +195,7 @@ Module *BugDriver::runPassesOn(Module *M, std::string BytecodeResult; if (runPasses(Passes, BytecodeResult, false/*delete*/, true/*quiet*/)) { if (AutoDebugCrashes) { - std::cerr << " Error running this sequence of passes" + std::cerr << " Error running this sequence of passes" << " on the input program!\n"; delete OldProgram; EmitProgressBytecode("pass-error", false); diff --git a/tools/bugpoint/TestPasses.cpp b/tools/bugpoint/TestPasses.cpp index b2539340c1..5147a90707 100644 --- a/tools/bugpoint/TestPasses.cpp +++ b/tools/bugpoint/TestPasses.cpp @@ -1,10 +1,10 @@ //===- TestPasses.cpp - "buggy" passes used to test bugpoint --------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file contains "buggy" passes that are used to test bugpoint, to check diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp index 9e5b4c4e87..3cbb4c0ff6 100644 --- a/tools/bugpoint/bugpoint.cpp +++ b/tools/bugpoint/bugpoint.cpp @@ -1,10 +1,10 @@ //===- bugpoint.cpp - The LLVM Bugpoint utility ---------------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This program is an automated compiler debugger tool. It is used to narrow diff --git a/tools/extract/extract.cpp b/tools/extract/extract.cpp index 3f24e387e6..78d0426be1 100644 --- a/tools/extract/extract.cpp +++ b/tools/extract/extract.cpp @@ -1,10 +1,10 @@ //===- extract.cpp - LLVM function extraction utility ---------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility changes the input module to only contain a single function, @@ -28,9 +28,9 @@ using namespace llvm; static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-"), cl::value_desc("filename")); - + static cl::opt -OutputFilename("o", cl::desc("Specify output filename"), +OutputFilename("o", cl::desc("Specify output filename"), cl::value_desc("filename"), cl::init("-")); static cl::opt @@ -88,7 +88,7 @@ int main(int argc, char **argv) { Out = new std::ofstream(OutputFilename.c_str(), io_mode); } else { // Specified stdout // FIXME: cout is not binary! - Out = &std::cout; + Out = &std::cout; } Passes.add(new WriteBytecodePass(Out)); // Write bytecode to file... diff --git a/tools/gccas/gccas.cpp b/tools/gccas/gccas.cpp index 1192d6a366..896b79a022 100644 --- a/tools/gccas/gccas.cpp +++ b/tools/gccas/gccas.cpp @@ -1,10 +1,10 @@ //===-- gccas.cpp - The "optimizing assembler" used by the GCC frontend ---===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility is designed to be used by the GCC frontend for creating bytecode @@ -33,11 +33,11 @@ namespace { cl::opt InputFilename(cl::Positional,cl::desc(""),cl::init("-")); - cl::opt + cl::opt OutputFilename("o", cl::desc("Override output filename"), cl::value_desc("filename")); - cl::opt + cl::opt Verify("verify", cl::desc("Verify each pass result")); cl::opt @@ -51,7 +51,7 @@ namespace { StripDebug("strip-debug", cl::desc("Strip debugger symbol info from translation unit")); - cl::opt + cl::opt NoCompress("disable-compression", cl::init(false), cl::desc("Don't compress the generated bytecode")); @@ -63,7 +63,7 @@ namespace { static inline void addPass(PassManager &PM, Pass *P) { // Add the pass to the pass manager... PM.add(P); - + // If we are verifying all of the intermediate steps, add the verifier... if (Verify) PM.add(createVerifierPass()); } @@ -128,7 +128,7 @@ void AddConfiguredTransformationPasses(PassManager &PM) { int main(int argc, char **argv) { try { - cl::ParseCommandLineOptions(argc, argv, + cl::ParseCommandLineOptions(argc, argv, " llvm .s -> .o assembler for GCC\n"); sys::PrintStackTraceOnErrorSignal(); @@ -175,7 +175,7 @@ int main(int argc, char **argv) { sys::RemoveFileOnSignal(sys::Path(OutputFilename)); } - + if (!Out->good()) { std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; return 1; diff --git a/tools/gccld/GenerateCode.cpp b/tools/gccld/GenerateCode.cpp index f0466ddd33..020d883a6b 100644 --- a/tools/gccld/GenerateCode.cpp +++ b/tools/gccld/GenerateCode.cpp @@ -1,10 +1,10 @@ //===- GenerateCode.cpp - Functions for generating executable files ------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file contains functions for generating executable files once linking @@ -154,8 +154,8 @@ static bool isBytecodeLPath(const std::string &LibPath) { // Make sure the -L path has a '/' character // because llvm-g++ passes them without the ending - // '/' char and sys::Path doesn't think it is a - // directory (see: sys::Path::isDirectory) without it + // '/' char and sys::Path doesn't think it is a + // directory (see: sys::Path::isDirectory) without it std::string dir = LibPath; if ( dir[dir.length()-1] != '/' ) dir.append("/"); @@ -406,7 +406,7 @@ int llvm::GenerateNative(const std::string &OutputFilename, // // Note: // When gccld is called from the llvm-gxx frontends, the -L paths for - // the LLVM cfrontend install paths are appended. We don't want the + // the LLVM cfrontend install paths are appended. We don't want the // native linker to use these -L paths as they contain bytecode files. // Further, we don't want any -L paths that contain bytecode shared // libraries or true bytecode archive files. We omit them in all such @@ -417,7 +417,7 @@ int llvm::GenerateNative(const std::string &OutputFilename, args.push_back(LibPaths[index].c_str()); } } - + // Add in the libraries to link. for (unsigned index = 0; index < Libraries.size(); index++) { if (Libraries[index] != "crtend") { diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp index 2cf5efbe7b..6d49466c19 100644 --- a/tools/gccld/gccld.cpp +++ b/tools/gccld/gccld.cpp @@ -1,10 +1,10 @@ //===- gccld.cpp - LLVM 'ld' compatible linker ----------------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility is intended to be compatible with GCC, and follows standard @@ -38,22 +38,22 @@ using namespace llvm; namespace { - cl::list + cl::list InputFilenames(cl::Positional, cl::desc(""), cl::OneOrMore); - cl::opt + cl::opt OutputFilename("o", cl::desc("Override output filename"), cl::init("a.out"), cl::value_desc("filename")); cl::opt Verbose("v", cl::desc("Print information about actions taken")); - cl::list + cl::list LibPaths("L", cl::desc("Specify a library search path"), cl::Prefix, cl::value_desc("directory")); - cl::list + cl::list Libraries("l", cl::desc("Specify libraries to link to"), cl::Prefix, cl::value_desc("library prefix")); @@ -91,13 +91,13 @@ namespace { cl::opt RPath("rpath", cl::desc("Set runtime shared library search path (requires -native or" - " -native-cbe)"), + " -native-cbe)"), cl::Prefix, cl::value_desc("directory")); cl::opt SOName("soname", cl::desc("Set internal name of shared library (requires -native or" - " -native-cbe)"), + " -native-cbe)"), cl::Prefix, cl::value_desc("name")); // Compatibility options that are ignored but supported by LD @@ -155,12 +155,12 @@ static void EmitShellScript(char **argv) { // We don't need to link in libc! In fact, /usr/lib/libc.so may not be a // shared object at all! See RH 8: plain text. - std::vector::iterator libc = + std::vector::iterator libc = std::find(Libraries.begin(), Libraries.end(), "c"); if (libc != Libraries.end()) Libraries.erase(libc); // List all the shared object (native) libraries this executable will need // on the command line, so that we don't have to do this manually! - for (std::vector::iterator i = Libraries.begin(), + for (std::vector::iterator i = Libraries.begin(), e = Libraries.end(); i != e; ++i) { sys::Path FullLibraryPath = sys::Path::FindLibrary(*i); if (!FullLibraryPath.isEmpty() && FullLibraryPath.isDynamicLibrary()) @@ -178,7 +178,7 @@ static void BuildLinkItems( const cl::list& Files, const cl::list& Libraries) { - // Build the list of linkage items for LinkItems. + // Build the list of linkage items for LinkItems. cl::list::const_iterator fileIt = Files.begin(); cl::list::const_iterator libIt = Libraries.begin(); @@ -231,7 +231,7 @@ int main(int argc, char **argv, char **envp ) { // The libraries aren't linked in but are noted as "dependent" in the // module. - for (cl::list::const_iterator I = Libraries.begin(), + for (cl::list::const_iterator I = Libraries.begin(), E = Libraries.end(); I != E ; ++I) { TheLinker.getModule()->addLibrary(*I); } @@ -267,7 +267,7 @@ int main(int argc, char **argv, char **envp ) { // strip debug info. int StripLevel = Strip ? 2 : (StripDebug ? 1 : 0); - // Internalize the module if neither -disable-internalize nor + // Internalize the module if neither -disable-internalize nor // -link-as-library are passed in. bool ShouldInternalize = !NoInternalize & !LinkAsLibrary; @@ -281,8 +281,8 @@ int main(int argc, char **argv, char **envp ) { Out.close(); // Generate either a native file or a JIT shell script. If the user wants - // to generate a native file, compile it from the bytecode file. Otherwise, - // if the target is not a library, create a script that will run the + // to generate a native file, compile it from the bytecode file. Otherwise, + // if the target is not a library, create a script that will run the // bytecode through the JIT. if (Native) { // Name of the Assembly Language output file @@ -304,10 +304,10 @@ int main(int argc, char **argv, char **envp ) { // Generate an assembly language file for the bytecode. if (Verbose) std::cout << "Generating Assembly Code\n"; - GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, llc, + GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, llc, Verbose); if (Verbose) std::cout << "Generating Native Code\n"; - GenerateNative(OutputFilename, AssemblyFile.toString(), + GenerateNative(OutputFilename, AssemblyFile.toString(), LibPaths, Libraries, gcc, envp, LinkAsLibrary, RPath, SOName, Verbose); diff --git a/tools/gccld/gccld.h b/tools/gccld/gccld.h index ef125bb44c..5b7bdf1c47 100644 --- a/tools/gccld/gccld.h +++ b/tools/gccld/gccld.h @@ -1,10 +1,10 @@ //===- gccld.h - Utility functions header file ------------------*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file contains function prototypes for the functions in util.cpp. @@ -32,8 +32,8 @@ GenerateAssembly (const std::string &OutputFilename, const sys::Path &llc, bool Verbose=false); -int -GenerateCFile (const std::string &OutputFile, +int +GenerateCFile (const std::string &OutputFile, const std::string &InputFile, const sys::Path &llc, bool Verbose=false); diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index cbb2507f3f..cc1ffd94fd 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -1,14 +1,14 @@ //===-- llc.cpp - Implement the LLVM Native Code Generator ----------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This is the llc code generator driver. It provides a convenient -// command-line interface for generating native assembly-language code +// command-line interface for generating native assembly-language code // or C code, given LLVM bytecode. // //===----------------------------------------------------------------------===// @@ -32,7 +32,7 @@ using namespace llvm; // General options for llc. Other pass-specific options are specified // within the corresponding llc passes, and target-specific options // and back-end code generation options are specified with the target machine. -// +// static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-")); @@ -43,7 +43,7 @@ static cl::opt Force("f", cl::desc("Overwrite output files")); static cl::opt MArch("march", cl::desc("Architecture to generate assembly for:")); - + // GetFileNameRoot - Helper function to get the basename of a filename... static inline std::string GetFileNameRoot(const std::string &InputFilename) { @@ -125,13 +125,13 @@ int main(int argc, char **argv) { OutputFilename = "-"; Out = &std::cout; } else { - OutputFilename = GetFileNameRoot(InputFilename); + OutputFilename = GetFileNameRoot(InputFilename); if (MArch->Name[0] != 'c' || MArch->Name[1] != 0) // not CBE OutputFilename += ".s"; else OutputFilename += ".cbe.c"; - + if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! std::cerr << argv[0] << ": error opening '" << OutputFilename @@ -139,14 +139,14 @@ int main(int argc, char **argv) { << "Use -f command line argument to force output\n"; return 1; } - + Out = new std::ofstream(OutputFilename.c_str()); if (!Out->good()) { std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; delete Out; return 1; } - + // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT sys::RemoveFileOnSignal(sys::Path(OutputFilename)); diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 6d16ea5c80..bd22b2924b 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -1,10 +1,10 @@ //===- lli.cpp - LLVM Interpreter / Dynamic compiler ----------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility provides a simple wrapper around the LLVM Execution Engines, diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 3617da6279..cc3d2d8ec7 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -1,13 +1,13 @@ //===-- llvm-ar.cpp - LLVM archive librarian utility ----------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // -// Builds up (relatively) standard unix archive files (.a) containing LLVM +// Builds up (relatively) standard unix archive files (.a) containing LLVM // bytecode or other files. // //===----------------------------------------------------------------------===// @@ -24,24 +24,24 @@ using namespace llvm; // Option for compatibility with ASIX, not used but must allow it to be present. -static cl::opt -X32Option ("X32_64", cl::Hidden, +static cl::opt +X32Option ("X32_64", cl::Hidden, cl::desc("Ignored option for compatibility with AIX")); // llvm-ar operation code and modifier flags. This must come first. -static cl::opt +static cl::opt Options(cl::Positional, cl::Required, cl::desc("{operation}[modifiers]...")); // llvm-ar remaining positional arguments. -static cl::list -RestOfArgs(cl::Positional, cl::OneOrMore, +static cl::list +RestOfArgs(cl::Positional, cl::OneOrMore, cl::desc("[relpos] [count] [members]...")); // MoreHelp - Provide additional help output explaining the operations and // modifiers of llvm-ar. This object instructs the CommandLine library // to print the text of the constructor when the --help option is given. static cl::extrahelp MoreHelp( - "\nOPERATIONS:\n" + "\nOPERATIONS:\n" " d[NsS] - delete file(s) from the archive\n" " m[abiSs] - move file(s) in the archive\n" " p[kN] - print file(s) found in the archive\n" @@ -85,7 +85,7 @@ enum ArchiveOperation { // Modifiers to follow operation to vary behavior bool AddAfter = false; ///< 'a' modifier bool AddBefore = false; ///< 'b' modifier -bool Create = false; ///< 'c' modifier +bool Create = false; ///< 'c' modifier bool TruncateNames = false; ///< 'f' modifier bool InsertBefore = false; ///< 'i' modifier bool DontSkipBytecode = false; ///< 'k' modifier @@ -135,7 +135,7 @@ void getRelPos() { throw "Expected [relpos] for a, b, or i modifier"; } -// getCount - Extract the [count] argument associated with the N modifier +// getCount - Extract the [count] argument associated with the N modifier // from the command line and check its value. void getCount() { if(RestOfArgs.size() > 0) { @@ -164,11 +164,11 @@ void getArchive() { // This is just for clarity. void getMembers() { if(RestOfArgs.size() > 0) - Members = std::vector(RestOfArgs); + Members = std::vector(RestOfArgs); } // parseCommandLine - Parse the command line options as presented and return the -// operation specified. Process all modifiers and check to make sure that +// operation specified. Process all modifiers and check to make sure that // constraints on modifier/operation pairs have not been violated. ArchiveOperation parseCommandLine() { @@ -188,7 +188,7 @@ ArchiveOperation parseCommandLine() { case 'd': ++NumOperations; Operation = Delete; break; case 'm': ++NumOperations; Operation = Move ; break; case 'p': ++NumOperations; Operation = Print; break; - case 'r': ++NumOperations; Operation = ReplaceOrInsert; break; + case 'r': ++NumOperations; Operation = ReplaceOrInsert; break; case 't': ++NumOperations; Operation = DisplayTable; break; case 'x': ++NumOperations; Operation = Extract; break; case 'c': Create = true; break; @@ -220,7 +220,7 @@ ArchiveOperation parseCommandLine() { NumPositional++; break; case 'N': - getCount(); + getCount(); UseCount = true; break; default: @@ -228,7 +228,7 @@ ArchiveOperation parseCommandLine() { } } - // At this point, the next thing on the command line must be + // At this point, the next thing on the command line must be // the archive name. getArchive(); @@ -274,7 +274,7 @@ std::set recurseDirectories(const sys::Path& path) { if (RecurseDirectories) { std::set content; path.getDirectoryContents(content); - for (std::set::iterator I = content.begin(), E = content.end(); + for (std::set::iterator I = content.begin(), E = content.end(); I != E; ++I) { if (I->isDirectory()) { std::set moreResults = recurseDirectories(*I); @@ -288,7 +288,7 @@ std::set recurseDirectories(const sys::Path& path) { } // buildPaths - Convert the strings in the Members vector to sys::Path objects -// and make sure they are valid and exist exist. This check is only needed for +// and make sure they are valid and exist exist. This check is only needed for // the operations that add/replace files to the archive ('q' and 'r') void buildPaths(bool checkExistence = true) { for (unsigned i = 0; i < Members.size(); i++) { @@ -316,7 +316,7 @@ void buildPaths(bool checkExistence = true) { void printSymbolTable() { std::cout << "\nArchive Symbol Table:\n"; const Archive::SymTabType& symtab = TheArchive->getSymbolTable(); - for (Archive::SymTabType::const_iterator I=symtab.begin(), E=symtab.end(); + for (Archive::SymTabType::const_iterator I=symtab.begin(), E=symtab.end(); I != E; ++I ) { unsigned offset = TheArchive->getFirstFileOffset() + I->second; std::cout << " " << std::setw(9) << offset << "\t" << I->first <<"\n"; @@ -330,16 +330,16 @@ void printSymbolTable() { void doPrint() { buildPaths(false); unsigned countDown = Count; - for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end(); + for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end(); I != E; ++I ) { - if (Paths.empty() || + if (Paths.empty() || (std::find(Paths.begin(), Paths.end(), I->getPath()) != Paths.end())) { if (countDown == 1) { const char* data = reinterpret_cast(I->getData()); // Skip things that don't make sense to print - if (I->isLLVMSymbolTable() || I->isSVR4SymbolTable() || - I->isBSD4SymbolTable() || (!DontSkipBytecode && + if (I->isLLVMSymbolTable() || I->isSVR4SymbolTable() || + I->isBSD4SymbolTable() || (!DontSkipBytecode && (I->isBytecode() || I->isCompressedBytecode()))) continue; @@ -364,7 +364,7 @@ void doPrint() { // putMode - utility function for printing out the file mode when the 't' // operation is in verbose mode. void printMode(unsigned mode) { - if (mode & 004) + if (mode & 004) std::cout << "r"; else std::cout << "-"; @@ -384,9 +384,9 @@ void printMode(unsigned mode) { // modification time are also printed. void doDisplayTable() { buildPaths(false); - for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end(); + for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end(); I != E; ++I ) { - if (Paths.empty() || + if (Paths.empty() || (std::find(Paths.begin(), Paths.end(), I->getPath()) != Paths.end())) { if (Verbose) { // FIXME: Output should be this format: @@ -406,7 +406,7 @@ void doDisplayTable() { std::cout << " " << std::setw(4) << I->getUser(); std::cout << "/" << std::setw(4) << I->getGroup(); std::cout << " " << std::setw(8) << I->getSize(); - std::cout << " " << std::setw(20) << + std::cout << " " << std::setw(20) << I->getModTime().toString().substr(4); std::cout << " " << I->getPath().toString() << "\n"; } else { @@ -423,7 +423,7 @@ void doDisplayTable() { void doExtract() { buildPaths(false); unsigned countDown = Count; - for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end(); + for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end(); I != E; ++I ) { if (Paths.empty() || (std::find(Paths.begin(), Paths.end(), I->getPath()) != Paths.end())) { @@ -468,7 +468,7 @@ void doDelete() { buildPaths(false); if (Paths.empty()) return; unsigned countDown = Count; - for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end(); + for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end(); I != E; ) { if (std::find(Paths.begin(), Paths.end(), I->getPath()) != Paths.end()) { if (countDown == 1) { @@ -504,7 +504,7 @@ void doMove() { // the archive to find the member in question. If we don't find it, its no // crime, we just move to the end. if (AddBefore || InsertBefore || AddAfter) { - for (Archive::iterator I = TheArchive->begin(), E= TheArchive->end(); + for (Archive::iterator I = TheArchive->begin(), E= TheArchive->end(); I != E; ++I ) { if (RelPos == I->getPath().toString()) { if (AddAfter) { @@ -523,12 +523,12 @@ void doMove() { // Scan the archive again, this time looking for the members to move to the // moveto_spot. - for (Archive::iterator I = TheArchive->begin(), E= TheArchive->end(); + for (Archive::iterator I = TheArchive->begin(), E= TheArchive->end(); I != E && !remaining.empty(); ++I ) { - std::set::iterator found = + std::set::iterator found = std::find(remaining.begin(),remaining.end(),I->getPath()); if (found != remaining.end()) { - if (I != moveto_spot) + if (I != moveto_spot) TheArchive->splice(moveto_spot,*TheArchive,I); remaining.erase(found); } @@ -560,7 +560,7 @@ void doQuickAppend() { } // doReplaceOrInsert - Implements the 'r' operation. This function will replace -// any existing files or insert new ones into the archive. +// any existing files or insert new ones into the archive. void doReplaceOrInsert() { // Build the list of files to be added/replaced. @@ -581,7 +581,7 @@ void doReplaceOrInsert() { // to replace. std::set::iterator found = remaining.end(); - for (std::set::iterator RI = remaining.begin(), + for (std::set::iterator RI = remaining.begin(), RE = remaining.end(); RI != RE; ++RI ) { std::string compare(RI->toString()); if (TruncateNames && compare.length() > 15) { @@ -592,7 +592,7 @@ void doReplaceOrInsert() { nm += slashpos + 1; len -= slashpos +1; } - if (len > 15) + if (len > 15) len = 15; compare.assign(nm,len); } @@ -634,7 +634,7 @@ void doReplaceOrInsert() { // If we didn't replace all the members, some will remain and need to be // inserted at the previously computed insert-spot. if (!remaining.empty()) { - for (std::set::iterator PI = remaining.begin(), + for (std::set::iterator PI = remaining.begin(), PE = remaining.end(); PI != PE; ++PI) { TheArchive->addFileBefore(*PI,insert_spot); } diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index 40ee99642d..ad7ad29c96 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -1,10 +1,10 @@ //===--- llvm-as.cpp - The low-level LLVM assembler -----------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility may be invoked in the following manner: @@ -12,7 +12,7 @@ // llvm-as [options] - Read LLVM asm from stdin, write bytecode to stdout // llvm-as [options] x.ll - Read LLVM asm from the x.ll file, write bytecode // to the x.bc file. -// +// //===------------------------------------------------------------------------=== #include "llvm/Module.h" @@ -28,7 +28,7 @@ using namespace llvm; -static cl::opt +static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-")); static cl::opt @@ -41,7 +41,7 @@ Force("f", cl::desc("Overwrite output files")); static cl::opt DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden); -static cl::opt +static cl::opt NoCompress("disable-compression", cl::init(false), cl::desc("Don't compress the generated bytecode")); @@ -72,7 +72,7 @@ int main(int argc, char **argv) { std::cerr << Err; return 1; } - + if (DumpAsm) std::cerr << "Here's the assembly:\n" << *M.get(); if (OutputFilename != "") { // Specified an output filename? @@ -84,7 +84,7 @@ int main(int argc, char **argv) { << "Use -f command line argument to force output\n"; return 1; } - Out = new std::ofstream(OutputFilename.c_str(), std::ios::out | + Out = new std::ofstream(OutputFilename.c_str(), std::ios::out | std::ios::trunc | std::ios::binary); } else { // Specified stdout // FIXME: cout is not binary! @@ -113,19 +113,19 @@ int main(int argc, char **argv) { return 1; } - Out = new std::ofstream(OutputFilename.c_str(), std::ios::out | + Out = new std::ofstream(OutputFilename.c_str(), std::ios::out | std::ios::trunc | std::ios::binary); // Make sure that the Out file gets unlinked from the disk if we get a // SIGINT sys::RemoveFileOnSignal(sys::Path(OutputFilename)); } } - + if (!Out->good()) { std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; return 1; } - + if (Force || !CheckBytecodeOutputToConsole(Out,true)) { WriteBytecodeToFile(M.get(), *Out, !NoCompress); } diff --git a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp index b79b6fe278..39131cfb3c 100644 --- a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp +++ b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp @@ -1,10 +1,10 @@ //===-- llvm-bcanalyzer.cpp - Byte Code Analyzer --------------------------===// -// +// // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the +// This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This tool may be invoked in the following manner: @@ -13,20 +13,20 @@ // // Options: // --help - Output information about command line switches -// --nodetails - Don't print out detailed informaton about individual +// --nodetails - Don't print out detailed informaton about individual // blocks and functions // --dump - Dump low-level bytecode structure in readable format // // This tool provides analytical information about a bytecode file. It is // intended as an aid to developers of bytecode reading and writing software. It -// produces on std::out a summary of the bytecode file that shows various +// produces on std::out a summary of the bytecode file that shows various // statistics about the contents of the file. By default this information is // detailed and contains information about individual bytecode blocks and the -// functions in the module. To avoid this more detailed output, use the +// functions in the module. To avoid this more detailed output, use the // -nodetails option to limit the output to just module level information. -// The tool is also able to print a bytecode file in a straight forward text -// format that shows the containment and relationships of the information in -// the bytecode file (-dump option). +// The tool is also able to print a bytecode file in a straight forward text +// format that shows the containment and relationships of the information in +// the bytecode file (-dump option). //===----------------------------------------------------------------------===// #include "llvm/Analysis/Verifier.h" @@ -48,10 +48,10 @@ static cl::opt NoDetails ("nodetails", cl::desc("Skip detailed output")); static cl::opt Dump ("dump", cl::desc("Dump low level bytecode trace")); static cl::opt Verify ("verify", cl::desc("Progressively verify module")); -int +int main(int argc, char **argv) { try { - cl::ParseCommandLineOptions(argc, argv, + cl::ParseCommandLineOptions(argc, argv, " llvm-bcanalyzer Analysis of ByteCode Dumper\n"); sys::PrintStackTraceOnErrorSignal(); @@ -78,7 +78,7 @@ main(int argc, char **argv) { } catch (std::string& errmsg ) { verificationMsg = errmsg; } - if ( verificationMsg.length() > 0 ) + if ( verificationMsg.length() > 0 ) std::cerr << "Final Verification Message: " << verificationMsg << "\n"; } @@ -88,7 +88,7 @@ main(int argc, char **argv) { std::cerr << argv[0] << ": " << ErrorMessage << "\n"; return 1; } - + if (Out != &std::cout) { ((std::ofstream*)Out)->close(); diff --git a/tools/llvm-db/CLICommand.h b/tools/llvm-db/CLICommand.h index ad8b8403bd..0b60e05212 100644 --- a/tools/llvm-db/CLICommand.h +++ b/tools/llvm-db/CLICommand.h @@ -1,10 +1,10 @@ //===- CLICommand.h - Classes used to represent commands --------*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines a small class hierarchy used to represent the various types @@ -74,7 +74,7 @@ namespace llvm { /// removeOptionName - Eliminate one of the names for this option. /// void removeOptionName(const std::string &Name) { - unsigned i = 0; + unsigned i = 0; for (; OptionNames[i] != Name; ++i) assert(i+1 < OptionNames.size() && "Didn't find option name!"); OptionNames.erase(OptionNames.begin()+i); @@ -101,7 +101,7 @@ namespace llvm { BuiltinCLICommand(const std::string &ShortHelp, const std::string &LongHelp, void (CLIDebugger::*impl)(std::string&)) : CLICommand(ShortHelp, LongHelp), Impl(impl) {} - + void runCommand(CLIDebugger &D, std::string &Arguments) { (D.*Impl)(Arguments); } diff --git a/tools/llvm-db/CLIDebugger.cpp b/tools/llvm-db/CLIDebugger.cpp index 4e36bbf6de..e7ab75c387 100644 --- a/tools/llvm-db/CLIDebugger.cpp +++ b/tools/llvm-db/CLIDebugger.cpp @@ -1,12 +1,12 @@ //===-- CLIDebugger.cpp - Command Line Interface to the Debugger ----------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// -// +// // This file contains the main implementation of the Command Line Interface to // the debugger. // @@ -77,7 +77,7 @@ CLIDebugger::CLIDebugger() addCommand("next", C = new BuiltinCLICommand( "Step program until it reaches a new source line, stepping over calls", "", &CLIDebugger::nextCommand)); - addCommand("n", C); + addCommand("n", C); addCommand("finish", new BuiltinCLICommand( "Execute until the selected stack frame returns", @@ -91,8 +91,8 @@ CLIDebugger::CLIDebugger() "Print backtrace of all stack frames, or innermost COUNT frames", "FIXME: describe. Takes 'n', '-n' or 'full'\n", &CLIDebugger::backtraceCommand)); - addCommand("bt", C); - + addCommand("bt", C); + addCommand("up", new BuiltinCLICommand( "Select and print stack frame that called this one", "An argument says how many frames up to go.\n", @@ -108,7 +108,7 @@ CLIDebugger::CLIDebugger() "With no argument, print the selected stack frame. (See also 'info frame').\n" "An argument specifies the frame to select.\n", &CLIDebugger::frameCommand)); - addCommand("f", C); + addCommand("f", C); //===--------------------------------------------------------------------===// // Breakpoint related commands @@ -117,7 +117,7 @@ CLIDebugger::CLIDebugger() "Set breakpoint at specified line or function", "FIXME: describe.\n", &CLIDebugger::breakCommand)); - addCommand("b", C); + addCommand("b", C); //===--------------------------------------------------------------------===// @@ -187,7 +187,7 @@ CLICommand *CLIDebugger::getCommand(const std::string &Command) { // Look up the command in the table. std::map::iterator CI = CommandTable.lower_bound(Command); - + if (Command == "") { throw "Null command should not get here!"; } else if (CI == CommandTable.end() || @@ -207,7 +207,7 @@ CLICommand *CLIDebugger::getCommand(const std::string &Command) { // If the next command is a valid completion of this one, we are // ambiguous. if (++CI2 != CommandTable.end() && isValidPrefix(Command, CI2->first)) { - std::string ErrorMsg = + std::string ErrorMsg = "Ambiguous command '" + Command + "'. Options: " + CI->first; for (++CI; CI != CommandTable.end() && isValidPrefix(Command, CI->first); ++CI) @@ -242,7 +242,7 @@ int CLIDebugger::run() { try { CLICommand *CurCommand; - + if (Command == "") { CurCommand = LastCommand; Arguments = LastArgs; @@ -257,7 +257,7 @@ int CLIDebugger::run() { // Finally, execute the command. if (CurCommand) - CurCommand->runCommand(*this, Arguments); + CurCommand->runCommand(*this, Arguments); } catch (int RetVal) { // The quit command exits the command loop by throwing an integer return @@ -273,7 +273,7 @@ int CLIDebugger::run() { std::cout << "ERROR: Debugger caught unexpected exception!\n"; // Attempt to continue. } - + // Write the prompt to get the next bit of user input std::cout << Prompt; } @@ -302,7 +302,7 @@ bool CLIDebugger::askYesNo(const std::string &Message) const { std::cout << "Please answer y or n.\n" << Message << " (y or n) " << std::flush; } - + // Ran out of input? return false; } diff --git a/tools/llvm-db/CLIDebugger.h b/tools/llvm-db/CLIDebugger.h index e2dbaaff7c..0f16c4fff8 100644 --- a/tools/llvm-db/CLIDebugger.h +++ b/tools/llvm-db/CLIDebugger.h @@ -1,10 +1,10 @@ //===- CLIDebugger.h - LLVM Command Line Interface Debugger -----*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines the CLIDebugger class, which implements a command line @@ -62,11 +62,11 @@ namespace llvm { // std::string Prompt; // set prompt, show prompt unsigned ListSize; // set listsize, show listsize - + //===------------------------------------------------------------------===// // Data to support user interaction // - + /// CurrentFile - The current source file we are inspecting, or null if /// none. const SourceFile *CurrentFile; diff --git a/tools/llvm-db/Commands.cpp b/tools/llvm-db/Commands.cpp index 37f8a78209..1716e1ba49 100644 --- a/tools/llvm-db/Commands.cpp +++ b/tools/llvm-db/Commands.cpp @@ -1,12 +1,12 @@ //===-- Commands.cpp - Implement various commands for the CLI -------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// -// +// // This file implements many builtin user commands. // //===----------------------------------------------------------------------===// @@ -91,7 +91,7 @@ bool CLIDebugger::printSourceLine(unsigned LineNo) { std::cout << " ->"; } - std::cout << "\t" << std::string(LineStart, LineEnd) << "\n"; + std::cout << "\t" << std::string(LineStart, LineEnd) << "\n"; return false; } @@ -115,9 +115,9 @@ void CLIDebugger::printProgramLocation(bool PrintLocation) { std::cout << getProgramInfo().getFunction(FuncDesc).getSymbolicName(); else std::cout << ""; - + CurrentFile = &FileDesc->getSourceText(); - + std::cout << " at " << CurrentFile->getFilename() << ":" << LineNo; if (ColNo) std::cout << ":" << ColNo; std::cout << "\n"; @@ -167,7 +167,7 @@ static unsigned getUnsignedIntegerOption(const char *Msg, std::string &Val, std::string Tok = getToken(Val); if (Tok.empty() || (isOnlyOption && !getToken(Val).empty())) throw std::string(Msg) + " expects an unsigned integer argument."; - + char *EndPtr; unsigned Result = strtoul(Tok.c_str(), &EndPtr, 0); if (EndPtr != Tok.c_str()+Tok.size()) @@ -179,7 +179,7 @@ static unsigned getUnsignedIntegerOption(const char *Msg, std::string &Val, /// getOptionalUnsignedIntegerOption - This method is just like /// getUnsignedIntegerOption, but if the argument value is not specified, a /// default is returned instead of causing an error. -static unsigned +static unsigned getOptionalUnsignedIntegerOption(const char *Msg, unsigned Default, std::string &Val, bool isOnlyOption = true) { // Check to see if the value was specified... @@ -201,13 +201,13 @@ void CLIDebugger::parseProgramOptions(std::string &Options) { // FIXME: tokenizing by whitespace is clearly incorrect. Instead we should // honor quotes and other things that a shell would. Also in the future we // should support redirection of standard IO. - + std::vector Arguments; for (std::string A = getToken(Options); !A.empty(); A = getToken(Options)) Arguments.push_back(A); Dbg.setProgramArguments(Arguments.begin(), Arguments.end()); } - + //===----------------------------------------------------------------------===// // Program startup and shutdown options @@ -477,7 +477,7 @@ void CLIDebugger::breakCommand(std::string &Options) { // Figure out where the user wants a breakpoint. const SourceFile *File; unsigned LineNo; - + // Check to see if the user specified a line specifier. std::string Option = getToken(Options); // strip whitespace if (!Option.empty()) { @@ -489,13 +489,13 @@ void CLIDebugger::breakCommand(std::string &Options) { // Build a line specifier for the current stack frame. throw "FIXME: breaking at the current location is not implemented yet!"; } - + if (!File) File = CurrentFile; if (File == 0) throw "Unknown file to place breakpoint!"; std::cerr << "Break: " << File->getFilename() << ":" << LineNo << "\n"; - + throw "breakpoints not implemented yet!"; } @@ -542,7 +542,7 @@ void CLIDebugger::infoCommand(std::string &Options) { << SF.getLanguage().getSourceLanguageName() << "\n"; } else if (What == "sources") { - const std::map &SourceFiles = + const std::map &SourceFiles = getProgramInfo().getSourceFiles(); std::cout << "Source files for the program:\n"; for (std::map::const_iterator I = @@ -607,7 +607,7 @@ void CLIDebugger::parseLineSpec(std::string &LineSpec, std::string Name = getToken(FirstPart); if (!getToken(FirstPart).empty()) throw "Extra junk in line specifier after '" + Name + "'."; - SourceFunctionInfo *SFI = + SourceFunctionInfo *SFI = getCurrentLanguage().lookupFunction(Name, getProgramInfo(), TheRuntimeInfo); if (SFI == 0) @@ -651,7 +651,7 @@ void CLIDebugger::listCommand(std::string &Options) { // Handle "list foo," correctly, by returning " " as the second token Options += " "; - + std::string FirstLineSpec = getToken(Options, ","); std::string SecondLineSpec = getToken(Options, ","); if (!getToken(Options, ",").empty()) @@ -689,7 +689,7 @@ void CLIDebugger::listCommand(std::string &Options) { } } else { - // Parse two line specifiers... + // Parse two line specifiers... const SourceFile *StartFile, *EndFile; unsigned StartLineNo, EndLineNo; parseLineSpec(FirstLineSpec, StartFile, StartLineNo); diff --git a/tools/llvm-db/llvm-db.cpp b/tools/llvm-db/llvm-db.cpp index f7913dfe47..140b8e40b6 100644 --- a/tools/llvm-db/llvm-db.cpp +++ b/tools/llvm-db/llvm-db.cpp @@ -1,10 +1,10 @@ //===- llvm-db.cpp - LLVM Debugger ----------------------------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility implements a simple text-mode front-end to the LLVM debugger @@ -35,7 +35,7 @@ namespace { cl::desc("Add directory to the search for source files")); cl::alias SDA("d", cl::desc("Alias for --directory"), cl::aliasopt(SourceDirectories)); - + cl::opt WorkingDirectory("cd", cl::desc("Use directory as current working directory"), cl::value_desc("directory")); @@ -73,7 +73,7 @@ int main(int argc, char **argv, char * const *envp) { Dbg.setWorkingDirectory(WorkingDirectory); for (unsigned i = 0, e = SourceDirectories.size(); i != e; ++i) D.addSourceDirectory(SourceDirectories[i]); - + if (!InputArgs.empty()) { try { D.fileCommand(InputArgs[0]); diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index 0f189910f3..df0737ad6c 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/tools/llvm-dis/llvm-dis.cpp @@ -1,10 +1,10 @@ //===-- llvm-dis.cpp - The low-level LLVM disassembler --------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility may be invoked in the following manner: @@ -31,7 +31,7 @@ static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-")); static cl::opt -OutputFilename("o", cl::desc("Override output filename"), +OutputFilename("o", cl::desc("Override output filename"), cl::value_desc("filename")); static cl::opt @@ -54,7 +54,7 @@ int main(int argc, char **argv) { std::cerr << "bytecode didn't read correctly.\n"; return 1; } - + if (OutputFilename != "") { // Specified an output filename? if (OutputFilename != "-") { // Not stdout? if (!Force && std::ifstream(OutputFilename.c_str())) { diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index 3f24e387e6..78d0426be1 100644 --- a/tools/llvm-extract/llvm-extract.cpp +++ b/tools/llvm-extract/llvm-extract.cpp @@ -1,10 +1,10 @@ //===- extract.cpp - LLVM function extraction utility ---------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility changes the input module to only contain a single function, @@ -28,9 +28,9 @@ using namespace llvm; static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-"), cl::value_desc("filename")); - + static cl::opt -OutputFilename("o", cl::desc("Specify output filename"), +OutputFilename("o", cl::desc("Specify output filename"), cl::value_desc("filename"), cl::init("-")); static cl::opt @@ -88,7 +88,7 @@ int main(int argc, char **argv) { Out = new std::ofstream(OutputFilename.c_str(), io_mode); } else { // Specified stdout // FIXME: cout is not binary! - Out = &std::cout; + Out = &std::cout; } Passes.add(new WriteBytecodePass(Out)); // Write bytecode to file... diff --git a/tools/llvm-ld/Optimize.cpp b/tools/llvm-ld/Optimize.cpp index 5dc9424be9..1961a95ef5 100644 --- a/tools/llvm-ld/Optimize.cpp +++ b/tools/llvm-ld/Optimize.cpp @@ -1,10 +1,10 @@ //===- Optimize.cpp - Optimize a complete program -------------------------===// -// +// // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the +// This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file implements all optimization of the linked module for llvm-ld. @@ -52,7 +52,7 @@ static cl::opt OptLevel( ) ); -static cl::opt DisableInline("disable-inlining", +static cl::opt DisableInline("disable-inlining", cl::desc("Do not run the inliner pass")); static cl::opt @@ -62,13 +62,13 @@ DisableOptimizations("disable-opt", static cl::opt DisableInternalize("disable-internalize", cl::desc("Do not mark all symbols as internal")); -static cl::opt Verify("verify", +static cl::opt Verify("verify", cl::desc("Verify intermediate results of all passes")); -static cl::opt Strip("s", +static cl::opt Strip("s", cl::desc("Strip symbol info from executable")); -static cl::alias ExportDynamic("export-dynamic", +static cl::alias ExportDynamic("export-dynamic", cl::aliasopt(DisableInternalize), cl::desc("Alias for -disable-internalize")); @@ -81,16 +81,16 @@ static cl::list LoadableModules("load", static inline void addPass(PassManager &PM, Pass *P) { // Add the pass to the pass manager... PM.add(P); - + // If we are verifying all of the intermediate steps, add the verifier... - if (Verify) + if (Verify) PM.add(createVerifierPass()); } namespace llvm { -/// Optimize - Perform link time optimizations. This will run the scalar -/// optimizations, any loaded plugin-optimization modules, and then the +/// Optimize - Perform link time optimizations. This will run the scalar +/// optimizations, any loaded plugin-optimization modules, and then the /// inter-procedural optimizations if applicable. void Optimize(Module* M) { @@ -98,7 +98,7 @@ void Optimize(Module* M) { PassManager Passes; // If we're verifying, start off with a verification pass. - if (Verify) + if (Verify) Passes.add(createVerifierPass()); // Add an appropriate TargetData instance for this module... @@ -171,14 +171,14 @@ void Optimize(Module* M) { } std::vector plugins = LoadableModules; - for (std::vector::iterator I = plugins.begin(), + for (std::vector::iterator I = plugins.begin(), E = plugins.end(); I != E; ++I) { sys::DynamicLibrary dll(I->c_str()); typedef void (*OptimizeFunc)(PassManager&,int); OptimizeFunc OF = OptimizeFunc( dll.GetAddressOfSymbol("RunOptimizations")); if (OF == 0) { - throw std::string("Optimization Module '") + *I + + throw std::string("Optimization Module '") + *I + "' is missing the RunOptimizations symbol"; } (*OF)(Passes,OptLevel); diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp index 944f23dcdc..ccd643e173 100644 --- a/tools/llvm-ld/llvm-ld.cpp +++ b/tools/llvm-ld/llvm-ld.cpp @@ -1,10 +1,10 @@ //===- llvm-ld.cpp - LLVM 'ld' compatible linker --------------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility is intended to be compatible with GCC, and follows standard @@ -44,21 +44,21 @@ static cl::list InputFilenames(cl::Positional, cl::OneOrMore, cl::desc("")); static cl::opt OutputFilename("o", cl::init("a.out"), - cl::desc("Override output filename"), + cl::desc("Override output filename"), cl::value_desc("filename")); -static cl::opt Verbose("v", +static cl::opt Verbose("v", cl::desc("Print information about actions taken")); - + static cl::list LibPaths("L", cl::Prefix, - cl::desc("Specify a library search path"), + cl::desc("Specify a library search path"), cl::value_desc("directory")); static cl::list Libraries("l", cl::Prefix, - cl::desc("Specify libraries to link to"), + cl::desc("Specify libraries to link to"), cl::value_desc("library prefix")); -static cl::opt LinkAsLibrary("link-as-library", +static cl::opt LinkAsLibrary("link-as-library", cl::desc("Link the .bc files together as a library, not an executable")); static cl::alias Relink("r", cl::aliasopt(LinkAsLibrary), @@ -75,18 +75,18 @@ static cl::optNativeCBE("native-cbe", static cl::optDisableCompression("disable-compression",cl::init(false), cl::desc("Disable writing of compressed bytecode files")); - + // Compatibility options that are ignored but supported by LD -static cl::opt CO3("soname", cl::Hidden, +static cl::opt CO3("soname", cl::Hidden, cl::desc("Compatibility option: ignored")); -static cl::opt CO4("version-script", cl::Hidden, +static cl::opt CO4("version-script", cl::Hidden, cl::desc("Compatibility option: ignored")); -static cl::opt CO5("eh-frame-hdr", cl::Hidden, +static cl::opt CO5("eh-frame-hdr", cl::Hidden, cl::desc("Compatibility option: ignored")); -static cl::opt CO6("h", cl::Hidden, +static cl::opt CO6("h", cl::Hidden, cl::desc("Compatibility option: ignored")); /// This is just for convenience so it doesn't have to be passed around @@ -342,12 +342,12 @@ static void EmitShellScript(char **argv) { LibPaths.push_back("/usr/X11R6/lib"); // We don't need to link in libc! In fact, /usr/lib/libc.so may not be a // shared object at all! See RH 8: plain text. - std::vector::iterator libc = + std::vector::iterator libc = std::find(Libraries.begin(), Libraries.end(), "c"); if (libc != Libraries.end()) Libraries.erase(libc); // List all the shared object (native) libraries this executable will need // on the command line, so that we don't have to do this manually! - for (std::vector::iterator i = Libraries.begin(), + for (std::vector::iterator i = Libraries.begin(), e = Libraries.end(); i != e; ++i) { sys::Path FullLibraryPath = sys::Path::FindLibrary(*i); if (!FullLibraryPath.isEmpty() && FullLibraryPath.isDynamicLibrary()) @@ -365,7 +365,7 @@ static void BuildLinkItems( const cl::list& Files, const cl::list& Libraries) { - // Build the list of linkage items for LinkItems. + // Build the list of linkage items for LinkItems. cl::list::const_iterator fileIt = Files.begin(); cl::list::const_iterator libIt = Libraries.begin(); @@ -401,7 +401,7 @@ int main(int argc, char **argv, char **envp) { // Initial global variable above for convenience printing of program name. progname = sys::Path(argv[0]).getBasename(); Linker TheLinker(progname, Verbose); - + // Set up the library paths for the Linker TheLinker.addPaths(LibPaths); TheLinker.addSystemPaths(); @@ -423,7 +423,7 @@ int main(int argc, char **argv, char **envp) { // The libraries aren't linked in but are noted as "dependent" in the // module. - for (cl::list::const_iterator I = Libraries.begin(), + for (cl::list::const_iterator I = Libraries.begin(), E = Libraries.end(); I != E ; ++I) { TheLinker.getModule()->addLibrary(*I); } @@ -476,7 +476,7 @@ int main(int argc, char **argv, char **envp) { if (Verbose) std::cout << "Generating Assembly Code\n"; GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, llc); if (Verbose) std::cout << "Generating Native Code\n"; - GenerateNative(OutputFilename, AssemblyFile.toString(), Libraries, + GenerateNative(OutputFilename, AssemblyFile.toString(), Libraries, gcc, envp); // Remove the assembly language file. @@ -510,7 +510,7 @@ int main(int argc, char **argv, char **envp) { } else { EmitShellScript(argv); } - + // Make the script executable... sys::Path(OutputFilename).makeExecutable(); diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index ed63f1013f..9db18909d5 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -1,10 +1,10 @@ //===- llvm-link.cpp - Low-level LLVM linker ------------------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility may be invoked in the following manner: @@ -67,7 +67,7 @@ static inline std::auto_ptr LoadFile(const std::string &FN) { std::cerr << "\n"; } } else { - std::cerr << "Bytecode file: '" << Filename.c_str() + std::cerr << "Bytecode file: '" << Filename.c_str() << "' does not exist.\n"; } diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index e9b06557b3..f6b75928d5 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -1,16 +1,16 @@ //===-- llvm-nm.cpp - Symbol table dumping utility for llvm ---------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This program is a utility that works like traditional Unix "nm", // that is, it prints out the names of symbols in a bytecode file, // along with some information about each symbol. -// +// // This "nm" does not print symbols' addresses. It supports many of // the features of GNU "nm", including its different output formats. // @@ -35,12 +35,12 @@ namespace { cl::desc("Specify output format"), cl::values(clEnumVal(bsd, "BSD format"), clEnumVal(sysv, "System V format"), - clEnumVal(posix, "POSIX.2 format"), + clEnumVal(posix, "POSIX.2 format"), clEnumValEnd), cl::init(bsd)); cl::alias OutputFormat2("f", cl::desc("Alias for --format"), cl::aliasopt(OutputFormat)); - cl::list + cl::list InputFilenames(cl::Positional, cl::desc(""), cl::ZeroOrMore); diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index d6e8bb1b12..5cf65b445c 100644 --- a/tools/llvm-prof/llvm-prof.cpp +++ b/tools/llvm-prof/llvm-prof.cpp @@ -1,10 +1,10 @@ //===- llvm-prof.cpp - Read in and process llvmprof.out data files --------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This tools is meant for use with the various LLVM profiling instrumentation @@ -28,11 +28,11 @@ using namespace llvm; namespace { - cl::opt + cl::opt BytecodeFile(cl::Positional, cl::desc(""), cl::Required); - cl::opt + cl::opt ProfileDataFile(cl::Positional, cl::desc(""), cl::Optional, cl::init("llvmprof.out")); @@ -87,7 +87,7 @@ namespace { // Figure out how many times each successor executed. std::vector > SuccCounts; const TerminatorInst *TI = BB->getTerminator(); - + std::map::iterator I = EdgeFreqs.lower_bound(std::make_pair(const_cast(BB), 0U)); for (; I != EdgeFreqs.end() && I->first.first == BB; ++I) @@ -142,18 +142,18 @@ int main(int argc, char **argv) { unsigned long long TotalExecutions = 0; for (unsigned i = 0, e = FunctionCounts.size(); i != e; ++i) TotalExecutions += FunctionCounts[i].second; - + std::cout << "===" << std::string(73, '-') << "===\n" << "LLVM profiling output for execution"; if (PI.getNumExecutions() != 1) std::cout << "s"; std::cout << ":\n"; - + for (unsigned i = 0, e = PI.getNumExecutions(); i != e; ++i) { std::cout << " "; if (e != 1) std::cout << i+1 << ". "; std::cout << PI.getExecution(i) << "\n"; } - + std::cout << "\n===" << std::string(73, '-') << "===\n"; std::cout << "Function execution frequencies:\n\n"; @@ -185,7 +185,7 @@ int main(int argc, char **argv) { // Sort by the frequency, backwards. std::sort(Counts.begin(), Counts.end(), PairSecondSortReverse()); - + std::cout << "\n===" << std::string(73, '-') << "===\n"; std::cout << "Top 20 most frequently executed basic blocks:\n\n"; @@ -205,7 +205,7 @@ int main(int argc, char **argv) { BlockFreqs.insert(Counts.begin(), Counts.end()); } - + if (PI.hasAccurateEdgeCounts()) { std::vector > Counts; PI.getEdgeCounts(Counts); @@ -215,7 +215,7 @@ int main(int argc, char **argv) { if (PrintAnnotatedLLVM || PrintAllCode) { std::cout << "\n===" << std::string(73, '-') << "===\n"; std::cout << "Annotated LLVM code for the module:\n\n"; - + ProfileAnnotator PA(FuncFreqs, BlockFreqs, EdgeFreqs); if (FunctionsToPrint.empty() || PrintAllCode) diff --git a/tools/llvm-ranlib/llvm-ranlib.cpp b/tools/llvm-ranlib/llvm-ranlib.cpp index 70d5cf8abf..e2fbf7d55d 100644 --- a/tools/llvm-ranlib/llvm-ranlib.cpp +++ b/tools/llvm-ranlib/llvm-ranlib.cpp @@ -1,10 +1,10 @@ //===-- llvm-ranlib.cpp - LLVM archive index generator --------------------===// -// +// // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the +// This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // Adds or updates an index (symbol table) for an LLVM archive file. @@ -21,7 +21,7 @@ using namespace llvm; // llvm-ar operation code and modifier flags -static cl::opt +static cl::opt ArchiveName(cl::Positional, cl::Optional, cl::desc("")); static cl::opt @@ -32,7 +32,7 @@ Verbose("verbose",cl::Optional,cl::init(false), void printSymbolTable(Archive* TheArchive) { std::cout << "\nArchive Symbol Table:\n"; const Archive::SymTabType& symtab = TheArchive->getSymbolTable(); - for (Archive::SymTabType::const_iterator I=symtab.begin(), E=symtab.end(); + for (Archive::SymTabType::const_iterator I=symtab.begin(), E=symtab.end(); I != E; ++I ) { unsigned offset = TheArchive->getFirstFileOffset() + I->second; std::cout << " " << std::setw(9) << offset << "\t" << I->first <<"\n"; @@ -67,7 +67,7 @@ int main(int argc, char **argv) { throw std::string("Archive file does not exist"); std::string err_msg; - std::auto_ptr + std::auto_ptr AutoArchive(Archive::OpenAndLoad(ArchivePath,&err_msg)); Archive* TheArchive = AutoArchive.get(); if (!TheArchive) diff --git a/tools/llvmc/CompilerDriver.cpp b/tools/llvmc/CompilerDriver.cpp index f3d09e4f92..6f2ec2ec10 100644 --- a/tools/llvmc/CompilerDriver.cpp +++ b/tools/llvmc/CompilerDriver.cpp @@ -1,11 +1,11 @@ //===- CompilerDriver.cpp - The LLVM Compiler Driver ------------*- C++ -*-===// // -// +// // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the +// This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file implements the bulk of the LLVM Compiler Driver (llvmc). @@ -48,7 +48,7 @@ void DumpAction(CompilerDriver::Action* action) { } void DumpConfigData(CompilerDriver::ConfigData* cd, const std::string& type ){ - std::cerr << "Configuration Data For '" << cd->langName << "' (" << type + std::cerr << "Configuration Data For '" << cd->langName << "' (" << type << ")\n"; std::cerr << "PreProcessor: "; DumpAction(&cd->PreProcessor); @@ -64,7 +64,7 @@ void DumpConfigData(CompilerDriver::ConfigData* cd, const std::string& type ){ /// This specifies the passes to run for OPT_FAST_COMPILE (-O1) /// which should reduce the volume of code and make compilation -/// faster. This is also safe on any llvm module. +/// faster. This is also safe on any llvm module. static const char* DefaultFastCompileOptimizations[] = { "-simplifycfg", "-mem2reg", "-instcombine" }; @@ -76,7 +76,7 @@ public: CompilerDriverImpl(ConfigDataProvider& confDatProv ) : cdp(&confDatProv) , finalPhase(LINKING) - , optLevel(OPT_FAST_COMPILE) + , optLevel(OPT_FAST_COMPILE) , Flags(0) , machine() , LibraryPaths() @@ -108,16 +108,16 @@ public: /// @name Methods /// @{ public: - virtual void setFinalPhase( Phases phase ) { - finalPhase = phase; + virtual void setFinalPhase( Phases phase ) { + finalPhase = phase; } - virtual void setOptimization( OptimizationLevels level ) { - optLevel = level; + virtual void setOptimization( OptimizationLevels level ) { + optLevel = level; } virtual void setDriverFlags( unsigned flags ) { - Flags = flags & DRIVER_FLAGS_MASK; + Flags = flags & DRIVER_FLAGS_MASK; } virtual void setOutputMachine( const std::string& machineName ) { @@ -194,7 +194,7 @@ private: } } - sys::Path MakeTempFile(const std::string& basename, + sys::Path MakeTempFile(const std::string& basename, const std::string& suffix ) { sys::Path result(TempDir); if (!result.appendFile(basename)) @@ -204,8 +204,8 @@ private: return result; } - Action* GetAction(ConfigData* cd, - const sys::Path& input, + Action* GetAction(ConfigData* cd, + const sys::Path& input, const sys::Path& output, Phases phase) { @@ -243,7 +243,7 @@ private: // Get specific options for each kind of action type StringVector& addargs = AdditionalArgs[phase]; // Add specific options for each kind of action type - action->args.insert(action->args.end(), addargs.begin(), + action->args.insert(action->args.end(), addargs.begin(), addargs.end()); } } else @@ -263,7 +263,7 @@ private: case 'f': if (*PI == "%fOpts%") { if (!fOptions.empty()) - action->args.insert(action->args.end(), fOptions.begin(), + action->args.insert(action->args.end(), fOptions.begin(), fOptions.end()); } else found = false; @@ -297,13 +297,13 @@ private: action->args.push_back(output.toString()); } else if (*PI == "%opt%") { if (!isSet(EMIT_RAW_FLAG)) { - if (cd->opts.size() > static_cast(optLevel) && + if (cd->opts.size() > static_cast(optLevel) && !cd->opts[optLevel].empty()) - action->args.insert(action->args.end(), + action->args.insert(action->args.end(), cd->opts[optLevel].begin(), cd->opts[optLevel].end()); else - throw std::string("Optimization options for level ") + + throw std::string("Optimization options for level ") + utostr(unsigned(optLevel)) + " were not specified"; } } else @@ -335,7 +335,7 @@ private: case 'M': if (*PI == "%Mopts%") { if (!MOptions.empty()) - action->args.insert(action->args.end(), MOptions.begin(), + action->args.insert(action->args.end(), MOptions.begin(), MOptions.end()); } else found = false; @@ -355,7 +355,7 @@ private: } if (!found) { // Did it even look like a substitution? - if (PI->length()>1 && (*PI)[0] == '%' && + if (PI->length()>1 && (*PI)[0] == '%' && (*PI)[PI->length()-1] == '%') { throw std::string("Invalid substitution token: '") + *PI + "' for command '" + pat->program.toString() + "'"; @@ -392,7 +392,7 @@ private: "' is not executable."); // Invoke the program - const char** Args = (const char**) + const char** Args = (const char**) alloca(sizeof(const char*)*(action->args.size()+2)); Args[0] = action->program.toString().c_str(); for (unsigned i = 1; i != action->args.size(); ++i) @@ -421,7 +421,7 @@ private: fullpath.setFile(link_item); if (fullpath.readable()) return fullpath; - for (PathVector::iterator PI = LibraryPaths.begin(), + for (PathVector::iterator PI = LibraryPaths.begin(), PE = LibraryPaths.end(); PI != PE; ++PI) { fullpath.setDirectory(PI->toString()); fullpath.appendFile(link_item); @@ -431,11 +431,11 @@ private: fullpath.appendSuffix("a"); } else { fullpath.appendSuffix("bc"); - if (fullpath.readable()) + if (fullpath.readable()) return fullpath; fullpath.elideSuffix(); fullpath.appendSuffix("o"); - if (fullpath.readable()) + if (fullpath.readable()) return fullpath; fullpath = *PI; fullpath.appendFile(std::string("lib") + link_item); @@ -472,7 +472,7 @@ private: // If we didn't find the file in any of the library search paths // we have to bail. No where else to look. if (fullpath.isEmpty()) { - err = + err = std::string("Can't find linkage item '") + link_item.toString() + "'"; return false; } @@ -494,7 +494,7 @@ private: while ( LI != LE ) { if (!ProcessLinkageItem(sys::Path(*LI),set,err)) { if (err.empty()) { - err = std::string("Library '") + *LI + + err = std::string("Library '") + *LI + "' is not valid for linking but is required by file '" + fullpath.toString() + "'"; } else { @@ -506,7 +506,7 @@ private: } } else if (err.empty()) { err = std::string( - "The dependent libraries could not be extracted from '") + + "The dependent libraries could not be extracted from '") + fullpath.toString(); return false; } @@ -534,7 +534,7 @@ public: std::cerr << "OutputMachine = " << machine << "\n"; InputList::const_iterator I = InpList.begin(); while ( I != InpList.end() ) { - std::cerr << "Input: " << I->first << "(" << I->second + std::cerr << "Input: " << I->first << "(" << I->second << ")\n"; ++I; } @@ -571,11 +571,11 @@ public: // Get the suffix of the file name const std::string& ftype = I->second; - // If its a library, bytecode file, or object file, save - // it for linking below and short circuit the + // If its a library, bytecode file, or object file, save + // it for linking below and short circuit the // pre-processing/translation/assembly phases if (ftype.empty() || ftype == "o" || ftype == "bc" || ftype=="a") { - // We shouldn't get any of these types of files unless we're + // We shouldn't get any of these types of files unless we're // later going to link. Enforce this limit now. if (finalPhase != LINKING) { throw std::string( @@ -593,8 +593,8 @@ public: // for this kind of file. ConfigData* cd = cdp->ProvideConfigData(I->second); if (cd == 0) - throw std::string("Files of type '") + I->second + - "' are not recognized."; + throw std::string("Files of type '") + I->second + + "' are not recognized."; if (isSet(DEBUG_FLAG)) DumpConfigData(cd,I->second); @@ -631,11 +631,11 @@ public: } else if (finalPhase == PREPROCESSING) { throw cd->langName + " does not support pre-processing"; } else if (action.isSet(REQUIRED_FLAG)) { - throw std::string("Don't know how to pre-process ") + + throw std::string("Don't know how to pre-process ") + cd->langName + " files"; } - // Short-circuit remaining actions if all they want is + // Short-circuit remaining actions if all they want is // pre-processing if (finalPhase == PREPROCESSING) { continue; }; @@ -653,7 +653,7 @@ public: actions.push_back(GetAction(cd,InFile,Output,TRANSLATION)); } } else { - sys::Path TempFile(MakeTempFile(I->first.getBasename(),"trans")); + sys::Path TempFile(MakeTempFile(I->first.getBasename(),"trans")); actions.push_back(GetAction(cd,InFile,TempFile,TRANSLATION)); InFile = TempFile; } @@ -674,7 +674,7 @@ public: } else if (finalPhase == TRANSLATION) { throw cd->langName + " does not support translation"; } else if (action.isSet(REQUIRED_FLAG)) { - throw std::string("Don't know how to translate ") + + throw std::string("Don't know how to translate ") + cd->langName + " files"; } @@ -717,7 +717,7 @@ public: } else if (finalPhase == OPTIMIZATION) { throw cd->langName + " does not support optimization"; } else if (action.isSet(REQUIRED_FLAG)) { - throw std::string("Don't know how to optimize ") + + throw std::string("Don't know how to optimize ") + cd->langName + " files"; } } @@ -762,7 +762,7 @@ public: // Put the action on the list actions.push_back(action); - // Short circuit the rest of the loop, we don't want to link + // Short circuit the rest of the loop, we don't want to link continue; } @@ -816,7 +816,7 @@ public: // Add in all the linkage items we generated. This includes the // output from the translation/optimization phases as well as any // -l arguments specified. - for (PathVector::const_iterator I=LinkageItems.begin(), + for (PathVector::const_iterator I=LinkageItems.begin(), E=LinkageItems.end(); I != E; ++I ) link->args.push_back(I->toString()); diff --git a/tools/llvmc/CompilerDriver.h b/tools/llvmc/CompilerDriver.h index bcd3a016d3..6f9d0f497a 100644 --- a/tools/llvmc/CompilerDriver.h +++ b/tools/llvmc/CompilerDriver.h @@ -1,10 +1,10 @@ //===- CompilerDriver.h - Compiler Driver -----------------------*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the +// This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file declares the CompilerDriver class which implements the bulk of the @@ -23,7 +23,7 @@ namespace llvm { /// The driver's purpose is to make it easier for compiler writers and users /// of LLVM to utilize the compiler toolkits and LLVM toolset by learning only /// the interface of one program (llvmc). - /// + /// /// @see llvmc.cpp /// @brief The interface to the LLVM Compiler Driver. class CompilerDriver { @@ -43,7 +43,7 @@ namespace llvm { enum Phases { PREPROCESSING, ///< Source language combining, filtering, substitution TRANSLATION, ///< Translate source -> LLVM bytecode/assembly - OPTIMIZATION, ///< Optimize translation result + OPTIMIZATION, ///< Optimize translation result ASSEMBLY, ///< Convert program to executable LINKING, ///< Link bytecode and native code NUM_PHASES ///< Always last! @@ -92,7 +92,7 @@ namespace llvm { struct ConfigData { ConfigData(); std::string version; ///< The version number. - std::string langName; ///< The name of the source language + std::string langName; ///< The name of the source language StringTable opts; ///< The o10n options for each level StringVector libpaths; ///< The library paths Action PreProcessor; ///< PreProcessor command line @@ -105,7 +105,7 @@ namespace llvm { /// This pure virtual interface class defines the interface between the /// CompilerDriver and other software that provides ConfigData objects to /// it. The CompilerDriver must be configured to use an object of this - /// type so it can obtain the configuration data. + /// type so it can obtain the configuration data. /// @see setConfigDataProvider /// @brief Configuration Data Provider interface class ConfigDataProvider { @@ -116,7 +116,7 @@ namespace llvm { /// These flags control various actions of the compiler driver. They are /// used by adding the needed flag values together and passing them to the - /// compiler driver's setDriverFlags method. + /// compiler driver's setDriverFlags method. /// @see setDriverFlags /// @brief Driver specific flags enum DriverFlags { @@ -163,7 +163,7 @@ namespace llvm { virtual void setOutputMachine(const std::string& machineName) = 0; /// @brief Set the options for a given phase. - virtual void setPhaseArgs(Phases phase, const StringVector& opts) = 0; + virtual void setPhaseArgs(Phases phase, const StringVector& opts) = 0; /// @brief Set Library Paths virtual void setIncludePaths(const StringVector& paths) = 0; diff --git a/tools/llvmc/ConfigLexer.h b/tools/llvmc/ConfigLexer.h index e11c6e1353..8d8205e18f 100644 --- a/tools/llvmc/ConfigLexer.h +++ b/tools/llvmc/ConfigLexer.h @@ -1,10 +1,10 @@ //===- ConfigLexer.h - ConfigLexer Declarations -----------------*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the +// This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file declares the types and data needed by ConfigLexer.l @@ -37,7 +37,7 @@ class InputProvider { } virtual ~InputProvider(); virtual unsigned read(char *buf, unsigned max_size) = 0; - virtual void error(const std::string& msg); + virtual void error(const std::string& msg); virtual void checkErrors(); private: @@ -62,7 +62,7 @@ enum ConfigLexerTokens { FOPTS_SUBST, ///< The substitution item %fOpts% IN_SUBST, ///< The substitution item %in% INCLS_SUBST, ///< The substitution item %incls% - INTEGER, ///< An integer + INTEGER, ///< An integer LANG, ///< The name "lang" (and variants) LIBPATHS, ///< The name "libpaths" (and variants) LIBS, ///< The name "libs" (and variants) diff --git a/tools/llvmc/Configuration.cpp b/tools/llvmc/Configuration.cpp index d2a133b276..e2d20b0cfa 100644 --- a/tools/llvmc/Configuration.cpp +++ b/tools/llvmc/Configuration.cpp @@ -1,10 +1,10 @@ //===- Configuration.cpp - Configuration Data Mgmt --------------*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the +// This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file implements the parsing of configuration files for the LLVM Compiler @@ -34,7 +34,7 @@ namespace llvm { InputProvider::~InputProvider() {} void InputProvider::error(const std::string& msg) { - std::cerr << name << ":" << ConfigLexerState.lineNum << ": Error: " << + std::cerr << name << ":" << ConfigLexerState.lineNum << ": Error: " << msg << "\n"; errCount++; } @@ -53,7 +53,7 @@ namespace { class FileInputProvider : public InputProvider { public: FileInputProvider(const std::string & fname) - : InputProvider(fname) + : InputProvider(fname) , F(fname.c_str()) { ConfigLexerInput = this; } @@ -71,7 +71,7 @@ namespace { std::ifstream F; }; - cl::opt DumpTokens("dump-tokens", cl::Optional, cl::Hidden, + cl::opt DumpTokens("dump-tokens", cl::Optional, cl::Hidden, cl::init(false), cl::desc("Dump lexical tokens (debug use only).")); struct Parser @@ -90,14 +90,14 @@ namespace { InputProvider* provider; CompilerDriver::ConfigData* confDat; - inline int next() { + inline int next() { token = Configlex(); - if (DumpTokens) + if (DumpTokens) std::cerr << token << "\n"; return token; } - inline bool next_is_real() { + inline bool next_is_real() { next(); return (token != EOLTOK) && (token != ERRORTOK) && (token != 0); } @@ -117,7 +117,7 @@ namespace { while (next_is_real()) { switch (token ) { case STRING : - case OPTION : + case OPTION : result += ConfigLexerState.StringVal; break; case SEPARATOR: @@ -229,27 +229,27 @@ namespace { case LIBS: parseLibs(); break; - case NAME: - confDat->langName = parseName(); + case NAME: + confDat->langName = parseName(); break; - case OPT1: - parseOptionList(confDat->opts[CompilerDriver::OPT_FAST_COMPILE]); + case OPT1: + parseOptionList(confDat->opts[CompilerDriver::OPT_FAST_COMPILE]); break; - case OPT2: - parseOptionList(confDat->opts[CompilerDriver::OPT_SIMPLE]); + case OPT2: + parseOptionList(confDat->opts[CompilerDriver::OPT_SIMPLE]); break; - case OPT3: - parseOptionList(confDat->opts[CompilerDriver::OPT_AGGRESSIVE]); + case OPT3: + parseOptionList(confDat->opts[CompilerDriver::OPT_AGGRESSIVE]); break; - case OPT4: - parseOptionList(confDat->opts[CompilerDriver::OPT_LINK_TIME]); + case OPT4: + parseOptionList(confDat->opts[CompilerDriver::OPT_LINK_TIME]); break; - case OPT5: + case OPT5: parseOptionList( confDat->opts[CompilerDriver::OPT_AGGRESSIVE_LINK_TIME]); break; - default: - error("Expecting 'name' or 'optN' after 'lang.'"); + default: + error("Expecting 'name' or 'optN' after 'lang.'"); break; } } @@ -295,7 +295,7 @@ namespace { break; } next(); - } while (token != SPACE && token != EOFTOK && token != EOLTOK && + } while (token != SPACE && token != EOFTOK && token != EOLTOK && token != ERRORTOK); return !str.empty(); } @@ -312,7 +312,7 @@ namespace { case SPACE: next(); /* FALL THROUGH */ - default: + default: { std::string progname; if (parseProgramName(progname)) @@ -402,7 +402,7 @@ namespace { if (next() != SEPARATOR) error("Expecting '.'"); switch (next()) { - case COMMAND: + case COMMAND: parseCommand(confDat->Translator); break; case REQUIRED: @@ -414,7 +414,7 @@ namespace { case PREPROCESSES: if (parseBoolean()) confDat->Translator.set(CompilerDriver::PREPROCESSES_FLAG); - else + else confDat->Translator.clear(CompilerDriver::PREPROCESSES_FLAG); break; case OUTPUT: @@ -464,8 +464,8 @@ namespace { confDat->Translator.clear(CompilerDriver::OUTPUT_IS_ASM_FLAG); break; default: - error(std::string("Expecting 'command', 'preprocesses', " - "'translates' or 'output' but found '") + + error(std::string("Expecting 'command', 'preprocesses', " + "'translates' or 'output' but found '") + ConfigLexerState.StringVal + "' instead"); break; } @@ -509,7 +509,7 @@ namespace { case LINKER: parseLinker(); break; case EOLTOK: break; // just ignore case ERRORTOK: - default: + default: error("Invalid top level configuration item"); break; } @@ -548,7 +548,7 @@ LLVMC_ConfigDataProvider::ReadConfigData(const std::string& ftype) { confFile.setDirectory(conf); confFile.appendFile(ftype); if (!confFile.readable()) - throw std::string("Configuration file for '") + ftype + + throw std::string("Configuration file for '") + ftype + "' is not available."; } else { // Try the user's home directory @@ -569,7 +569,7 @@ LLVMC_ConfigDataProvider::ReadConfigData(const std::string& ftype) { confFile = sys::Path::GetLLVMDefaultConfigDir(); confFile.appendFile(ftype); if (!confFile.readable()) { - throw std::string("Configuration file for '") + ftype + + throw std::string("Configuration file for '") + ftype + "' is not available."; } } @@ -579,12 +579,12 @@ LLVMC_ConfigDataProvider::ReadConfigData(const std::string& ftype) { confFile = configDir; confFile.appendFile(ftype); if (!confFile.readable()) - throw std::string("Configuration file for '") + ftype + + throw std::string("Configuration file for '") + ftype + "' is not available."; } FileInputProvider fip( confFile.toString() ); if (!fip.okay()) { - throw std::string("Configuration file for '") + ftype + + throw std::string("Configuration file for '") + ftype + "' is not available."; } result = new CompilerDriver::ConfigData(); @@ -603,7 +603,7 @@ LLVMC_ConfigDataProvider::~LLVMC_ConfigDataProvider() Configurations.clear(); } -CompilerDriver::ConfigData* +CompilerDriver::ConfigData* LLVMC_ConfigDataProvider::ProvideConfigData(const std::string& filetype) { CompilerDriver::ConfigData* result = 0; if (!Configurations.empty()) { diff --git a/tools/llvmc/Configuration.h b/tools/llvmc/Configuration.h index 9a2af0ecd5..b121f9dcbb 100644 --- a/tools/llvmc/Configuration.h +++ b/tools/llvmc/Configuration.h @@ -1,10 +1,10 @@ //===- Configuration.h - Configuration Data Mgmt ----------------*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // -// This file was developed by Reid Spencer and is distributed under the +// This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file declares the LLVMC_ConfigDataProvider class which implements the @@ -22,7 +22,7 @@ namespace llvm { /// The driver's purpose is to make it easier for compiler writers and users /// of LLVM to utilize the compiler toolkits and LLVM toolset by learning only /// the interface of one program (llvmc). - /// + /// /// @see llvmc.cpp /// @brief The interface to the LLVM Compiler Driver. class LLVMC_ConfigDataProvider : public CompilerDriver::ConfigDataProvider { @@ -35,12 +35,12 @@ namespace llvm { /// @{ public: /// @brief Provide the configuration data to the CompilerDriver. - virtual CompilerDriver::ConfigData* + virtual CompilerDriver::ConfigData* ProvideConfigData(const std::string& filetype); /// @brief Allow the configuration directory to be set - virtual void setConfigDir(const sys::Path& dirName) { - configDir = dirName; + virtual void setConfigDir(const sys::Path& dirName) { + configDir = dirName; } private: diff --git a/tools/llvmc/llvmc.cpp b/tools/llvmc/llvmc.cpp index 75ea338d5c..7875aff18d 100644 --- a/tools/llvmc/llvmc.cpp +++ b/tools/llvmc/llvmc.cpp @@ -1,17 +1,17 @@ //===--- llvmc.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by Reid Spencer and is distributed under the // University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This tool provides a single point of access to the LLVM compilation tools. // It has many options. To discover the options supported please refer to the // tools' manual page (docs/CommandGuide/html/llvmc.html) or run the tool with // the --help option. -// +// //===------------------------------------------------------------------------=== #include "CompilerDriver.h" @@ -28,7 +28,7 @@ namespace { //=== PHASE OPTIONS //===------------------------------------------------------------------------=== cl::opt FinalPhase(cl::Optional, - cl::desc("Choose final phase of compilation:"), + cl::desc("Choose final phase of compilation:"), cl::init(CompilerDriver::LINKING), cl::values( clEnumValN(CompilerDriver::PREPROCESSING,"E", @@ -71,7 +71,7 @@ cl::opt OptLevel(cl::ZeroOrMore, //===------------------------------------------------------------------------=== cl::list PreprocessorToolOpts("Tpre", cl::ZeroOrMore, - cl::desc("Pass specific options to the pre-processor"), + cl::desc("Pass specific options to the pre-processor"), cl::value_desc("option")); cl::alias PreprocessorToolOptsAlias("Wp,", cl::ZeroOrMore, @@ -111,7 +111,7 @@ cl::list WOpts("W", cl::ZeroOrMore, cl::Prefix, cl::desc("Pass through -W options to compiler tools"), cl::value_desc("option")); -cl::list BOpt("B", cl::ZeroOrMore, cl::Prefix, +cl::list BOpt("B", cl::ZeroOrMore, cl::Prefix, cl::desc("Specify path to find llvmc sub-tools"), cl::value_desc("dir")); @@ -126,7 +126,7 @@ cl::list Libraries("l", cl::Prefix, cl::desc("Specify base name of libraries to link to"), cl::value_desc("lib")); cl::list Includes("I", cl::Prefix, - cl::desc("Specify location to search for included source"), + cl::desc("Specify location to search for included source"), cl::value_desc("dir")); cl::list Defines("D", cl::Prefix, @@ -137,7 +137,7 @@ cl::list Defines("D", cl::Prefix, //=== OUTPUT OPTIONS //===------------------------------------------------------------------------=== -cl::opt OutputFilename("o", +cl::opt OutputFilename("o", cl::desc("Override output filename"), cl::value_desc("file")); cl::opt OutputMachine("m", cl::Prefix, @@ -169,10 +169,10 @@ cl::alias DryRunAlias("y", cl::Optional, cl::opt Verbose("verbose", cl::Optional, cl::init(false), cl::desc("Print out each action taken")); -cl::alias VerboseAlias("v", cl::Optional, +cl::alias VerboseAlias("v", cl::Optional, cl::desc("Alias for -verbose"), cl::aliasopt(Verbose)); -cl::opt Debug("debug", cl::Optional, cl::init(false), +cl::opt Debug("debug", cl::Optional, cl::init(false), cl::Hidden, cl::desc("Print out debugging information")); cl::alias DebugAlias("d", cl::Optional, @@ -258,7 +258,7 @@ int main(int argc, char **argv) { try { // Parse the command line options - cl::ParseCommandLineOptions(argc, argv, + cl::ParseCommandLineOptions(argc, argv, " LLVM Compiler Driver (llvmc)\n\n" " This program provides easy invocation of the LLVM tool set\n" " and other compiler tools.\n" diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp index 46ede0a153..dcbd349ff2 100644 --- a/tools/opt/AnalysisWrappers.cpp +++ b/tools/opt/AnalysisWrappers.cpp @@ -1,10 +1,10 @@ //===- AnalysisWrappers.cpp - Wrappers around non-pass analyses -----------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines pass wrappers around LLVM analyses that don't make sense to @@ -56,7 +56,7 @@ namespace { } void print(std::ostream &OS) const {} - + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } diff --git a/tools/opt/GraphPrinters.cpp b/tools/opt/GraphPrinters.cpp index 9fd09c94fd..6f2ca5dd81 100644 --- a/tools/opt/GraphPrinters.cpp +++ b/tools/opt/GraphPrinters.cpp @@ -1,10 +1,10 @@ //===- GraphPrinters.cpp - DOT printers for various graph types -----------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines several printers for various different types of graphs used @@ -27,7 +27,7 @@ static void WriteGraphToFile(std::ostream &O, const std::string &GraphName, std::string Filename = GraphName + ".dot"; O << "Writing '" << Filename << "'..."; std::ofstream F(Filename.c_str()); - + if (F.good()) WriteGraph(F, GT); else @@ -46,7 +46,7 @@ namespace llvm { static std::string getGraphName(CallGraph *F) { return "Call Graph"; } - + static std::string getNodeLabel(CallGraphNode *Node, CallGraph *Graph) { if (Node->getFunction()) return ((Value*)Node->getFunction())->getName(); @@ -65,7 +65,7 @@ namespace { } void print(std::ostream &OS) const {} - + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.setPreservesAll(); diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index f54844cb59..566748848a 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -1,10 +1,10 @@ //===- opt.cpp - The LLVM Modular Optimizer -------------------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // Optimizations may be specified an arbitrary number of times on the command @@ -137,7 +137,7 @@ int main(int argc, char **argv) { // Create a new optimization pass for each one specified on the command line for (unsigned i = 0; i < OptimizationList.size(); ++i) { const PassInfo *Opt = OptimizationList[i]; - + if (Opt->getNormalCtor()) Passes.add(Opt->getNormalCtor()()); else if (Opt->getTargetCtor()) { -- cgit v1.2.3