r349940 - Switch from cast<> to dyn_cast<>.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 21 11:16:38 PST 2018
Author: aaronballman
Date: Fri Dec 21 11:16:38 2018
New Revision: 349940
URL: http://llvm.org/viewvc/llvm-project?rev=349940&view=rev
Log:
Switch from cast<> to dyn_cast<>.
This avoids a potential failed assertion that is happening on someone's out-of-tree build.
Modified:
cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp
Modified: cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp?rev=349940&r1=349939&r2=349940&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangSACheckersEmitter.cpp Fri Dec 21 11:16:38 2018
@@ -63,8 +63,11 @@ static inline uint64_t getValueFromBitsI
uint64_t Value = 0;
for (unsigned i = 0, e = B->getNumBits(); i != e; ++i) {
- const auto *Bit = cast<BitInit>(B->getBit(i));
- Value |= uint64_t(Bit->getValue()) << i;
+ const auto *Bit = dyn_cast<BitInit>(B->getBit(i));
+ if (Bit)
+ Value |= uint64_t(Bit->getValue()) << i;
+ else
+ PrintFatalError("Invalid bits");
}
return Value;
}
More information about the cfe-commits
mailing list