From 61087cc023128946e50deeb544f88c78ea96fda7 Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Tue, 30 Sep 2003 17:51:20 +0000 Subject: [PATCH] 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 --- lib/Linker/LinkArchives.cpp | 19 ++++--------------- tools/gccld/Linker.cpp | 19 ++++--------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/lib/Linker/LinkArchives.cpp b/lib/Linker/LinkArchives.cpp index 34fe2f12456..4c4fd6edaef 100644 --- a/lib/Linker/LinkArchives.cpp +++ b/lib/Linker/LinkArchives.cpp @@ -61,8 +61,7 @@ static inline bool FileExists(const std::string &FN) { // TRUE - The file is 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("!\012"); char buf[1 + ArchiveMagic.size()]; 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. // static std::string -FindLib(const std::string &Filename, const std::vector &Paths) -{ +FindLib(const std::string &Filename, const std::vector &Paths) { // Determine if the pathname can be found as it stands. if (FileExists(Filename)) return Filename; @@ -142,9 +140,7 @@ FindLib(const std::string &Filename, const std::vector &Paths) // Return value: // None. // -void -GetAllDefinedSymbols(Module *M, std::set &DefinedSymbols) -{ +void GetAllDefinedSymbols(Module *M, std::set &DefinedSymbols) { for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage()) DefinedSymbols.insert(I->getName()); @@ -173,8 +169,7 @@ GetAllDefinedSymbols(Module *M, std::set &DefinedSymbols) // None. // void -GetAllUndefinedSymbols(Module *M, std::set &UndefinedSymbols) -{ +GetAllUndefinedSymbols(Module *M, std::set &UndefinedSymbols) { std::set DefinedSymbols; UndefinedSymbols.clear(); // Start out empty @@ -253,11 +248,9 @@ static bool LinkInArchive(Module *M, std::string &ErrorMessage, bool Verbose) { - // // Find all of the symbols currently undefined in the bytecode program. // If all the symbols are defined, the program is complete, and there is // no reason to link in any archive files. - // std::set UndefinedSymbols; GetAllUndefinedSymbols(M, UndefinedSymbols); if (UndefinedSymbols.empty()) { @@ -265,17 +258,13 @@ static bool LinkInArchive(Module *M, return false; // No need to link anything in! } - // // Load in the archive objects. - // if (Verbose) std::cerr << " Loading '" << Filename << "'\n"; std::vector Objects; if (ReadArchiveFile(Filename, Objects, &ErrorMessage)) return true; - // // Figure out which symbols are defined by all of the modules in the archive. - // std::vector > DefinedSymbols; DefinedSymbols.resize(Objects.size()); for (unsigned i = 0; i != Objects.size(); ++i) { diff --git a/tools/gccld/Linker.cpp b/tools/gccld/Linker.cpp index 34fe2f12456..4c4fd6edaef 100644 --- a/tools/gccld/Linker.cpp +++ b/tools/gccld/Linker.cpp @@ -61,8 +61,7 @@ static inline bool FileExists(const std::string &FN) { // TRUE - The file is 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("!\012"); char buf[1 + ArchiveMagic.size()]; 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. // static std::string -FindLib(const std::string &Filename, const std::vector &Paths) -{ +FindLib(const std::string &Filename, const std::vector &Paths) { // Determine if the pathname can be found as it stands. if (FileExists(Filename)) return Filename; @@ -142,9 +140,7 @@ FindLib(const std::string &Filename, const std::vector &Paths) // Return value: // None. // -void -GetAllDefinedSymbols(Module *M, std::set &DefinedSymbols) -{ +void GetAllDefinedSymbols(Module *M, std::set &DefinedSymbols) { for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage()) DefinedSymbols.insert(I->getName()); @@ -173,8 +169,7 @@ GetAllDefinedSymbols(Module *M, std::set &DefinedSymbols) // None. // void -GetAllUndefinedSymbols(Module *M, std::set &UndefinedSymbols) -{ +GetAllUndefinedSymbols(Module *M, std::set &UndefinedSymbols) { std::set DefinedSymbols; UndefinedSymbols.clear(); // Start out empty @@ -253,11 +248,9 @@ static bool LinkInArchive(Module *M, std::string &ErrorMessage, bool Verbose) { - // // Find all of the symbols currently undefined in the bytecode program. // If all the symbols are defined, the program is complete, and there is // no reason to link in any archive files. - // std::set UndefinedSymbols; GetAllUndefinedSymbols(M, UndefinedSymbols); if (UndefinedSymbols.empty()) { @@ -265,17 +258,13 @@ static bool LinkInArchive(Module *M, return false; // No need to link anything in! } - // // Load in the archive objects. - // if (Verbose) std::cerr << " Loading '" << Filename << "'\n"; std::vector Objects; if (ReadArchiveFile(Filename, Objects, &ErrorMessage)) return true; - // // Figure out which symbols are defined by all of the modules in the archive. - // std::vector > DefinedSymbols; DefinedSymbols.resize(Objects.size()); for (unsigned i = 0; i != Objects.size(); ++i) {