[llvm-commits] CVS: llvm/tools/bugpoint/BugDriver.cpp CodeGeneratorBug.cpp CrashDebugger.cpp ExecutionDriver.cpp Miscompilation.cpp OptimizerDriver.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Jan 13 21:39:01 PST 2004


Changes in directory llvm/tools/bugpoint:

BugDriver.cpp updated: 1.21 -> 1.22
CodeGeneratorBug.cpp updated: 1.33 -> 1.34
CrashDebugger.cpp updated: 1.26 -> 1.27
ExecutionDriver.cpp updated: 1.33 -> 1.34
Miscompilation.cpp updated: 1.25 -> 1.26
OptimizerDriver.cpp updated: 1.16 -> 1.17

---
Log message:

finegrainify namespacification


---
Diffs of the changes:  (+111 -114)

Index: llvm/tools/bugpoint/BugDriver.cpp
diff -u llvm/tools/bugpoint/BugDriver.cpp:1.21 llvm/tools/bugpoint/BugDriver.cpp:1.22
--- llvm/tools/bugpoint/BugDriver.cpp:1.21	Tue Nov 11 16:41:34 2003
+++ llvm/tools/bugpoint/BugDriver.cpp	Tue Jan 13 21:38:36 2004
@@ -22,7 +22,6 @@
 #include "Support/CommandLine.h"
 #include "Support/FileUtilities.h"
 #include <memory>
-
 using namespace llvm;
 
 // Anonymous namespace to define command line options for debugging.
@@ -38,12 +37,10 @@
                                 "(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<const PassInfo*> &Passes) {
+std::string llvm::getPassesString(const std::vector<const PassInfo*> &Passes) {
   std::string Result;
   for (unsigned i = 0, e = Passes.size(); i != e; ++i) {
     if (i) Result += " ";
@@ -56,7 +53,7 @@
 // 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 @@
   std::cout << std::flush;
 }
 
-} // End llvm namespace


Index: llvm/tools/bugpoint/CodeGeneratorBug.cpp
diff -u llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.33 llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.34
--- llvm/tools/bugpoint/CodeGeneratorBug.cpp:1.33	Fri Nov 21 20:10:26 2003
+++ llvm/tools/bugpoint/CodeGeneratorBug.cpp	Tue Jan 13 21:38:36 2004
@@ -32,29 +32,29 @@
 #include "Support/FileUtilities.h"
 #include <algorithm>
 #include <set>
+using namespace llvm;
 
 namespace llvm {
+  extern cl::list<std::string> InputArgv;
 
-extern cl::list<std::string> InputArgv;
-
-class ReduceMisCodegenFunctions : public ListReducer<Function*> {
-  BugDriver &BD;
-public:
-  ReduceMisCodegenFunctions(BugDriver &bd) : BD(bd) {}
-
-  virtual TestResult doTest(std::vector<Function*> &Prefix,
-                            std::vector<Function*> &Suffix) {
-    if (!Prefix.empty() && TestFuncs(Prefix))
-      return KeepPrefix;
-    if (!Suffix.empty() && TestFuncs(Suffix))
-      return KeepSuffix;
-    return NoFailure;
-  }
-  
-  bool TestFuncs(const std::vector<Function*> &CodegenTest,
-                 bool KeepFiles = false);
-};
-
+  class ReduceMisCodegenFunctions : public ListReducer<Function*> {
+    BugDriver &BD;
+  public:
+    ReduceMisCodegenFunctions(BugDriver &bd) : BD(bd) {}
+    
+    virtual TestResult doTest(std::vector<Function*> &Prefix,
+                              std::vector<Function*> &Suffix) {
+      if (!Prefix.empty() && TestFuncs(Prefix))
+        return KeepPrefix;
+      if (!Suffix.empty() && TestFuncs(Suffix))
+        return KeepSuffix;
+      return NoFailure;
+    }
+    
+    bool TestFuncs(const std::vector<Function*> &CodegenTest,
+                   bool KeepFiles = false);
+  };
+}
 
 bool ReduceMisCodegenFunctions::TestFuncs(const std::vector<Function*> &Funcs,
                                           bool KeepFiles) {
@@ -328,7 +328,7 @@
   };
 }
 
-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 @@
 
   return false;
 }
-
-} // End llvm namespace


