george.karpenkov created this revision. Herald added subscribers: szepet, xazax.hun.
@dcoughlin I'm curious whether you'd like such a change: in general, I think it is much better when the assert failure tells the developer _what_ value is failing, rather than saying "oops we are dead". I would personally even go further with providing a templated function from dump-able object to a string, which could be used to avoid such a cumbersome construction [which I have seen in a few places in Clang] https://reviews.llvm.org/D38986 Files: lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp =================================================================== --- lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -64,8 +64,12 @@ } switch (Cond.getSubKind()) { - default: - llvm_unreachable("'Assume' not implemented for this NonLoc"); + default: { + SmallString<64> buf; + llvm::raw_svector_ostream out(buf); + out << "'Assume' not implemented for this NonLoc: " << Cond << "\n"; + llvm_unreachable(out.str().data()); + } case nonloc::SymbolValKind: { nonloc::SymbolVal SV = Cond.castAs<nonloc::SymbolVal>();
Index: lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp =================================================================== --- lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp +++ lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp @@ -64,8 +64,12 @@ } switch (Cond.getSubKind()) { - default: - llvm_unreachable("'Assume' not implemented for this NonLoc"); + default: { + SmallString<64> buf; + llvm::raw_svector_ostream out(buf); + out << "'Assume' not implemented for this NonLoc: " << Cond << "\n"; + llvm_unreachable(out.str().data()); + } case nonloc::SymbolValKind: { nonloc::SymbolVal SV = Cond.castAs<nonloc::SymbolVal>();
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits