[llvm-dev] [SemaCXX] Should we fix test failing due to reverse iteration?
Grang, Mandeep Singh via llvm-dev
llvm-dev at lists.llvm.org
Thu Jun 1 13:46:34 PDT 2017
I see that the following test fails if reverse iteration of SmallPtrSet
is enabled:
/clang/test/SemaCXX/warn-loop-analysis.cpp/
This is because in SemaStmt.cpp we iterate SmallPtrSet and output
warnings about the variables not used in the loop.
Expected output: /warning: variables 'i', 'j', and 'k' used in loop
condition not modified/
Output with reverse iteration: /warning: variables 'k', 'j', and 'i'
used in loop condition not/
I would like the community's opinion on whether this is something worth
fixing? In this case, should the output always be the same irrespective
of the iteration order?
If yes, then we have 2 alternatives:
1. Change SmallPtrSet to SmallVector for the container (VarDecls) being
iterated - this may have a compile time impact (need to measure).
2. Sort the container (VarDecls) before iteration. We can sort based on
decl source location and decl name. Not sure if these guaranteed to be
unique?
Thanks,
Mandeep
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170601/8a140647/attachment.html>
More information about the llvm-dev
mailing list