mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
Made code more terse:
* Deleted empty comment lines * No single begin-braces '{' on a line by themselves git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8773 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f478556740
commit
61087cc023
@ -61,8 +61,7 @@ static inline bool FileExists(const std::string &FN) {
|
|||||||
// TRUE - The file is an archive.
|
// TRUE - The file is an archive.
|
||||||
// FALSE - The file is not an archive.
|
// FALSE - The file is not an archive.
|
||||||
//
|
//
|
||||||
static inline bool IsArchive(const std::string &filename)
|
static inline bool IsArchive(const std::string &filename) {
|
||||||
{
|
|
||||||
std::string ArchiveMagic("!<arch>\012");
|
std::string ArchiveMagic("!<arch>\012");
|
||||||
char buf[1 + ArchiveMagic.size()];
|
char buf[1 + ArchiveMagic.size()];
|
||||||
std::ifstream f(filename.c_str());
|
std::ifstream f(filename.c_str());
|
||||||
@ -90,8 +89,7 @@ static inline bool IsArchive(const std::string &filename)
|
|||||||
// If the file is not found, an empty string is returned.
|
// If the file is not found, an empty string is returned.
|
||||||
//
|
//
|
||||||
static std::string
|
static std::string
|
||||||
FindLib(const std::string &Filename, const std::vector<std::string> &Paths)
|
FindLib(const std::string &Filename, const std::vector<std::string> &Paths) {
|
||||||
{
|
|
||||||
// Determine if the pathname can be found as it stands.
|
// Determine if the pathname can be found as it stands.
|
||||||
if (FileExists(Filename))
|
if (FileExists(Filename))
|
||||||
return Filename;
|
return Filename;
|
||||||
@ -142,9 +140,7 @@ FindLib(const std::string &Filename, const std::vector<std::string> &Paths)
|
|||||||
// Return value:
|
// Return value:
|
||||||
// None.
|
// None.
|
||||||
//
|
//
|
||||||
void
|
void GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
||||||
GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols)
|
|
||||||
{
|
|
||||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||||
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
||||||
DefinedSymbols.insert(I->getName());
|
DefinedSymbols.insert(I->getName());
|
||||||
@ -173,8 +169,7 @@ GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols)
|
|||||||
// None.
|
// None.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols)
|
GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
||||||
{
|
|
||||||
std::set<std::string> DefinedSymbols;
|
std::set<std::string> DefinedSymbols;
|
||||||
UndefinedSymbols.clear(); // Start out empty
|
UndefinedSymbols.clear(); // Start out empty
|
||||||
|
|
||||||
@ -253,11 +248,9 @@ static bool LinkInArchive(Module *M,
|
|||||||
std::string &ErrorMessage,
|
std::string &ErrorMessage,
|
||||||
bool Verbose)
|
bool Verbose)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Find all of the symbols currently undefined in the bytecode program.
|
// Find all of the symbols currently undefined in the bytecode program.
|
||||||
// If all the symbols are defined, the program is complete, and there is
|
// If all the symbols are defined, the program is complete, and there is
|
||||||
// no reason to link in any archive files.
|
// no reason to link in any archive files.
|
||||||
//
|
|
||||||
std::set<std::string> UndefinedSymbols;
|
std::set<std::string> UndefinedSymbols;
|
||||||
GetAllUndefinedSymbols(M, UndefinedSymbols);
|
GetAllUndefinedSymbols(M, UndefinedSymbols);
|
||||||
if (UndefinedSymbols.empty()) {
|
if (UndefinedSymbols.empty()) {
|
||||||
@ -265,17 +258,13 @@ static bool LinkInArchive(Module *M,
|
|||||||
return false; // No need to link anything in!
|
return false; // No need to link anything in!
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Load in the archive objects.
|
// Load in the archive objects.
|
||||||
//
|
|
||||||
if (Verbose) std::cerr << " Loading '" << Filename << "'\n";
|
if (Verbose) std::cerr << " Loading '" << Filename << "'\n";
|
||||||
std::vector<Module*> Objects;
|
std::vector<Module*> Objects;
|
||||||
if (ReadArchiveFile(Filename, Objects, &ErrorMessage))
|
if (ReadArchiveFile(Filename, Objects, &ErrorMessage))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//
|
|
||||||
// Figure out which symbols are defined by all of the modules in the archive.
|
// Figure out which symbols are defined by all of the modules in the archive.
|
||||||
//
|
|
||||||
std::vector<std::set<std::string> > DefinedSymbols;
|
std::vector<std::set<std::string> > DefinedSymbols;
|
||||||
DefinedSymbols.resize(Objects.size());
|
DefinedSymbols.resize(Objects.size());
|
||||||
for (unsigned i = 0; i != Objects.size(); ++i) {
|
for (unsigned i = 0; i != Objects.size(); ++i) {
|
||||||
|
@ -61,8 +61,7 @@ static inline bool FileExists(const std::string &FN) {
|
|||||||
// TRUE - The file is an archive.
|
// TRUE - The file is an archive.
|
||||||
// FALSE - The file is not an archive.
|
// FALSE - The file is not an archive.
|
||||||
//
|
//
|
||||||
static inline bool IsArchive(const std::string &filename)
|
static inline bool IsArchive(const std::string &filename) {
|
||||||
{
|
|
||||||
std::string ArchiveMagic("!<arch>\012");
|
std::string ArchiveMagic("!<arch>\012");
|
||||||
char buf[1 + ArchiveMagic.size()];
|
char buf[1 + ArchiveMagic.size()];
|
||||||
std::ifstream f(filename.c_str());
|
std::ifstream f(filename.c_str());
|
||||||
@ -90,8 +89,7 @@ static inline bool IsArchive(const std::string &filename)
|
|||||||
// If the file is not found, an empty string is returned.
|
// If the file is not found, an empty string is returned.
|
||||||
//
|
//
|
||||||
static std::string
|
static std::string
|
||||||
FindLib(const std::string &Filename, const std::vector<std::string> &Paths)
|
FindLib(const std::string &Filename, const std::vector<std::string> &Paths) {
|
||||||
{
|
|
||||||
// Determine if the pathname can be found as it stands.
|
// Determine if the pathname can be found as it stands.
|
||||||
if (FileExists(Filename))
|
if (FileExists(Filename))
|
||||||
return Filename;
|
return Filename;
|
||||||
@ -142,9 +140,7 @@ FindLib(const std::string &Filename, const std::vector<std::string> &Paths)
|
|||||||
// Return value:
|
// Return value:
|
||||||
// None.
|
// None.
|
||||||
//
|
//
|
||||||
void
|
void GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
||||||
GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols)
|
|
||||||
{
|
|
||||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||||
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
||||||
DefinedSymbols.insert(I->getName());
|
DefinedSymbols.insert(I->getName());
|
||||||
@ -173,8 +169,7 @@ GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols)
|
|||||||
// None.
|
// None.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols)
|
GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
||||||
{
|
|
||||||
std::set<std::string> DefinedSymbols;
|
std::set<std::string> DefinedSymbols;
|
||||||
UndefinedSymbols.clear(); // Start out empty
|
UndefinedSymbols.clear(); // Start out empty
|
||||||
|
|
||||||
@ -253,11 +248,9 @@ static bool LinkInArchive(Module *M,
|
|||||||
std::string &ErrorMessage,
|
std::string &ErrorMessage,
|
||||||
bool Verbose)
|
bool Verbose)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Find all of the symbols currently undefined in the bytecode program.
|
// Find all of the symbols currently undefined in the bytecode program.
|
||||||
// If all the symbols are defined, the program is complete, and there is
|
// If all the symbols are defined, the program is complete, and there is
|
||||||
// no reason to link in any archive files.
|
// no reason to link in any archive files.
|
||||||
//
|
|
||||||
std::set<std::string> UndefinedSymbols;
|
std::set<std::string> UndefinedSymbols;
|
||||||
GetAllUndefinedSymbols(M, UndefinedSymbols);
|
GetAllUndefinedSymbols(M, UndefinedSymbols);
|
||||||
if (UndefinedSymbols.empty()) {
|
if (UndefinedSymbols.empty()) {
|
||||||
@ -265,17 +258,13 @@ static bool LinkInArchive(Module *M,
|
|||||||
return false; // No need to link anything in!
|
return false; // No need to link anything in!
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Load in the archive objects.
|
// Load in the archive objects.
|
||||||
//
|
|
||||||
if (Verbose) std::cerr << " Loading '" << Filename << "'\n";
|
if (Verbose) std::cerr << " Loading '" << Filename << "'\n";
|
||||||
std::vector<Module*> Objects;
|
std::vector<Module*> Objects;
|
||||||
if (ReadArchiveFile(Filename, Objects, &ErrorMessage))
|
if (ReadArchiveFile(Filename, Objects, &ErrorMessage))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//
|
|
||||||
// Figure out which symbols are defined by all of the modules in the archive.
|
// Figure out which symbols are defined by all of the modules in the archive.
|
||||||
//
|
|
||||||
std::vector<std::set<std::string> > DefinedSymbols;
|
std::vector<std::set<std::string> > DefinedSymbols;
|
||||||
DefinedSymbols.resize(Objects.size());
|
DefinedSymbols.resize(Objects.size());
|
||||||
for (unsigned i = 0; i != Objects.size(); ++i) {
|
for (unsigned i = 0; i != Objects.size(); ++i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user