Index: llvm/tools/bugpoint/CrashDebugger.cpp
diff -u llvm/tools/bugpoint/CrashDebugger.cpp:1.26 llvm/tools/bugpoint/CrashDebugger.cpp:1.27
--- llvm/tools/bugpoint/CrashDebugger.cpp:1.26	Fri Nov 21 20:10:38 2003
+++ llvm/tools/bugpoint/CrashDebugger.cpp	Tue Jan 13 21:38:37 2004
@@ -28,21 +28,22 @@
 #include "Support/FileUtilities.h"
 #include <fstream>
 #include <set>
+using namespace llvm;
 
 namespace llvm {
-
-class DebugCrashes : public ListReducer<const PassInfo*> {
-  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<const PassInfo*> &Removed,
-                            std::vector<const PassInfo*> &Kept);
-};
+  class DebugCrashes : public ListReducer<const PassInfo*> {
+    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<const PassInfo*> &Removed,
+                              std::vector<const PassInfo*> &Kept);
+  };
+}
 
 DebugCrashes::TestResult
 DebugCrashes::doTest(std::vector<const PassInfo*> &Prefix,
@@ -82,22 +83,24 @@
   return NoFailure;
 }
 
-class ReduceCrashingFunctions : public ListReducer<Function*> {
-  BugDriver &BD;
-public:
-  ReduceCrashingFunctions(BugDriver &bd) : BD(bd) {}
-
-  virtual TestResult doTest(std::vector<Function*> &Prefix,
-                            std::vector<Function*> &Kept) {
-    if (!Kept.empty() && TestFuncs(Kept))
-      return KeepSuffix;
-    if (!Prefix.empty() && TestFuncs(Prefix))
-      return KeepPrefix;
-    return NoFailure;
-  }
-  
-  bool TestFuncs(std::vector<Function*> &Prefix);
-};
+namespace llvm {
+  class ReduceCrashingFunctions : public ListReducer<Function*> {
+    BugDriver &BD;
+  public:
+    ReduceCrashingFunctions(BugDriver &bd) : BD(bd) {}
+    
+    virtual TestResult doTest(std::vector<Function*> &Prefix,
+                              std::vector<Function*> &Kept) {
+      if (!Kept.empty() && TestFuncs(Kept))
+        return KeepSuffix;
+      if (!Prefix.empty() && TestFuncs(Prefix))
+        return KeepPrefix;
+      return NoFailure;
+    }
+    
+    bool TestFuncs(std::vector<Function*> &Prefix);
+  };
+}
 
 bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &Funcs) {
   // Clone the program to try hacking it apart...
@@ -143,27 +146,29 @@
 }
 
 
-/// 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<BasicBlock*> {
-  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<BasicBlock*> {
+    BugDriver &BD;
+  public:
+    ReduceCrashingBlocks(BugDriver &bd) : BD(bd) {}
     
-  virtual TestResult doTest(std::vector<BasicBlock*> &Prefix,
-                            std::vector<BasicBlock*> &Kept) {
-    if (!Kept.empty() && TestBlocks(Kept))
-      return KeepSuffix;
-    if (!Prefix.empty() && TestBlocks(Prefix))
-      return KeepPrefix;
-    return NoFailure;
-  }
+    virtual TestResult doTest(std::vector<BasicBlock*> &Prefix,
+                              std::vector<BasicBlock*> &Kept) {
+      if (!Kept.empty() && TestBlocks(Kept))
+        return KeepSuffix;
+      if (!Prefix.empty() && TestBlocks(Prefix))
+        return KeepPrefix;
+      return NoFailure;
+    }
     
-  bool TestBlocks(std::vector<BasicBlock*> &Prefix);
-};
+    bool TestBlocks(std::vector<BasicBlock*> &Prefix);
+  };
+}
 
 bool ReduceCrashingBlocks::TestBlocks(std::vector<BasicBlock*> &BBs) {
   // Clone the program to try hacking it apart...
@@ -403,4 +408,3 @@
   return false;
 }
 
-} // End llvm namespace


Index: llvm/tools/bugpoint/ExecutionDriver.cpp
diff -u llvm/tools/bugpoint/ExecutionDriver.cpp:1.33 llvm/tools/bugpoint/ExecutionDriver.cpp:1.34
--- llvm/tools/bugpoint/ExecutionDriver.cpp:1.33	Tue Nov 11 16:41:34 2003
+++ llvm/tools/bugpoint/ExecutionDriver.cpp	Tue Jan 13 21:38:37 2004
@@ -29,7 +29,6 @@
 #include "llvm/Support/ToolRunner.h"
 #include <fstream>
 #include <iostream>
-
 using namespace llvm;
 
 namespace {
@@ -61,12 +60,12 @@
 }
 
 namespace llvm {
-
-// Anything specified after the --args option are taken as arguments to the
-// program being debugged.
-cl::list<std::string>
-InputArgv("args", cl::Positional, cl::desc("<program arguments>..."),
-          cl::ZeroOrMore);
+  // Anything specified after the --args option are taken as arguments to the
+  // program being debugged.
+  cl::list<std::string>
+  InputArgv("args", cl::Positional, cl::desc("<program arguments>..."),
+            cl::ZeroOrMore);
+}
 
 //===----------------------------------------------------------------------===//
 // BugDriver method implementation
@@ -237,4 +236,3 @@
   return InterpreterSel == RunJIT;
 }
 
-} // End llvm namespace


Index: llvm/tools/bugpoint/Miscompilation.cpp
diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.25 llvm/tools/bugpoint/Miscompilation.cpp:1.26
--- llvm/tools/bugpoint/Miscompilation.cpp:1.25	Sat Dec  6 20:43:09 2003
+++ llvm/tools/bugpoint/Miscompilation.cpp	Tue Jan 13 21:38:37 2004
@@ -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<const PassInfo*> {
-  BugDriver &BD;
-public:
-  ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {}
-
-  virtual TestResult doTest(std::vector<const PassInfo*> &Prefix,
-                            std::vector<const PassInfo*> &Suffix);
-};
+  class ReduceMiscompilingPasses : public ListReducer<const PassInfo*> {
+    BugDriver &BD;
+  public:
+    ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {}
+    
+    virtual TestResult doTest(std::vector<const PassInfo*> &Prefix,
+                              std::vector<const PassInfo*> &Suffix);
+  };
+}
 
 ReduceMiscompilingPasses::TestResult
 ReduceMiscompilingPasses::doTest(std::vector<const PassInfo*> &Prefix,
@@ -122,22 +124,24 @@
   return NoFailure;
 }
 
-class ReduceMiscompilingFunctions : public ListReducer<Function*> {
-  BugDriver &BD;
-public:
-  ReduceMiscompilingFunctions(BugDriver &bd) : BD(bd) {}
-
-  virtual TestResult doTest(std::vector<Function*> &Prefix,
-                            std::vector<Function*> &Suffix) {
-    if (!Suffix.empty() && TestFuncs(Suffix, false))
-      return KeepSuffix;
-    if (!Prefix.empty() && TestFuncs(Prefix, false))
-      return KeepPrefix;
-    return NoFailure;
-  }
-  
-  bool TestFuncs(const std::vector<Function*> &Prefix, bool EmitBytecode);
-};
+namespace llvm {
+  class ReduceMiscompilingFunctions : public ListReducer<Function*> {
+    BugDriver &BD;
+  public:
+    ReduceMiscompilingFunctions(BugDriver &bd) : BD(bd) {}
+    
+    virtual TestResult doTest(std::vector<Function*> &Prefix,
+                              std::vector<Function*> &Suffix) {
+      if (!Suffix.empty() && TestFuncs(Suffix, false))
+        return KeepSuffix;
+      if (!Prefix.empty() && TestFuncs(Prefix, false))
+        return KeepPrefix;
+      return NoFailure;
+    }
+    
+    bool TestFuncs(const std::vector<Function*> &Prefix, bool EmitBytecode);
+  };
+}
 
 bool ReduceMiscompilingFunctions::TestFuncs(const std::vector<Function*> &Funcs,
                                             bool EmitBytecode) {
@@ -315,4 +319,3 @@
   return false;
 }
 
-} // End llvm namespace


Index: llvm/tools/bugpoint/OptimizerDriver.cpp
diff -u llvm/tools/bugpoint/OptimizerDriver.cpp:1.16 llvm/tools/bugpoint/OptimizerDriver.cpp:1.17
--- llvm/tools/bugpoint/OptimizerDriver.cpp:1.16	Tue Nov 11 16:41:34 2003
+++ llvm/tools/bugpoint/OptimizerDriver.cpp	Tue Jan 13 21:38:37 2004
@@ -25,8 +25,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-
-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 @@
   return !ExitedOK;
 }
 
-} // End llvm namespace





More information about the llvm-commits mailing list