[lld] r230814 - Do s/_context/_ctx/ to Resolver.cpp.

Rui Ueyama ruiu at google.com
Fri Feb 27 15:40:01 PST 2015


Author: ruiu
Date: Fri Feb 27 17:40:00 2015
New Revision: 230814

URL: http://llvm.org/viewvc/llvm-project?rev=230814&view=rev
Log:
Do s/_context/_ctx/ to Resolver.cpp.

Modified:
    lld/trunk/include/lld/Core/Resolver.h
    lld/trunk/lib/Core/Resolver.cpp

Modified: lld/trunk/include/lld/Core/Resolver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Resolver.h?rev=230814&r1=230813&r2=230814&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Resolver.h (original)
+++ lld/trunk/include/lld/Core/Resolver.h Fri Feb 27 17:40:00 2015
@@ -29,8 +29,8 @@ class LinkingContext;
 /// and producing a merged graph.
 class Resolver {
 public:
-  Resolver(LinkingContext &context)
-      : _context(context), _symbolTable(context), _result(new MergedFile()),
+  Resolver(LinkingContext &ctx)
+      : _ctx(ctx), _symbolTable(ctx), _result(new MergedFile()),
         _fileIndex(0) {}
 
   // InputFiles::Handler methods
@@ -83,7 +83,7 @@ private:
     void addAtoms(std::vector<const Atom*>& atoms);
   };
 
-  LinkingContext &_context;
+  LinkingContext &_ctx;
   SymbolTable _symbolTable;
   std::vector<const Atom *>     _atoms;
   std::set<const Atom *>        _deadStripRoots;

