[lld] r205641 - Replace dyn_cast<T>s immediately followed by asserts with cast<T>s.

Rui Ueyama ruiu at google.com
Fri Apr 4 11:21:51 PDT 2014


Author: ruiu
Date: Fri Apr  4 13:21:51 2014
New Revision: 205641

URL: http://llvm.org/viewvc/llvm-project?rev=205641&view=rev
Log:
Replace dyn_cast<T>s immediately followed by asserts with cast<T>s.

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

Modified: lld/trunk/lib/Core/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/SymbolTable.cpp?rev=205641&r1=205640&r2=205641&view=diff
==============================================================================
--- lld/trunk/lib/Core/SymbolTable.cpp (original)
+++ lld/trunk/lib/Core/SymbolTable.cpp Fri Apr  4 13:21:51 2014
@@ -225,10 +225,8 @@ void SymbolTable::addByName(const Atom &
     }
     break;
   case NCR_DupUndef: {
-    const UndefinedAtom* existingUndef = dyn_cast<UndefinedAtom>(existing);
-    const UndefinedAtom* newUndef = dyn_cast<UndefinedAtom>(&newAtom);
-    assert(existingUndef != nullptr);
-    assert(newUndef != nullptr);
+    const UndefinedAtom* existingUndef = cast<UndefinedAtom>(existing);
+    const UndefinedAtom* newUndef = cast<UndefinedAtom>(&newAtom);
 
     bool sameCanBeNull = (existingUndef->canBeNull() == newUndef->canBeNull());
     if (!sameCanBeNull &&
@@ -262,10 +260,8 @@ void SymbolTable::addByName(const Atom &
     break;
   }
   case NCR_DupShLib: {
-    const SharedLibraryAtom *curShLib = dyn_cast<SharedLibraryAtom>(existing);
-    const SharedLibraryAtom *newShLib = dyn_cast<SharedLibraryAtom>(&newAtom);
-    assert(curShLib != nullptr);
-    assert(newShLib != nullptr);
+    const SharedLibraryAtom *curShLib = cast<SharedLibraryAtom>(existing);
+    const SharedLibraryAtom *newShLib = cast<SharedLibraryAtom>(&newAtom);
     bool sameNullness =
         (curShLib->canBeNullAtRuntime() == newShLib->canBeNullAtRuntime());
     bool sameName = curShLib->loadName().equals(newShLib->loadName());
@@ -330,7 +326,6 @@ bool SymbolTable::AtomMappingInfo::isEqu
     return false;
   if (r == getTombstoneKey())
     return false;
-
   if (l->contentType() != r->contentType())
     return false;
   if (l->size() != r->size())





More information about the llvm-commits mailing list