Switch from cast<> to dyn_cast<>.
This avoids a potential failed assertion that is happening on someone's out-of-tree build. llvm-svn: 349940
This commit is contained in:
parent
255b05820c
commit
88b36702dc
|
@ -63,8 +63,11 @@ static inline uint64_t getValueFromBitsInit(const BitsInit *B) {
|
||||||
|
|
||||||
uint64_t Value = 0;
|
uint64_t Value = 0;
|
||||||
for (unsigned i = 0, e = B->getNumBits(); i != e; ++i) {
|
for (unsigned i = 0, e = B->getNumBits(); i != e; ++i) {
|
||||||
const auto *Bit = cast<BitInit>(B->getBit(i));
|
const auto *Bit = dyn_cast<BitInit>(B->getBit(i));
|
||||||
Value |= uint64_t(Bit->getValue()) << i;
|
if (Bit)
|
||||||
|
Value |= uint64_t(Bit->getValue()) << i;
|
||||||
|
else
|
||||||
|
PrintFatalError("Invalid bits");
|
||||||
}
|
}
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue