useNew is set to false in all branches, so set it to false outside the if-else.
authorRui Ueyama <ruiu@google.com>
Fri, 4 Apr 2014 18:21:53 +0000 (18:21 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 4 Apr 2014 18:21:53 +0000 (18:21 +0000)
llvm-svn: 205642

lld/lib/Core/SymbolTable.cpp

index aa35c15..cb0ff75 100644 (file)
@@ -265,28 +265,22 @@ void SymbolTable::addByName(const Atom &newAtom) {
     bool sameNullness =
         (curShLib->canBeNullAtRuntime() == newShLib->canBeNullAtRuntime());
     bool sameName = curShLib->loadName().equals(newShLib->loadName());
-    if (!sameName) {
-      useNew = false;
-      if (_context.warnIfCoalesableAtomsHaveDifferentLoadName()) {
-        // FIXME: need diagonstics interface for writing warning messages
-        llvm::errs() << "lld warning: shared library symbol "
-                     << curShLib->name() << " has different load path in "
-                     << curShLib->file().path() << " and in "
-                     << newShLib->file().path();
-      }
-    } else if (!sameNullness) {
-      useNew = false;
-      if (_context.warnIfCoalesableAtomsHaveDifferentCanBeNull()) {
-        // FIXME: need diagonstics interface for writing warning messages
-        llvm::errs() << "lld warning: shared library symbol "
-                     << curShLib->name() << " has different weakness in "
-                     << curShLib->file().path() << " and in "
-                     << newShLib->file().path();
-      }
-    } else {
-      // Both shlib atoms are identical and can be coalesced.
-      useNew = false;
+    if (sameName && !sameNullness &&
+        _context.warnIfCoalesableAtomsHaveDifferentCanBeNull()) {
+      // FIXME: need diagonstics interface for writing warning messages
+      llvm::errs() << "lld warning: shared library symbol "
+                   << curShLib->name() << " has different weakness in "
+                   << curShLib->file().path() << " and in "
+                   << newShLib->file().path();
     }
+    if (!sameName && _context.warnIfCoalesableAtomsHaveDifferentLoadName()) {
+      // FIXME: need diagonstics interface for writing warning messages
+      llvm::errs() << "lld warning: shared library symbol "
+                   << curShLib->name() << " has different load path in "
+                   << curShLib->file().path() << " and in "
+                   << newShLib->file().path();
+    }
+    useNew = false;
     break;
   }
   case NCR_Error: