Use isa<> instead of checking return value of definition().
authorRui Ueyama <ruiu@google.com>
Tue, 14 Oct 2014 21:20:01 +0000 (21:20 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 14 Oct 2014 21:20:01 +0000 (21:20 +0000)
definition() is supposed to be used through isa, dyn_cast or cast.
It's better to not call that directly.

llvm-svn: 219723

lld/lib/ReaderWriter/MachO/GOTPass.cpp
lld/lib/ReaderWriter/MachO/StubsPass.cpp

index d4cbaf0..d55026a 100644 (file)
@@ -125,7 +125,7 @@ private:
 
   bool shouldReplaceTargetWithGOTAtom(const Atom *target, bool canBypassGOT) {
     // Accesses to shared library symbols must go through GOT.
-    if (target->definition() == Atom::definitionSharedLibrary)
+    if (isa<SharedLibraryAtom>(target))
       return true;
     // Accesses to interposable symbols in same linkage unit must also go
     // through GOT.
index d96cd4d..10bfabe 100644 (file)
@@ -230,7 +230,7 @@ public:
           continue;
         const Atom *target = ref->target();
         assert(target != nullptr);
-        if (target->definition() == Atom::definitionSharedLibrary) {
+        if (isa<SharedLibraryAtom>(target)) {
           // Calls to shared libraries go through stubs.
           replaceCalleeWithStub(target, ref);
           continue;