Added array type mangling to USR generation. Included test from bug report.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Thanks for working on this!
Could you please post the patch with full context (git diff -U999999)?
test/Index/USR/array-type.cpp | ||
---|---|---|
1 ↗ | (On Diff #118060) | Please use FileCheck and verify the exact USR strings. This way you'll know that they're unique without actually trying to verify if they're unique in the test. |
lib/Index/USRGeneration.cpp | ||
---|---|---|
820 ↗ | (On Diff #118066) | We should probably follow the other types and just set T = AT->getElementType() instead of using VisitType and continue instead of returning at the end of this if. |
821 ↗ | (On Diff #118066) | The "[" "]" syntax could collide with the vector-type USRs. What about using another character? Maybe '{'? |
826 ↗ | (On Diff #118066) | I think it's better to check 'ArrayType::Normal' instead of default to ensure we will be able to distinguish between added size modifiers that could be added in the future. We should also probably give it some representation, like 'n'. |
Replied and going to delete the end delimiter.
lib/Index/USRGeneration.cpp | ||
---|---|---|
819 ↗ | (On Diff #118104) | That's what I wanted to do in the first place but decided against it because of consistency - see other if conditions around. Do you still advice to use auto? |
826 ↗ | (On Diff #118104) | Braces might be redundant yet I use them intentionally even for such cases (think the infamous goto bug). But I can definitely delete those if you insist. BTW Is there some consensus about this? |
829 ↗ | (On Diff #118104) | I agree, going to delete that. |
test/Index/USR/array-type.cpp | ||
1 ↗ | (On Diff #118060) | Since the USR format doesn't seem to be really stable I wanted to avoid hard-coding USR values in tests. Wouldn't those tests be unnecessary brittle in the sense that hard-coded values would have to be modified in case of future changes? |
LGTM
lib/Index/USRGeneration.cpp | ||
---|---|---|
819 ↗ | (On Diff #118231) | Nit: I don't think you really need the 2nd const here and in the next if. |
lib/Index/USRGeneration.cpp | ||
---|---|---|
820 ↗ | (On Diff #118231) | You might also want to use the character literals for one char strings for efficiency. |