llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-static-analyzer-1 Author: None (NagyDonat) <details> <summary>Changes</summary> Previously the function `RangeConstraintManager::printValue()` crashed when it encountered an empty rangeset (because `RangeSet::getBitwidth()` and `RangeSet::isUnsigned()` assert that the rangeset is not empty). This commit adds a special case that avoids this behavior. As `printValue()` is only used by the checker debug.ExprInspection (and during manual debugging), the impacts of this commit are very limited. --- Full diff: https://github.com/llvm/llvm-project/pull/79446.diff 1 Files Affected: - (modified) clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp (+6-2) ``````````diff diff --git a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp index 25d066c4652f2b..cc1cad1e002cdf 100644 --- a/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp +++ b/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp @@ -3270,8 +3270,12 @@ void RangeConstraintManager::printJson(raw_ostream &Out, ProgramStateRef State, void RangeConstraintManager::printValue(raw_ostream &Out, ProgramStateRef State, SymbolRef Sym) { const RangeSet RS = getRange(State, Sym); - Out << RS.getBitWidth() << (RS.isUnsigned() ? "u:" : "s:"); - RS.dump(Out); + if (RS.isEmpty()) { + Out << "<empty rangeset>"; + } else { + Out << RS.getBitWidth() << (RS.isUnsigned() ? "u:" : "s:"); + RS.dump(Out); + } } static std::string toString(const SymbolRef &Sym) { `````````` </details> https://github.com/llvm/llvm-project/pull/79446 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits