diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/ClangSACheckersEmitter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/utils/TableGen/ClangSACheckersEmitter.cpp b/utils/TableGen/ClangSACheckersEmitter.cpp index 4f20274334..453dfe564b 100644 --- a/utils/TableGen/ClangSACheckersEmitter.cpp +++ b/utils/TableGen/ClangSACheckersEmitter.cpp @@ -63,8 +63,11 @@ static inline uint64_t getValueFromBitsInit(const BitsInit *B) { 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; } |