[lld] r303775 - Change the control flow so that the function is a bit more readable. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 10:12:10 PDT 2017


Author: ruiu
Date: Wed May 24 12:12:10 2017
New Revision: 303775

URL: http://llvm.org/viewvc/llvm-project?rev=303775&view=rev
Log:
Change the control flow so that the function is a bit more readable. NFC.

Modified:
    lld/trunk/COFF/InputFiles.cpp

Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=303775&r1=303774&r2=303775&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Wed May 24 12:12:10 2017
@@ -48,13 +48,11 @@ namespace coff {
 /// alias to Target.
 static void checkAndSetWeakAlias(SymbolTable *Symtab, InputFile *F,
                                  SymbolBody *Source, SymbolBody *Target) {
-  auto *U = dyn_cast<Undefined>(Source);
-  if (!U)
-    return;
-  else if (!U->WeakAlias)
+  if (auto *U = dyn_cast<Undefined>(Source)) {
+    if (U->WeakAlias && U->WeakAlias != Target)
+      Symtab->reportDuplicate(Source->symbol(), F);
     U->WeakAlias = Target;
-  else if (U->WeakAlias != Target)
-    Symtab->reportDuplicate(Source->symbol(), F);
+  }
 }
 
 ArchiveFile::ArchiveFile(MemoryBufferRef M) : InputFile(ArchiveKind, M) {}




More information about the llvm-commits mailing list