Repository navigation
[C++] Fix const correctness in ATN and DFA - #3530
Conversation
3a1ed5f to
dc6b311
Compare
mike-lischke
left a comment
There was a problem hiding this comment.
Great work! Just fix the few issues I mentioned and we are good to go.
Please refrain from moving code to header files, if there's not really an absolute compelling reason.
dc6b311 to
27e74df
Compare
|
Something is weird with the MacOS runtime. I need to get a signal handler installed that dumps the stacktrace when it fails. |
e3fffbd to
140094c
Compare
|
Something is super weird. I am going to need to grab my Wife's personal mac to investigate. I'll bump this when I figure out whats up. Looks like SEGFAULT via nullptr, but its hard to tell. |
592c801 to
53df497
Compare
|
I tickled some weird MacOS bug in their toolchain. I'm going to split this up into separate CLs to narrow down the root cause. Leaving this open for the timebeing for reference. |
53df497 to
0cabe79
Compare
0bad220 to
2bc31fc
Compare
|
Okay, I think its good now @mike-lischke , I didn't need to split. There is something super sketchy going on with I removed the changes to equality and hashing for |
2bc31fc to
ba76a39
Compare
|
I accidentally squashed the change I was talking about. Updated, and tests are all green. |
mike-lischke
left a comment
There was a problem hiding this comment.
This looks ok now. @parrt This patch can be merged.
| if (!a[i] && !b[i]) | ||
| continue; | ||
| if (!a[i] || !b[i]) | ||
| return false; |
There was a problem hiding this comment.
Not an issue per se, just mentioning that these two checks can be combined into one:
if (!a[i] != !b[i])
continue;|
Thanks guys! |
This is a safe but large change that fixes const correctness in various places in the ATN and DFA. Historically things were passed around as
std::shared_ptr<T>which allowedTto be modified even if it never was. This change fixes it so that most things are passed around asstd::shared_ptr<const T>. This makes thread saftey analysis easier when simply reading.I also replaced
const std::shared_ptr<T>&withconst T&in places wherestd::shared_ptrwas not being copied and thus extending the lifetime ofT.