diff options
-rw-r--r-- | clang/utils/TableGen/ClangSACheckersEmitter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/utils/TableGen/ClangSACheckersEmitter.cpp b/clang/utils/TableGen/ClangSACheckersEmitter.cpp index 4f20274334a..453dfe564bf 100644 --- a/clang/utils/TableGen/ClangSACheckersEmitter.cpp +++ b/clang/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; } |