[lld] r198855 - [Mips] Reduce the number of type-casting calls.
Simon Atanasyan
simon at atanasyan.com
Wed Jan 8 23:52:31 PST 2014
Author: atanasyan
Date: Thu Jan 9 01:52:31 2014
New Revision: 198855
URL: http://llvm.org/viewvc/llvm-project?rev=198855&view=rev
Log:
[Mips] Reduce the number of type-casting calls.
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp?rev=198855&r1=198854&r2=198855&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp Thu Jan 9 01:52:31 2014
@@ -119,8 +119,9 @@ private:
}
bool isLocal(const Atom *a) {
- return isa<DefinedAtom>(a) &&
- dyn_cast<DefinedAtom>(a)->scope() == Atom::scopeTranslationUnit;
+ if (auto *da = dyn_cast<DefinedAtom>(a))
+ return da->scope() == Atom::scopeTranslationUnit;
+ return false;
}
void handleGOT(const Reference &ref) {
@@ -132,10 +133,10 @@ private:
bool requireLocalGOT(const Atom *a) {
Atom::Scope scope;
- if (isa<DefinedAtom>(a))
- scope = dyn_cast<DefinedAtom>(a)->scope();
- else if (isa<AbsoluteAtom>(a))
- scope = dyn_cast<AbsoluteAtom>(a)->scope();
+ if (auto *da = dyn_cast<DefinedAtom>(a))
+ scope = da->scope();
+ else if (auto *aa = dyn_cast<AbsoluteAtom>(a))
+ scope = aa->scope();
else
return false;
More information about the llvm-commits
mailing list