vabridgers updated this revision to Diff 358573. vabridgers added a comment.
update commit header Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105974/new/ https://reviews.llvm.org/D105974 Files: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp Index: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/SValBuilder.cpp +++ clang/lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -712,9 +712,18 @@ // symbols to use, only content metadata. return nonloc::SymbolVal(SymMgr.getExtentSymbol(FTR)); - if (const SymbolicRegion *SymR = R->getSymbolicBase()) - return makeNonLoc(SymR->getSymbol(), BO_NE, - BasicVals.getZeroWithPtrWidth(), CastTy); + if (const SymbolicRegion *SymR = R->getSymbolicBase()) { + SymbolRef Sym = SymR->getSymbol(); + QualType Ty = Sym->getType(); + // FIXME: Why did we have references at this point? + // FIXME: Cleanup remainder of `getZeroWithPtrWidth ()` + // and `getIntWithPtrWidth()` functions to prevent future + // confusion + const llvm::APSInt &Zero = Ty->isReferenceType() + ? BasicVals.getZeroWithPtrWidth() + : BasicVals.getZeroWithTypeSize(Ty); + return makeNonLoc(Sym, BO_NE, Zero, CastTy); + } // Non-symbolic memory regions are always true. return makeTruthVal(true, CastTy); }
Index: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/SValBuilder.cpp +++ clang/lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -712,9 +712,18 @@ // symbols to use, only content metadata. return nonloc::SymbolVal(SymMgr.getExtentSymbol(FTR)); - if (const SymbolicRegion *SymR = R->getSymbolicBase()) - return makeNonLoc(SymR->getSymbol(), BO_NE, - BasicVals.getZeroWithPtrWidth(), CastTy); + if (const SymbolicRegion *SymR = R->getSymbolicBase()) { + SymbolRef Sym = SymR->getSymbol(); + QualType Ty = Sym->getType(); + // FIXME: Why did we have references at this point? + // FIXME: Cleanup remainder of `getZeroWithPtrWidth ()` + // and `getIntWithPtrWidth()` functions to prevent future + // confusion + const llvm::APSInt &Zero = Ty->isReferenceType() + ? BasicVals.getZeroWithPtrWidth() + : BasicVals.getZeroWithTypeSize(Ty); + return makeNonLoc(Sym, BO_NE, Zero, CastTy); + } // Non-symbolic memory regions are always true. return makeTruthVal(true, CastTy); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits