[llvm] r374789 - BitsInit::resolveReferences - silence static analyzer null dereference warning. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 14 09:46:21 PDT 2019
Author: rksimon
Date: Mon Oct 14 09:46:21 2019
New Revision: 374789
URL: http://llvm.org/viewvc/llvm-project?rev=374789&view=rev
Log:
BitsInit::resolveReferences - silence static analyzer null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, assert to check that the loop has set the cached pointer.
Modified:
llvm/trunk/lib/TableGen/Record.cpp
Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=374789&r1=374788&r2=374789&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Mon Oct 14 09:46:21 2019
@@ -438,7 +438,7 @@ Init *BitsInit::resolveReferences(Resolv
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.
More information about the llvm-commits
mailing list