[llvm-commits] CVS: llvm/lib/Support/Annotation.cpp CommandLine.cpp ConstantRange.cpp Debug.cpp DynamicLinker.cpp FileUtilities.cpp LeakDetector.cpp Mangler.cpp PluginLoader.cpp Signals.cpp SystemUtils.cpp ToolRunner.cpp ValueHolder.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Dec 14 15:37:01 PST 2003


Changes in directory llvm/lib/Support:

Annotation.cpp updated: 1.12 -> 1.13
CommandLine.cpp updated: 1.41 -> 1.42
ConstantRange.cpp updated: 1.7 -> 1.8
Debug.cpp updated: 1.4 -> 1.5
DynamicLinker.cpp updated: 1.4 -> 1.5
FileUtilities.cpp updated: 1.13 -> 1.14
LeakDetector.cpp updated: 1.5 -> 1.6
Mangler.cpp updated: 1.7 -> 1.8
PluginLoader.cpp updated: 1.7 -> 1.8
Signals.cpp updated: 1.10 -> 1.11
SystemUtils.cpp updated: 1.19 -> 1.20
ToolRunner.cpp updated: 1.12 -> 1.13
ValueHolder.cpp updated: 1.3 -> 1.4

---
Log message:

Finegrainify namespacification


---
Diffs of the changes:  (+73 -108)

Index: llvm/lib/Support/Annotation.cpp
diff -u llvm/lib/Support/Annotation.cpp:1.12 llvm/lib/Support/Annotation.cpp:1.13
--- llvm/lib/Support/Annotation.cpp:1.12	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/Annotation.cpp	Sun Dec 14 15:35:53 2003
@@ -13,8 +13,7 @@
 
 #include <map>
 #include "Support/Annotation.h"
-
-namespace llvm {
+using namespace llvm;
 
 typedef std::map<const std::string, unsigned> IDMapType;
 static unsigned IDCounter = 0;  // Unique ID counter
@@ -96,5 +95,3 @@
   if (I == getFactMap().end()) return 0;
   return I->second.first(ID, Obj, I->second.second);
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/CommandLine.cpp
diff -u llvm/lib/Support/CommandLine.cpp:1.41 llvm/lib/Support/CommandLine.cpp:1.42
--- llvm/lib/Support/CommandLine.cpp:1.41	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/CommandLine.cpp	Sun Dec 14 15:35:53 2003
@@ -23,8 +23,7 @@
 #include <iostream>
 #include <cstdlib>
 #include <cerrno>
-
-namespace llvm {
+using namespace llvm;
 
 using namespace cl;
 
@@ -889,5 +888,3 @@
      cl::location(HiddenPrinter), cl::Hidden, cl::ValueDisallowed);
 
 } // End anonymous namespace
-
-} // End llvm namespace


Index: llvm/lib/Support/ConstantRange.cpp
diff -u llvm/lib/Support/ConstantRange.cpp:1.7 llvm/lib/Support/ConstantRange.cpp:1.8
--- llvm/lib/Support/ConstantRange.cpp:1.7	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/ConstantRange.cpp	Sun Dec 14 15:35:53 2003
@@ -25,8 +25,7 @@
 #include "llvm/Type.h"
 #include "llvm/Instruction.h"
 #include "llvm/ConstantHandling.h"
