[lld] r219723 - Use isa<> instead of checking return value of definition().
Rui Ueyama
ruiu at google.com
Tue Oct 14 14:20:01 PDT 2014
Author: ruiu
Date: Tue Oct 14 16:20:01 2014
New Revision: 219723
URL: http://llvm.org/viewvc/llvm-project?rev=219723&view=rev
Log:
Use isa<> instead of checking return value of definition().
definition() is supposed to be used through isa, dyn_cast or cast.
It's better to not call that directly.
Modified:
lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp
lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp
Modified: lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp?rev=219723&r1=219722&r2=219723&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp Tue Oct 14 16:20:01 2014
@@ -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.
Modified: lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp?rev=219723&r1=219722&r2=219723&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp Tue Oct 14 16:20:01 2014
@@ -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;
More information about the llvm-commits
mailing list