From 9502b804f1103fb86f7f2a369b12c858b508e77d Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 20 Jun 2013 13:00:30 +0000 Subject: Remove remaining bits of the old LLVM specific symtab handling. llvm-svn: 184418 --- llvm/tools/llvm-ar/Archive.cpp | 58 ++---------------------------------------- 1 file changed, 2 insertions(+), 56 deletions(-) (limited to 'llvm/tools/llvm-ar/Archive.cpp') diff --git a/llvm/tools/llvm-ar/Archive.cpp b/llvm/tools/llvm-ar/Archive.cpp index dcb640198ee..cac65cf7706 100644 --- a/llvm/tools/llvm-ar/Archive.cpp +++ b/llvm/tools/llvm-ar/Archive.cpp @@ -141,8 +141,8 @@ bool ArchiveMember::replaceWith(StringRef newFile, std::string* ErrMsg) { // Archive class. Everything else (default,copy) is deprecated. This just // initializes and maps the file into memory, if requested. Archive::Archive(StringRef filename, LLVMContext &C) - : archPath(filename), members(), mapfile(0), base(0), symTab(), strtab(), - symTabSize(0), firstFileOffset(0), modules(), foreignST(0), Context(C) {} + : archPath(filename), members(), mapfile(0), base(0), strtab(), + firstFileOffset(0), modules(), Context(C) {} bool Archive::mapToMemory(std::string* ErrMsg) { @@ -163,18 +163,8 @@ void Archive::cleanUpMemory() { mapfile = 0; base = 0; - // Forget the entire symbol table - symTab.clear(); - symTabSize = 0; - firstFileOffset = 0; - // Free the foreign symbol table member - if (foreignST) { - delete foreignST; - foreignST = 0; - } - // Delete any Modules and ArchiveMember's we've allocated as a result of // symbol table searches. for (ModuleMap::iterator I=modules.begin(), E=modules.end(); I != E; ++I ) { @@ -188,47 +178,3 @@ Archive::~Archive() { cleanUpMemory(); } - - -static void getSymbols(Module*M, std::vector& symbols) { - // Loop over global variables - for (Module::global_iterator GI = M->global_begin(), GE=M->global_end(); GI != GE; ++GI) - if (!GI->isDeclaration() && !GI->hasLocalLinkage()) - if (!GI->getName().empty()) - symbols.push_back(GI->getName()); - - // Loop over functions - for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ++FI) - if (!FI->isDeclaration() && !FI->hasLocalLinkage()) - if (!FI->getName().empty()) - symbols.push_back(FI->getName()); - - // Loop over aliases - for (Module::alias_iterator AI = M->alias_begin(), AE = M->alias_end(); - AI != AE; ++AI) { - if (AI->hasName()) - symbols.push_back(AI->getName()); - } -} - -Module* -llvm::GetBitcodeSymbols(const char *BufPtr, unsigned Length, - const std::string& ModuleID, - LLVMContext& Context, - std::vector& symbols, - std::string* ErrMsg) { - // Get the module. - OwningPtr Buffer( - MemoryBuffer::getMemBufferCopy(StringRef(BufPtr, Length),ModuleID.c_str())); - - Module *M = ParseBitcodeFile(Buffer.get(), Context, ErrMsg); - if (!M) - return 0; - - // Get the symbols - getSymbols(M, symbols); - - // Done with the module. Note that it's the caller's responsibility to delete - // the Module. - return M; -} -- cgit v1.2.3