-
-namespace llvm {
+using namespace llvm;
 
 /// Initialize a full (the default) or empty set for the specified type.
 ///
@@ -250,5 +249,3 @@
 void ConstantRange::dump() const {
   print(std::cerr);
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/Debug.cpp
diff -u llvm/lib/Support/Debug.cpp:1.4 llvm/lib/Support/Debug.cpp:1.5
--- llvm/lib/Support/Debug.cpp:1.4	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/Debug.cpp	Sun Dec 14 15:35:53 2003
@@ -23,12 +23,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "Support/Statistic.h"
+#include "Support/Debug.h"
 #include "Support/CommandLine.h"
+using namespace llvm;
 
-namespace llvm {
-
-bool DebugFlag;  // DebugFlag - Exported boolean set by the -debug option
+bool llvm::DebugFlag;  // DebugFlag - Exported boolean set by the -debug option
 
 namespace {
 #ifndef NDEBUG
@@ -57,12 +56,10 @@
 // specified on the command line, or if none was specified on the command line
 // with the -debug-only=X option.
 //
-bool isCurrentDebugType(const char *DebugType) {
+bool llvm::isCurrentDebugType(const char *DebugType) {
 #ifndef NDEBUG
   return CurrentDebugType.empty() || DebugType == CurrentDebugType;
 #else
   return false;
 #endif
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/DynamicLinker.cpp
diff -u llvm/lib/Support/DynamicLinker.cpp:1.4 llvm/lib/Support/DynamicLinker.cpp:1.5
--- llvm/lib/Support/DynamicLinker.cpp:1.4	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/DynamicLinker.cpp	Sun Dec 14 15:35:53 2003
@@ -22,10 +22,9 @@
 #include "Support/DynamicLinker.h"
 #include "Config/dlfcn.h"
 #include <cassert>
+using namespace llvm;
 
-namespace llvm {
-
-bool LinkDynamicObject (const char *filename, std::string *ErrorMessage) {
+bool llvm::LinkDynamicObject (const char *filename, std::string *ErrorMessage) {
 #if defined (HAVE_DLOPEN)
   if (dlopen (filename, RTLD_NOW | RTLD_GLOBAL) == 0) {
     if (ErrorMessage) *ErrorMessage = dlerror ();
@@ -37,7 +36,7 @@
 #endif
 }
 
-void *GetAddressOfSymbol (const char *symbolName) {
+void *llvm::GetAddressOfSymbol (const char *symbolName) {
 #if defined (HAVE_DLOPEN)
 #ifdef RTLD_DEFAULT
   return dlsym (RTLD_DEFAULT, symbolName);
@@ -51,8 +50,6 @@
 }
 
 // soft, cushiony C++ interface.
-void *GetAddressOfSymbol (const std::string &symbolName) {
+void *llvm::GetAddressOfSymbol (const std::string &symbolName) {
   return GetAddressOfSymbol (symbolName.c_str ());
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/FileUtilities.cpp
diff -u llvm/lib/Support/FileUtilities.cpp:1.13 llvm/lib/Support/FileUtilities.cpp:1.14
--- llvm/lib/Support/FileUtilities.cpp:1.13	Sun Nov 23 23:36:38 2003
+++ llvm/lib/Support/FileUtilities.cpp	Sun Dec 14 15:35:53 2003
@@ -19,14 +19,12 @@
 #include <fstream>
 #include <iostream>
 #include <cstdio>
-
-namespace llvm
-{
+using namespace llvm;
 
 /// CheckMagic - Returns true IFF the file named FN begins with Magic. FN must
 /// name a readable file.
 ///
-bool CheckMagic (const std::string &FN, const std::string &Magic) {
+bool llvm::CheckMagic(const std::string &FN, const std::string &Magic) {
   char buf[1 + Magic.size ()];
   std::ifstream f (FN.c_str ());
   f.read (buf, Magic.size ());
@@ -37,7 +35,7 @@
 /// IsArchive - Returns true IFF the file named FN appears to be a "ar" library
 /// archive. The file named FN must exist.
 ///
-bool IsArchive(const std::string &FN) {
+bool llvm::IsArchive(const std::string &FN) {
   // Inspect the beginning of the file to see if it contains the "ar"
   // library archive format magic string.
   return CheckMagic (FN, "!<arch>\012");
@@ -46,7 +44,7 @@
 /// IsBytecode - Returns true IFF the file named FN appears to be an LLVM
 /// bytecode file. The file named FN must exist.
 ///
-bool IsBytecode(const std::string &FN) {
+bool llvm::IsBytecode(const std::string &FN) {
   // Inspect the beginning of the file to see if it contains the LLVM
   // bytecode format magic string.
   return CheckMagic (FN, "llvm");
@@ -55,7 +53,7 @@
 /// IsSharedObject - Returns trus IFF the file named FN appears to be a shared
 /// object with an ELF header. The file named FN must exist.
 ///
-bool IsSharedObject(const std::string &FN) {
+bool llvm::IsSharedObject(const std::string &FN) {
   // Inspect the beginning of the file to see if it contains the ELF shared
   // object magic string.
   static const char elfMagic[] = { 0x7f, 'E', 'L', 'F', '\0' };
@@ -65,7 +63,7 @@
 /// FileOpenable - Returns true IFF Filename names an existing regular
 /// file which we can successfully open.
 ///
-bool FileOpenable (const std::string &Filename) {
+bool llvm::FileOpenable(const std::string &Filename) {
   struct stat s;
   if (stat (Filename.c_str (), &s) == -1)
     return false; // Cannot stat file
@@ -83,8 +81,8 @@
 /// occurs, allowing the caller to distinguish between a failed diff and a file
 /// system error.
 ///
-bool DiffFiles(const std::string &FileA, const std::string &FileB,
-               std::string *Error) {
+bool llvm::DiffFiles(const std::string &FileA, const std::string &FileB,
+                     std::string *Error) {
   std::ifstream FileAStream(FileA.c_str());
   if (!FileAStream) {
     if (Error) *Error = "Couldn't open file '" + FileA + "'";
@@ -113,7 +111,8 @@
 /// or if Old does not exist, move the New file over the Old file.  Otherwise,
 /// remove the New file.
 ///
-void MoveFileOverIfUpdated(const std::string &New, const std::string &Old) {
+void llvm::MoveFileOverIfUpdated(const std::string &New,
+                                 const std::string &Old) {
   if (DiffFiles(New, Old)) {
     if (std::rename(New.c_str(), Old.c_str()))
       std::cerr << "Error renaming '" << New << "' to '" << Old << "'!\n";
@@ -124,7 +123,7 @@
 
 /// removeFile - Delete the specified file
 ///
-void removeFile(const std::string &Filename) {
+void llvm::removeFile(const std::string &Filename) {
   std::remove(Filename.c_str());
 }
 
@@ -132,7 +131,7 @@
 /// file does not exist yet, return it, otherwise add a suffix to make it
 /// unique.
 ///
-std::string getUniqueFilename(const std::string &FilenameBase) {
+std::string llvm::getUniqueFilename(const std::string &FilenameBase) {
   if (!std::ifstream(FilenameBase.c_str()))
     return FilenameBase;    // Couldn't open the file? Use it!
 
@@ -183,8 +182,8 @@
 /// umask would allow. Filename must name an existing file or
 /// directory.  Returns true on success, false on error.
 ///
-bool MakeFileExecutable (const std::string &Filename) {
-  return AddPermissionsBits (Filename, 0111);
+bool llvm::MakeFileExecutable(const std::string &Filename) {
+  return AddPermissionsBits(Filename, 0111);
 }
 
 /// MakeFileReadable - Make the file named Filename readable by
@@ -192,8 +191,6 @@
 /// umask would allow. Filename must name an existing file or
 /// directory.  Returns true on success, false on error.
 ///
-bool MakeFileReadable (const std::string &Filename) {
-  return AddPermissionsBits (Filename, 0444);
+bool llvm::MakeFileReadable(const std::string &Filename) {
+  return AddPermissionsBits(Filename, 0444);
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/LeakDetector.cpp
diff -u llvm/lib/Support/LeakDetector.cpp:1.5 llvm/lib/Support/LeakDetector.cpp:1.6
--- llvm/lib/Support/LeakDetector.cpp:1.5	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/LeakDetector.cpp	Sun Dec 14 15:35:53 2003
@@ -14,8 +14,7 @@
 #include "Support/LeakDetector.h"
 #include "llvm/Value.h"
 #include <set>
-
-namespace llvm {
+using namespace llvm;
 
 // Lazily allocate set so that release build doesn't have to do anything.
 static std::set<const void*> *Objects = 0;
@@ -89,5 +88,3 @@
     Objects = 0; LLVMObjects = 0;
   }
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/Mangler.cpp
diff -u llvm/lib/Support/Mangler.cpp:1.7 llvm/lib/Support/Mangler.cpp:1.8
--- llvm/lib/Support/Mangler.cpp:1.7	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/Mangler.cpp	Sun Dec 14 15:35:53 2003
@@ -15,8 +15,7 @@
 #include "llvm/Module.h"
 #include "llvm/Type.h"
 #include "Support/StringExtras.h"
-
-namespace llvm {
+using namespace llvm;
 
 static char HexDigit(int V) {
   return V < 10 ? V+'0' : V+'A'-10;
@@ -100,5 +99,3 @@
       else
         FoundNames.insert(I->getName());   // Otherwise, keep track of name
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/PluginLoader.cpp
diff -u llvm/lib/Support/PluginLoader.cpp:1.7 llvm/lib/Support/PluginLoader.cpp:1.8
--- llvm/lib/Support/PluginLoader.cpp:1.7	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/PluginLoader.cpp	Sun Dec 14 15:35:53 2003
@@ -22,8 +22,7 @@
 #include "Config/dlfcn.h"
 #include "Config/link.h"
 #include <iostream>
-
-namespace llvm {
+using namespace llvm;
 
 namespace {
   struct PluginLoader {
@@ -40,5 +39,3 @@
 static cl::opt<PluginLoader, false, cl::parser<std::string> >
 LoadOpt("load", cl::ZeroOrMore, cl::value_desc("plugin.so"),
         cl::desc("Load the specified plugin"));
-
-} // End llvm namespace


Index: llvm/lib/Support/Signals.cpp
diff -u llvm/lib/Support/Signals.cpp:1.10 llvm/lib/Support/Signals.cpp:1.11
--- llvm/lib/Support/Signals.cpp:1.10	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/Signals.cpp	Sun Dec 14 15:35:53 2003
@@ -19,8 +19,7 @@
 #include <cstdio>
 #include <signal.h>
 #include "Config/config.h"     // Get the signal handler return type
-
-namespace llvm {
+using namespace llvm;
 
 static std::vector<std::string> FilesToRemove;
 
@@ -58,11 +57,9 @@
 static void RegisterHandler(int Signal) { signal(Signal, SignalHandler); }
 
 // RemoveFileOnSignal - The public API
-void RemoveFileOnSignal(const std::string &Filename) {
+void llvm::RemoveFileOnSignal(const std::string &Filename) {
   FilesToRemove.push_back(Filename);
 
   std::for_each(IntSigs, IntSigsEnd, RegisterHandler);
   std::for_each(KillSigs, KillSigsEnd, RegisterHandler);
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/SystemUtils.cpp
diff -u llvm/lib/Support/SystemUtils.cpp:1.19 llvm/lib/Support/SystemUtils.cpp:1.20
--- llvm/lib/Support/SystemUtils.cpp:1.19	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/SystemUtils.cpp	Sun Dec 14 15:35:53 2003
@@ -23,13 +23,12 @@
 #include "Config/sys/wait.h"
 #include "Config/unistd.h"
 #include "Config/errno.h"
-
-namespace llvm {
+using namespace llvm;
 
 /// isExecutableFile - This function returns true if the filename specified
 /// exists and is executable.
 ///
-bool isExecutableFile(const std::string &ExeFileName) {
+bool llvm::isExecutableFile(const std::string &ExeFileName) {
   struct stat Buf;
   if (stat(ExeFileName.c_str(), &Buf))
     return false;  // Must not be executable!
@@ -51,8 +50,8 @@
 /// directory, nor in the PATH.  If the executable cannot be found, return an
 /// empty string.
 /// 
-std::string FindExecutable(const std::string &ExeName,
-                           const std::string &ProgramPath) {
+std::string llvm::FindExecutable(const std::string &ExeName,
+                                 const std::string &ProgramPath) {
   // First check the directory that bugpoint is in.  We can do this if
   // BugPointPath contains at least one / character, indicating that it is a
   // relative path to bugpoint itself.
@@ -116,11 +115,11 @@
 /// the calling program if there is an error executing the specified program.
 /// It returns the return value of the program, or -1 if a timeout is detected.
 ///
-int RunProgramWithTimeout(const std::string &ProgramPath, const char **Args,
-                          const std::string &StdInFile,
-                          const std::string &StdOutFile,
-                          const std::string &StdErrFile) {
-
+int llvm::RunProgramWithTimeout(const std::string &ProgramPath,
+                                const char **Args,
+                                const std::string &StdInFile,
+                                const std::string &StdOutFile,
+                                const std::string &StdErrFile) {
   // FIXME: install sigalarm handler here for timeout...
 
   int Child = fork();
@@ -204,9 +203,8 @@
 //
 //  This function does not use $PATH to find programs.
 //
-int
-ExecWait (const char * const old_argv[], const char * const old_envp[])
-{
+int llvm::ExecWait(const char * const old_argv[],
+                   const char * const old_envp[]) {
   // Child process ID
   register int child;
 
@@ -273,5 +271,3 @@
   //
   return 1;
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/ToolRunner.cpp
diff -u llvm/lib/Support/ToolRunner.cpp:1.12 llvm/lib/Support/ToolRunner.cpp:1.13
--- llvm/lib/Support/ToolRunner.cpp:1.12	Tue Nov 18 00:31:17 2003
+++ llvm/lib/Support/ToolRunner.cpp	Sun Dec 14 15:35:53 2003
@@ -18,25 +18,26 @@
 #include "Support/FileUtilities.h"
 #include <iostream>
 #include <fstream>
-
-namespace llvm {
+using namespace llvm;
 
 //===---------------------------------------------------------------------===//
 // LLI Implementation of AbstractIntepreter interface
 //
-class LLI : public AbstractInterpreter {
-  std::string LLIPath;          // The path to the LLI executable
-public:
-  LLI(const std::string &Path) : LLIPath(Path) { }
-
-
-  virtual int ExecuteProgram(const std::string &Bytecode,
-                             const std::vector<std::string> &Args,
-                             const std::string &InputFile,
-                             const std::string &OutputFile,
-                             const std::vector<std::string> &SharedLibs = 
+namespace {
+  class LLI : public AbstractInterpreter {
+    std::string LLIPath;          // The path to the LLI executable
+  public:
+    LLI(const std::string &Path) : LLIPath(Path) { }
+    
+    
+    virtual int ExecuteProgram(const std::string &Bytecode,
+                               const std::vector<std::string> &Args,
+                               const std::string &InputFile,
+                               const std::string &OutputFile,
+                               const std::vector<std::string> &SharedLibs = 
                                std::vector<std::string>());
-};
+  };
+}
 
 int LLI::ExecuteProgram(const std::string &Bytecode,
                         const std::vector<std::string> &Args,
@@ -148,19 +149,21 @@
 //===---------------------------------------------------------------------===//
 // JIT Implementation of AbstractIntepreter interface
 //
-class JIT : public AbstractInterpreter {
-  std::string LLIPath;          // The path to the LLI executable
-public:
-  JIT(const std::string &Path) : LLIPath(Path) { }
-
-
-  virtual int ExecuteProgram(const std::string &Bytecode,
-                             const std::vector<std::string> &Args,
-                             const std::string &InputFile,
-                             const std::string &OutputFile,
-                             const std::vector<std::string> &SharedLibs = 
+namespace {
+  class JIT : public AbstractInterpreter {
+    std::string LLIPath;          // The path to the LLI executable
+  public:
+    JIT(const std::string &Path) : LLIPath(Path) { }
+    
+    
+    virtual int ExecuteProgram(const std::string &Bytecode,
+                               const std::vector<std::string> &Args,
+                               const std::string &InputFile,
+                               const std::string &OutputFile,
+                               const std::vector<std::string> &SharedLibs = 
                                std::vector<std::string>());
-};
+  };
+}
 
 int JIT::ExecuteProgram(const std::string &Bytecode,
                         const std::vector<std::string> &Args,
@@ -396,5 +399,3 @@
   Message = "Found gcc: " + GCCPath + "\n";
   return new GCC(GCCPath);
 }
-
-} // End llvm namespace


Index: llvm/lib/Support/ValueHolder.cpp
diff -u llvm/lib/Support/ValueHolder.cpp:1.3 llvm/lib/Support/ValueHolder.cpp:1.4
--- llvm/lib/Support/ValueHolder.cpp:1.3	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Support/ValueHolder.cpp	Sun Dec 14 15:35:53 2003
@@ -18,10 +18,8 @@
 #include "llvm/Support/ValueHolder.h"
 #include "llvm/Type.h"
 
-namespace llvm {
+using namespace llvm;
 
 ValueHolder::ValueHolder(Value *V) : User(Type::TypeTy, Value::TypeVal) {
   Operands.push_back(Use(V, this));
 }
-
-} // End llvm namespace





More information about the llvm-commits mailing list