diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2018-12-21 19:16:38 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2018-12-21 19:16:38 +0000 |
commit | 4b4e8fad244aca3a7c049ee438ae8120490216a5 (patch) | |
tree | 0d8219c5058d9a3a802a0dc5166d1c40a9e1c9c2 /utils | |
parent | 07a54a8080be7ade8ca0613da0d95f980bd6c3f7 (diff) |
Switch from cast<> to dyn_cast<>.
This avoids a potential failed assertion that is happening on someone's out-of-tree build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349940 91177308-0d34-0410-b5e6-96231b3b80d8
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; } |