[lld] r219727 - Use isa<> and cast<> instead of definition().

Rui Ueyama ruiu at google.com
Tue Oct 14 14:42:09 PDT 2014


Author: ruiu
Date: Tue Oct 14 16:42:08 2014
New Revision: 219727

URL: http://llvm.org/viewvc/llvm-project?rev=219727&view=rev
Log:
Use isa<> and cast<> instead of definition().

No functionality change intended.

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=219727&r1=219726&r2=219727&view=diff
==============================================================================
--- lld/trunk/lib/Core/SymbolTable.cpp (original)
+++ lld/trunk/lib/Core/SymbolTable.cpp Tue Oct 14 16:42:08 2014
@@ -190,10 +190,8 @@ bool SymbolTable::addByName(const Atom &
     useNew = true;
     break;
   case NCR_DupDef:
-    assert(existing->definition() == Atom::definitionRegular);
-    assert(newAtom.definition() == Atom::definitionRegular);
-    switch (mergeSelect(((DefinedAtom*)existing)->merge(),
-                        ((DefinedAtom*)&newAtom)->merge())) {
+    switch (mergeSelect(cast<DefinedAtom>(existing)->merge(),
+                        cast<DefinedAtom>(&newAtom)->merge())) {
     case MCR_First:
       useNew = false;
       break;
@@ -371,7 +369,7 @@ const Atom *SymbolTable::findByName(Stri
 
 bool SymbolTable::isDefined(StringRef sym) {
   if (const Atom *atom = findByName(sym))
-    return atom->definition() != Atom::definitionUndefined;
+    return !isa<UndefinedAtom>(atom);
   return false;
 }
 





More information about the llvm-commits mailing list