From: Chris Lattner Date: Wed, 14 Jan 2004 03:38:37 +0000 (+0000) Subject: finegrainify namespacification X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=fa76183e8e28985dfd17b1d6291c939dab4cbe1d;p=oota-llvm.git finegrainify namespacification git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10839 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index 12843588c88..bbfdf27b9ee 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -22,7 +22,6 @@ #include "Support/CommandLine.h" #include "Support/FileUtilities.h" #include - using namespace llvm; // Anonymous namespace to define command line options for debugging. @@ -38,12 +37,10 @@ namespace { "(for miscompilation detection)")); } -namespace llvm { - /// getPassesString - Turn a list of passes into a string which indicates the /// command line options that must be passed to add the passes. /// -std::string getPassesString(const std::vector &Passes) { +std::string llvm::getPassesString(const std::vector &Passes) { std::string Result; for (unsigned i = 0, e = Passes.size(); i != e; ++i) { if (i) Result += " "; @@ -56,7 +53,7 @@ std::string getPassesString(const std::vector &Passes) { // DeleteFunctionBody - "Remove" the function by deleting all of its basic // blocks, making it external. // -void DeleteFunctionBody(Function *F) { +void llvm::DeleteFunctionBody(Function *F) { // delete the body of the function... F->deleteBody(); assert(F->isExternal() && "This didn't make the function external!"); @@ -184,4 +181,3 @@ void BugDriver::PrintFunctionList(const std::vector &Funcs) { std::cout << std::flush; } -} // End llvm namespace diff --git a/tools/bugpoint/CodeGeneratorBug.cpp b/tools/bugpoint/CodeGeneratorBug.cpp index 0858f4ed0d7..18650c03969 100644 --- a/tools/bugpoint/CodeGeneratorBug.cpp +++ b/tools/bugpoint/CodeGeneratorBug.cpp @@ -32,29 +32,29 @@ #include "Support/FileUtilities.h" #include #include +using namespace llvm; namespace llvm { + extern cl::list InputArgv; -extern cl::list InputArgv; - -class ReduceMisCodegenFunctions : public ListReducer { - BugDriver &BD; -public: - ReduceMisCodegenFunctions(BugDriver &bd) : BD(bd) {} - - virtual TestResult doTest(std::vector &Prefix, - std::vector &Suffix) { - if (!Prefix.empty() && TestFuncs(Prefix)) - return KeepPrefix; - if (!Suffix.empty() && TestFuncs(Suffix)) - return KeepSuffix; - return NoFailure; - } - - bool TestFuncs(const std::vector &CodegenTest, - bool KeepFiles = false); -}; - + class ReduceMisCodegenFunctions : public ListReducer { + BugDriver &BD; + public: + ReduceMisCodegenFunctions(BugDriver &bd) : BD(bd) {} + + virtual TestResult doTest(std::vector &Prefix, + std::vector &Suffix) { + if (!Prefix.empty() && TestFuncs(Prefix)) + return KeepPrefix; + if (!Suffix.empty() && TestFuncs(Suffix)) + return KeepSuffix; + return NoFailure; + } + + bool TestFuncs(const std::vector &CodegenTest, + bool KeepFiles = false); + }; +} bool ReduceMisCodegenFunctions::TestFuncs(const std::vector &Funcs, bool KeepFiles) { @@ -328,7 +328,7 @@ namespace { }; } -void DisambiguateGlobalSymbols(Module *M) { +static void DisambiguateGlobalSymbols(Module *M) { // First, try not to cause collisions by minimizing chances of renaming an // already-external symbol, so take in external globals and functions as-is. Disambiguator D; @@ -406,5 +406,3 @@ bool BugDriver::debugCodeGenerator() { return false; } - -} // End llvm namespace diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index af64d7a9af6..ecb17342cb7 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -28,21 +28,22 @@ #include "Support/FileUtilities.h" #include #include +using namespace llvm; namespace llvm { - -class DebugCrashes : public ListReducer { - BugDriver &BD; -public: - DebugCrashes(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. - // - virtual TestResult doTest(std::vector &Removed, - std::vector &Kept); -}; + class DebugCrashes : public ListReducer { + BugDriver &BD; + public: + DebugCrashes(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. + // + virtual TestResult doTest(std::vector &Removed, + std::vector &Kept); + }; +} DebugCrashes::TestResult DebugCrashes::doTest(std::vector &Prefix, @@ -82,22 +83,24 @@ DebugCrashes::doTest(std::vector &Prefix, return NoFailure; } -class ReduceCrashingFunctions : public ListReducer { - BugDriver &BD; -public: - ReduceCrashingFunctions(BugDriver &bd) : BD(bd) {} - - virtual TestResult doTest(std::vector &Prefix, - std::vector &Kept) { - if (!Kept.empty() && TestFuncs(Kept)) - return KeepSuffix; - if (!Prefix.empty() && TestFuncs(Prefix)) - return KeepPrefix; - return NoFailure; - } - - bool TestFuncs(std::vector &Prefix); -}; +namespace llvm { + class ReduceCrashingFunctions : public ListReducer { + BugDriver &BD; + public: + ReduceCrashingFunctions(BugDriver &bd) : BD(bd) {} + + virtual TestResult doTest(std::vector &Prefix, + std::vector &Kept) { + if (!Kept.empty() && TestFuncs(Kept)) + return KeepSuffix; + if (!Prefix.empty() && TestFuncs(Prefix)) + return KeepPrefix; + return NoFailure; + } + + bool TestFuncs(std::vector &Prefix); + }; +} bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) { // Clone the program to try hacking it apart... @@ -143,27 +146,29 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector &Funcs) { } -/// ReduceCrashingBlocks reducer - This works by setting the terminators of all -/// terminators except the specified basic blocks to a 'ret' instruction, then -/// running the simplify-cfg pass. This has the effect of chopping up the CFG -/// really fast which can reduce large functions quickly. -/// -class ReduceCrashingBlocks : public ListReducer { - BugDriver &BD; -public: - ReduceCrashingBlocks(BugDriver &bd) : BD(bd) {} +namespace llvm { + /// ReduceCrashingBlocks reducer - This works by setting the terminators of + /// all terminators except the specified basic blocks to a 'ret' instruction, + /// then running the simplify-cfg pass. This has the effect of chopping up + /// the CFG really fast which can reduce large functions quickly. + /// + class ReduceCrashingBlocks : public ListReducer { + BugDriver &BD; + public: + ReduceCrashingBlocks(BugDriver &bd) : BD(bd) {} - virtual TestResult doTest(std::vector &Prefix, - std::vector &Kept) { - if (!Kept.empty() && TestBlocks(Kept)) - return KeepSuffix; - if (!Prefix.empty() && TestBlocks(Prefix)) - return KeepPrefix; - return NoFailure; - } + virtual TestResult doTest(std::vector &Prefix, + std::vector &Kept) { + if (!Kept.empty() && TestBlocks(Kept)) + return KeepSuffix; + if (!Prefix.empty() && TestBlocks(Prefix)) + return KeepPrefix; + return NoFailure; + } - bool TestBlocks(std::vector &Prefix); -}; + bool TestBlocks(std::vector &Prefix); + }; +} bool ReduceCrashingBlocks::TestBlocks(std::vector &BBs) { // Clone the program to try hacking it apart... @@ -403,4 +408,3 @@ bool BugDriver::debugCrash() { return false; } -} // End llvm namespace diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp index 9a3bd550555..e9e21d0aa2a 100644 --- a/tools/bugpoint/ExecutionDriver.cpp +++ b/tools/bugpoint/ExecutionDriver.cpp @@ -29,7 +29,6 @@ BUGPOINT NOTES: #include "llvm/Support/ToolRunner.h" #include #include - using namespace llvm; namespace { @@ -61,12 +60,12 @@ namespace { } namespace llvm { - -// Anything specified after the --args option are taken as arguments to the -// program being debugged. -cl::list -InputArgv("args", cl::Positional, cl::desc("..."), - cl::ZeroOrMore); + // Anything specified after the --args option are taken as arguments to the + // program being debugged. + cl::list + InputArgv("args", cl::Positional, cl::desc("..."), + cl::ZeroOrMore); +} //===----------------------------------------------------------------------===// // BugDriver method implementation @@ -237,4 +236,3 @@ bool BugDriver::isExecutingJIT() { return InterpreterSel == RunJIT; } -} // End llvm namespace diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index f9d5fdbb795..715860839db 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -18,17 +18,19 @@ #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils/Linker.h" #include "Support/FileUtilities.h" +using namespace llvm; namespace llvm { -class ReduceMiscompilingPasses : public ListReducer { - BugDriver &BD; -public: - ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {} - - virtual TestResult doTest(std::vector &Prefix, - std::vector &Suffix); -}; + class ReduceMiscompilingPasses : public ListReducer { + BugDriver &BD; + public: + ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {} + + virtual TestResult doTest(std::vector &Prefix, + std::vector &Suffix); + }; +} ReduceMiscompilingPasses::TestResult ReduceMiscompilingPasses::doTest(std::vector &Prefix, @@ -122,22 +124,24 @@ ReduceMiscompilingPasses::doTest(std::vector &Prefix, return NoFailure; } -class ReduceMiscompilingFunctions : public ListReducer { - BugDriver &BD; -public: - ReduceMiscompilingFunctions(BugDriver &bd) : BD(bd) {} - - virtual TestResult doTest(std::vector &Prefix, - std::vector &Suffix) { - if (!Suffix.empty() && TestFuncs(Suffix, false)) - return KeepSuffix; - if (!Prefix.empty() && TestFuncs(Prefix, false)) - return KeepPrefix; - return NoFailure; - } - - bool TestFuncs(const std::vector &Prefix, bool EmitBytecode); -}; +namespace llvm { + class ReduceMiscompilingFunctions : public ListReducer { + BugDriver &BD; + public: + ReduceMiscompilingFunctions(BugDriver &bd) : BD(bd) {} + + virtual TestResult doTest(std::vector &Prefix, + std::vector &Suffix) { + if (!Suffix.empty() && TestFuncs(Suffix, false)) + return KeepSuffix; + if (!Prefix.empty() && TestFuncs(Prefix, false)) + return KeepPrefix; + return NoFailure; + } + + bool TestFuncs(const std::vector &Prefix, bool EmitBytecode); + }; +} bool ReduceMiscompilingFunctions::TestFuncs(const std::vector &Funcs, bool EmitBytecode) { @@ -315,4 +319,3 @@ bool BugDriver::debugMiscompilation() { return false; } -} // End llvm namespace diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index af9d1e5a945..1d86828ba07 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -25,8 +25,7 @@ #include #include #include - -namespace llvm { +using namespace llvm; /// writeProgramToFile - This writes the current "Program" to the named bytecode /// file. If an error occurs, true is returned. @@ -162,4 +161,3 @@ bool BugDriver::runPasses(const std::vector &Passes, return !ExitedOK; } -} // End llvm namespace