]> granicus.if.org Git - llvm/commitdiff
BitsInit::resolveReferences - silence static analyzer null dereference warning. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 14 Oct 2019 16:46:21 +0000 (16:46 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 14 Oct 2019 16:46:21 +0000 (16:46 +0000)
The static analyzer is warning about a potential null dereference, assert to check that the loop has set the cached pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374789 91177308-0d34-0410-b5e6-96231b3b80d8

lib/TableGen/Record.cpp

index 41c44280d83c16677a9dcf0fb73f4ddd2f2ad259..835ef8c7141b9b2da3d2d32d8d805bd6b5dd895f 100644 (file)
@@ -438,7 +438,7 @@ Init *BitsInit::resolveReferences(Resolver &R) const {
         CachedBitVarRef = CurBitVar->getBitVar();
         CachedBitVarResolved = CachedBitVarRef->resolveReferences(R);
       }
-
+      assert(CachedBitVarResolved && "Unresolved bitvar reference");
       NewBit = CachedBitVarResolved->getBit(CurBitVar->getBitNum());
     } else {
       // getBit(0) implicitly converts int and bits<1> values to bit.