[lld] r231403 - Early return. NFC.

Rui Ueyama ruiu at google.com
Thu Mar 5 12:22:15 PST 2015


Author: ruiu
Date: Thu Mar  5 14:22:14 2015
New Revision: 231403

URL: http://llvm.org/viewvc/llvm-project?rev=231403&view=rev
Log:
Early return. NFC.

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

Modified: lld/trunk/lib/Core/Resolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Resolver.cpp?rev=231403&r1=231402&r2=231403&view=diff
==============================================================================
--- lld/trunk/lib/Core/Resolver.cpp (original)
+++ lld/trunk/lib/Core/Resolver.cpp Thu Mar  5 14:22:14 2015
@@ -441,39 +441,38 @@ bool Resolver::checkUndefines() {
         undefinedAtoms.end());
   }
 
-  // error message about missing symbols
-  if (!undefinedAtoms.empty()) {
-    // FIXME: need diagnostics interface for writing error messages
-    bool foundUndefines = false;
-    for (const UndefinedAtom *undef : undefinedAtoms) {
-      // Skip over a weak symbol.
-      if (undef->canBeNull() != UndefinedAtom::canBeNullNever)
-        continue;
-
-      // If this is a library and undefined symbols are allowed on the
-      // target platform, skip over it.
-      if (isa<SharedLibraryFile>(undef->file()) && _ctx.allowShlibUndefines())
-        continue;
-
-      // If the undefine is coalesced away, skip over it.
-      if (_symbolTable.isCoalescedAway(undef))
-        continue;
-
-      // Seems like this symbol is undefined. Warn that.
-      foundUndefines = true;
-      if (_ctx.printRemainingUndefines()) {
-        llvm::errs() << "Undefined symbol: " << undef->file().path()
-                     << ": " << _ctx.demangle(undef->name())
-                     << "\n";
-      }
-    }
-    if (foundUndefines) {
-      if (_ctx.printRemainingUndefines())
-        llvm::errs() << "symbol(s) not found\n";
-      return true;
+  if (undefinedAtoms.empty())
+    return false;
+
+  // Warn about unresolved symbols.
+  bool foundUndefines = false;
+  for (const UndefinedAtom *undef : undefinedAtoms) {
+    // Skip over a weak symbol.
+    if (undef->canBeNull() != UndefinedAtom::canBeNullNever)
+      continue;
+
+    // If this is a library and undefined symbols are allowed on the
+    // target platform, skip over it.
+    if (isa<SharedLibraryFile>(undef->file()) && _ctx.allowShlibUndefines())
+      continue;
+
+    // If the undefine is coalesced away, skip over it.
+    if (_symbolTable.isCoalescedAway(undef))
+      continue;
+
+    // Seems like this symbol is undefined. Warn that.
+    foundUndefines = true;
+    if (_ctx.printRemainingUndefines()) {
+      llvm::errs() << "Undefined symbol: " << undef->file().path()
+                   << ": " << _ctx.demangle(undef->name())
+                   << "\n";
     }
   }
-  return false;
+  if (!foundUndefines)
+    return false;
+  if (_ctx.printRemainingUndefines())
+    llvm::errs() << "symbol(s) not found\n";
+  return true;
 }
 
 // remove from _atoms all coaleseced away atoms





More information about the llvm-commits mailing list