Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Very close, just add a test for a bad value since someone can have code like:
StateType state; llvm::formatv("{0}", state);
Just to make sure we don't crash during logging. Can remember what lldb_private::StateAsCString(...) returns, but I am guessing it is NULL for a bad state, so we need to make sure the logging won't crash with that.
unittests/Core/StateTest.cpp | ||
---|---|---|
19 ↗ | (On Diff #85415) | Add a test like: EXPECT_EQ("(null)", llvm::formatv("{0}", static_cast<StateType>(-1)).str()); |
Comment Actions
In this case, StateAsCString was returning a pointer to a static buffer in a
scarily non-thread-safe way. I've changed it to print "unknown" instead and test
for that.