llvm.org GIT mirror llvm / 83a113b
Fix Whitespace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123152 91177308-0d34-0410-b5e6-96231b3b80d8 Michael J. Spencer 8 years ago
3 changed file(s) with 31 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
165165 delete mapfile;
166166 mapfile = 0;
167167 base = 0;
168
168
169169 // Forget the entire symbol table
170170 symTab.clear();
171171 symTabSize = 0;
172
172
173173 firstFileOffset = 0;
174
174
175175 // Free the foreign symbol table member
176176 if (foreignST) {
177177 delete foreignST;
178178 foreignST = 0;
179179 }
180
180
181181 // Delete any Modules and ArchiveMember's we've allocated as a result of
182182 // symbol table searches.
183183 for (ModuleMap::iterator I=modules.begin(), E=modules.end(); I != E; ++I ) {
199199 if (!GI->isDeclaration() && !GI->hasLocalLinkage())
200200 if (!GI->getName().empty())
201201 symbols.push_back(GI->getName());
202
202
203203 // Loop over functions
204204 for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ++FI)
205205 if (!FI->isDeclaration() && !FI->hasLocalLinkage())
225225 + ec.message();
226226 return true;
227227 }
228
228
229229 Module *M = ParseBitcodeFile(Buffer.get(), Context, ErrMsg);
230230 if (!M)
231231 return true;
232
232
233233 // Get the symbols
234234 getSymbols(M, symbols);
235
235
236236 // Done with the module.
237237 delete M;
238238 return true;
247247 // Get the module.
248248 OwningPtr Buffer(
249249 MemoryBuffer::getMemBufferCopy(StringRef(BufPtr, Length),ModuleID.c_str()));
250
250
251251 Module *M = ParseBitcodeFile(Buffer.get(), Context, ErrMsg);
252252 if (!M)
253253 return 0;
254
254
255255 // Get the symbols
256256 getSymbols(M, symbols);
257
257
258258 // Done with the module. Note that it's the caller's responsibility to delete
259259 // the Module.
260260 return M;
154154 // Insert a file into the archive before some other member. This also takes care
155155 // of extracting the necessary flags and information from the file.
156156 bool
157 Archive::addFileBefore(const sys::Path& filePath, iterator where,
157 Archive::addFileBefore(const sys::Path& filePath, iterator where,
158158 std::string* ErrMsg) {
159159 bool Exists;
160160 if (sys::fs::exists(filePath.str(), Exists) || !Exists) {
231231 std::vector symbols;
232232 std::string FullMemberName = archPath.str() + "(" + member.getPath().str()
233233 + ")";
234 Module* M =
234 Module* M =
235235 GetBitcodeSymbols(data, fSize, FullMemberName, Context, symbols, ErrMsg);
236236
237237 // If the bitcode parsed successfully
420420 }
421421 const char* base = arch->getBufferStart();
422422
423 // Open another temporary file in order to avoid invalidating the
423 // Open another temporary file in order to avoid invalidating the
424424 // mmapped data
425425 if (FinalFilePath.createTemporaryFileOnDisk(ErrMsg))
426426 return true;
461461 // Close up shop
462462 FinalFile.close();
463463 } // free arch.
464
464
465465 // Move the final file over top of TmpArchive
466466 if (FinalFilePath.renamePathOnDisk(TmpArchive, ErrMsg))
467467 return true;
468468 }
469
469
470470 // Before we replace the actual archive, we need to forget all the
471471 // members, since they point to data in that old archive. We need to do
472472 // this because we cannot replace an open file on Windows.
473473 cleanUpMemory();
474
474
475475 if (TmpArchive.renamePathOnDisk(archPath, ErrMsg))
476476 return true;
477477
273273 // finds with all the files in that directory (recursively). It uses the
274274 // sys::Path::getDirectoryContent method to perform the actual directory scans.
275275 bool
276 recurseDirectories(const sys::Path& path,
276 recurseDirectories(const sys::Path& path,
277277 std::set& result, std::string* ErrMsg) {
278278 result.clear();
279279 if (RecurseDirectories) {
379379
380380 // putMode - utility function for printing out the file mode when the 't'
381381 // operation is in verbose mode.
382 void
382 void
383383 printMode(unsigned mode) {
384384 if (mode & 004)
385385 outs() << "r";
399399 // the file names of each of the members. However, if verbose mode is requested
400400 // ('v' modifier) then the file type, permission mode, user, group, size, and
401401 // modification time are also printed.
402 bool
402 bool
403403 doDisplayTable(std::string* ErrMsg) {
404404 if (buildPaths(false, ErrMsg))
405405 return true;
437437
438438 // doExtract - Implement the 'x' operation. This function extracts files back to
439439 // the file system, making sure to uncompress any that were compressed
440 bool
440 bool
441441 doExtract(std::string* ErrMsg) {
442442 if (buildPaths(false, ErrMsg))
443443 return true;
450450 if (I->hasPath()) {
451451 sys::Path dirs(I->getPath());
452452 dirs.eraseComponent();
453 if (dirs.createDirectoryOnDisk(/*create_parents=*/true, ErrMsg))
453 if (dirs.createDirectoryOnDisk(/*create_parents=*/true, ErrMsg))
454454 return true;
455455 }
456456
480480 // members from the archive. Note that if the count is specified, there should
481481 // be no more than one path in the Paths list or else this algorithm breaks.
482482 // That check is enforced in parseCommandLine (above).
483 bool
483 bool
484484 doDelete(std::string* ErrMsg) {
485485 if (buildPaths(false, ErrMsg))
486486 return true;
487 if (Paths.empty())
487 if (Paths.empty())
488488 return false;
489489 unsigned countDown = Count;
490490 for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end();
513513 // order of the archive members so that when the archive is written the move
514514 // of the members is accomplished. Note the use of the RelPos variable to
515515 // determine where the items should be moved to.
516 bool
516 bool
517517 doMove(std::string* ErrMsg) {
518 if (buildPaths(false, ErrMsg))
518 if (buildPaths(false, ErrMsg))
519519 return true;
520520
521521 // By default and convention the place to move members to is the end of the
566566
567567 // doQuickAppend - Implements the 'q' operation. This function just
568568 // indiscriminantly adds the members to the archive and rebuilds it.
569 bool
569 bool
570570 doQuickAppend(std::string* ErrMsg) {
571571 // Get the list of paths to append.
572572 if (buildPaths(true, ErrMsg))
573573 return true;
574 if (Paths.empty())
574 if (Paths.empty())
575575 return false;
576576
577577 // Append them quickly.
591591
592592 // doReplaceOrInsert - Implements the 'r' operation. This function will replace
593593 // any existing files or insert new ones into the archive.
594 bool
594 bool
595595 doReplaceOrInsert(std::string* ErrMsg) {
596596
597597 // Build the list of files to be added/replaced.
598598 if (buildPaths(true, ErrMsg))
599599 return true;
600 if (Paths.empty())
600 if (Paths.empty())
601601 return false;
602602
603603 // Keep track of the paths that remain to be inserted.
637637
638638 if (found != remaining.end()) {
639639 std::string Err;
640 sys::PathWithStatus PwS(*found);
640 sys::PathWithStatus PwS(*found);
641641 const sys::FileStatus *si = PwS.getFileStatus(false, &Err);
642642 if (!si)
643643 return true;