mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-01 00:35:43 +00:00
Finegrainify namespacification
llvm-svn: 10464
This commit is contained in:
parent
30ae898eb7
commit
2fdf5e32aa
@ -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 @@ Annotation *AnnotationManager::createAnnotation(AnnotationID ID,
|
||||
if (I == getFactMap().end()) return 0;
|
||||
return I->second.first(ID, Obj, I->second.second);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -23,8 +23,7 @@
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cerrno>
|
||||
|
||||
namespace llvm {
|
||||
using namespace llvm;
|
||||
|
||||
using namespace cl;
|
||||
|
||||
@ -889,5 +888,3 @@ HHOp("help-hidden", cl::desc("display all available options"),
|
||||
cl::location(HiddenPrinter), cl::Hidden, cl::ValueDisallowed);
|
||||
|
||||
} // End anonymous namespace
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -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::print(std::ostream &OS) const {
|
||||
void ConstantRange::dump() const {
|
||||
print(std::cerr);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -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 @@ namespace {
|
||||
// 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
|
||||
|
@ -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 @@ bool LinkDynamicObject (const char *filename, std::string *ErrorMessage) {
|
||||
#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 @@ void *GetAddressOfSymbol (const char *symbolName) {
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@ -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 @@ bool CheckMagic (const std::string &FN, const std::string &Magic) {
|
||||
/// 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 @@ bool IsArchive(const std::string &FN) {
|
||||
/// 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 @@ bool IsBytecode(const std::string &FN) {
|
||||
/// 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 @@ bool IsSharedObject(const std::string &FN) {
|
||||
/// 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 @@ bool FileOpenable (const std::string &Filename) {
|
||||
/// 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 @@ bool DiffFiles(const std::string &FileA, const std::string &FileB,
|
||||
/// 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 @@ void MoveFileOverIfUpdated(const std::string &New, const std::string &Old) {
|
||||
|
||||
/// 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 @@ void removeFile(const std::string &Filename) {
|
||||
/// 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 @@ static bool AddPermissionsBits (const std::string &Filename, mode_t bits) {
|
||||
/// 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 @@ bool MakeFileExecutable (const std::string &Filename) {
|
||||
/// 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
|
||||
|
@ -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 @@ void LeakDetector::checkForGarbageImpl(const std::string &Message) {
|
||||
Objects = 0; LLVMObjects = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -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 @@ Mangler::Mangler(Module &m, bool addUnderscorePrefix)
|
||||
else
|
||||
FoundNames.insert(I->getName()); // Otherwise, keep track of name
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -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 @@ namespace {
|
||||
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
|
||||
|
@ -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 RETSIGTYPE SignalHandler(int Sig) {
|
||||
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
|
||||
|
@ -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 @@ bool isExecutableFile(const std::string &ExeFileName) {
|
||||
/// 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 @@ static void RedirectFD(const std::string &File, int FD) {
|
||||
/// 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 @@ int RunProgramWithTimeout(const std::string &ProgramPath, const char **Args,
|
||||
//
|
||||
// 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 @@ ExecWait (const char * const old_argv[], const char * const old_envp[])
|
||||
//
|
||||
return 1;
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -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 @@ LLC *AbstractInterpreter::createLLC(const std::string &ProgramPath,
|
||||
//===---------------------------------------------------------------------===//
|
||||
// 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 @@ GCC *GCC::create(const std::string &ProgramPath, std::string &Message) {
|
||||
Message = "Found gcc: " + GCCPath + "\n";
|
||||
return new GCC(GCCPath);
|
||||
}
|
||||
|
||||
} // End llvm namespace
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user