Modified: lld/trunk/lib/Core/Resolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Resolver.cpp?rev=230814&r1=230813&r2=230814&view=diff
==============================================================================
--- lld/trunk/lib/Core/Resolver.cpp (original)
+++ lld/trunk/lib/Core/Resolver.cpp Fri Feb 27 17:40:00 2015
@@ -73,12 +73,12 @@ void Resolver::forEachUndefines(bool sea
 bool Resolver::handleArchiveFile(const File &file) {
   const ArchiveLibraryFile *archiveFile = cast<ArchiveLibraryFile>(&file);
   bool searchForOverrides =
-      _context.searchArchivesToOverrideTentativeDefinitions();
+      _ctx.searchArchivesToOverrideTentativeDefinitions();
   bool undefAdded = false;
   forEachUndefines(searchForOverrides,
                    [&](StringRef undefName, bool dataSymbolOnly) {
     if (const File *member = archiveFile->find(undefName, dataSymbolOnly)) {
-      member->setOrdinal(_context.getNextOrdinalAndIncrement());
+      member->setOrdinal(_ctx.getNextOrdinalAndIncrement());
       const_cast<File *>(member)->beforeLink();
       undefAdded = handleFile(*member) || undefAdded;
     }
@@ -91,7 +91,7 @@ void Resolver::handleSharedLibrary(const
   const SharedLibraryFile *sharedLibrary = cast<SharedLibraryFile>(&file);
   handleFile(*sharedLibrary);
   bool searchForOverrides =
-      _context.searchSharedLibrariesToOverrideTentativeDefinitions();
+      _ctx.searchSharedLibrariesToOverrideTentativeDefinitions();
   forEachUndefines(searchForOverrides,
                    [&](StringRef undefName, bool dataSymbolOnly) {
     if (const SharedLibraryAtom *atom =
@@ -131,7 +131,7 @@ void Resolver::maybeAddSectionGroupOrGnu
 
   if (!isFirstTime) {
     // If duplicate symbols are allowed, select the first group.
-    if (_context.getAllowDuplicates())
+    if (_ctx.getAllowDuplicates())
       return;
     auto *prevGroup = dyn_cast<DefinedAtom>(_symbolTable.findGroup(atom.name()));
     assert(prevGroup &&
@@ -188,7 +188,7 @@ void Resolver::doDefinedAtom(const Defin
   }
 
   // An atom that should never be dead-stripped is a dead-strip root.
-  if (_context.deadStrip() && atom.deadStrip() == DefinedAtom::deadStripNever) {
+  if (_ctx.deadStrip() && atom.deadStrip() == DefinedAtom::deadStripNever) {
     _deadStripRoots.insert(&atom);
   }
 }
@@ -233,7 +233,7 @@ void Resolver::addAtoms(const std::vecto
 // Returns true if at least one of N previous files has created an
 // undefined symbol.
 bool Resolver::undefinesAdded(int begin, int end) {
-  std::vector<std::unique_ptr<Node>> &inputs = _context.getNodes();
+  std::vector<std::unique_ptr<Node>> &inputs = _ctx.getNodes();
   for (int i = begin; i < end; ++i)
     if (FileNode *node = dyn_cast<FileNode>(inputs[i].get()))
       if (_newUndefinesAdded[node->getFile()])
@@ -242,7 +242,7 @@ bool Resolver::undefinesAdded(int begin,
 }
 
 File *Resolver::getFile(int &index) {
-  std::vector<std::unique_ptr<Node>> &inputs = _context.getNodes();
+  std::vector<std::unique_ptr<Node>> &inputs = _ctx.getNodes();
   if ((size_t)index >= inputs.size())
     return nullptr;
   if (GroupEnd *group = dyn_cast<GroupEnd>(inputs[index].get())) {
@@ -262,7 +262,7 @@ File *Resolver::getFile(int &index) {
 
 // Make a map of Symbol -> ArchiveFile.
 void Resolver::makePreloadArchiveMap() {
-  std::vector<std::unique_ptr<Node>> &nodes = _context.getNodes();
+  std::vector<std::unique_ptr<Node>> &nodes = _ctx.getNodes();
   for (int i = nodes.size() - 1; i >= 0; --i)
     if (auto *fnode = dyn_cast<FileNode>(nodes[i].get()))
       if (auto *archive = dyn_cast<ArchiveLibraryFile>(fnode->getFile()))
@@ -270,7 +270,7 @@ void Resolver::makePreloadArchiveMap() {
           _archiveMap[sym] = archive;
 }
 
-// Keep adding atoms until _context.getNextFile() returns an error. This
+// Keep adding atoms until _ctx.getNextFile() returns an error. This
 // function is where undefined atoms are resolved.
 bool Resolver::resolveUndefines() {
   ScopedTask task(getDefaultDomain(), "resolveUndefines");
@@ -296,17 +296,17 @@ bool Resolver::resolveUndefines() {
         break;
       seen.insert(file);
       assert(!file->hasOrdinal());
-      file->setOrdinal(_context.getNextOrdinalAndIncrement());
+      file->setOrdinal(_ctx.getNextOrdinalAndIncrement());
       undefAdded = handleFile(*file);
       break;
     case File::kindArchiveLibrary:
       if (!file->hasOrdinal())
-        file->setOrdinal(_context.getNextOrdinalAndIncrement());
+        file->setOrdinal(_ctx.getNextOrdinalAndIncrement());
       undefAdded = handleArchiveFile(*file);
       break;
     case File::kindSharedLibrary:
       if (!file->hasOrdinal())
-        file->setOrdinal(_context.getNextOrdinalAndIncrement());
+        file->setOrdinal(_ctx.getNextOrdinalAndIncrement());
       handleSharedLibrary(*file);
       break;
     }
@@ -365,7 +365,7 @@ static bool isBackref(const Reference *r
 void Resolver::deadStripOptimize() {
   ScopedTask task(getDefaultDomain(), "deadStripOptimize");
   // only do this optimization with -dead_strip
-  if (!_context.deadStrip())
+  if (!_ctx.deadStrip())
     return;
 
   // Some type of references prevent referring atoms to be dead-striped.
@@ -382,14 +382,14 @@ void Resolver::deadStripOptimize() {
   }
 
   // By default, shared libraries are built with all globals as dead strip roots
-  if (_context.globalsAreDeadStripRoots())
+  if (_ctx.globalsAreDeadStripRoots())
     for (const Atom *atom : _atoms)
       if (const DefinedAtom *defAtom = dyn_cast<DefinedAtom>(atom))
         if (defAtom->scope() == DefinedAtom::scopeGlobal)
           _deadStripRoots.insert(defAtom);
 
   // Or, use list of names that are dead strip roots.
-  for (const StringRef &name : _context.deadStripRoots()) {
+  for (const StringRef &name : _ctx.deadStripRoots()) {
     const Atom *symAtom = _symbolTable.findByName(name);
     assert(symAtom);
     _deadStripRoots.insert(symAtom);
@@ -410,7 +410,7 @@ void Resolver::deadStripOptimize() {
 bool Resolver::checkUndefines() {
   // build vector of remaining undefined symbols
   std::vector<const UndefinedAtom *> undefinedAtoms = _symbolTable.undefines();
-  if (_context.deadStrip()) {
+  if (_ctx.deadStrip()) {
     // When dead code stripping, we don't care if dead atoms are undefined.
     undefinedAtoms.erase(
         std::remove_if(undefinedAtoms.begin(), undefinedAtoms.end(),
@@ -429,8 +429,7 @@ bool Resolver::checkUndefines() {
 
       // If this is a library and undefined symbols are allowed on the
       // target platform, skip over it.
-      if (isa<SharedLibraryFile>(undef->file()) &&
-          _context.allowShlibUndefines())
+      if (isa<SharedLibraryFile>(undef->file()) && _ctx.allowShlibUndefines())
         continue;
 
       // If the undefine is coalesced away, skip over it.
@@ -439,14 +438,14 @@ bool Resolver::checkUndefines() {
 
       // Seems like this symbol is undefined. Warn that.
       foundUndefines = true;
-      if (_context.printRemainingUndefines()) {
+      if (_ctx.printRemainingUndefines()) {
         llvm::errs() << "Undefined symbol: " << undef->file().path()
-                     << ": " << _context.demangle(undef->name())
+                     << ": " << _ctx.demangle(undef->name())
                      << "\n";
       }
     }
     if (foundUndefines) {
-      if (_context.printRemainingUndefines())
+      if (_ctx.printRemainingUndefines())
         llvm::errs() << "symbol(s) not found\n";
       return true;
     }
@@ -470,7 +469,7 @@ bool Resolver::resolve() {
   updateReferences();
   deadStripOptimize();
   if (checkUndefines())
-    if (!_context.allowRemainingUndefines())
+    if (!_ctx.allowRemainingUndefines())
       return false;
   removeCoalescedAwayAtoms();
   _result->addAtoms(_atoms);





More information about the llvm-commits mailing list