Depends On D132377
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/unittests/Analysis/FlowSensitive/TestingSupport.cpp | ||
---|---|---|
124 | ||
clang/unittests/Analysis/FlowSensitive/TestingSupport.h | ||
287–288 | ||
330–333 | Could you add an assert that insert reported that it indeed inserted an element (didn't overwrite)? | |
387–388 | Would a range-based for loop work? for (const auto &P : AnnotationStates) | |
389–392 | Would make_pair work? It allows to omit explicit template arguments. | |
394–396 | Please use llvm::sort. You also don't need to specify the comparator, the default comparator for strings is exactly the same. |
Address comments.
clang/unittests/Analysis/FlowSensitive/TestingSupport.h | ||
---|---|---|
394–396 | Used llvm::sort. The default comparator for pairs also tries to compare the second field which is undefined for DataflowAnalysisState. And considering that annotations are unique here, it should be sufficient to just compare the strings here - hence the specified comparator that just checks the first of the pair. |
clang/unittests/Analysis/FlowSensitive/TestingSupport.h | ||
---|---|---|
332 | Please add (void)InsertSuccess; to silence an "unused variable" warning in release builds. |
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp | ||
---|---|---|
652–653 | Given that its now a map, should we use UnorderedElementsAre? Or, does StringMap guarantee ordering? |
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp | ||
---|---|---|
652–653 | StringMap is not yet exposed to the tests in this patch. Some ordering is currently required to correctly retrieve the states in the tests. Hence, the conversion from StringMap to vector<pair<string, StateT>> (in deprecated checkDataflow) orders the elements alphabetically on the annotations. Future refactoring will expose StringMap in the tests, where we will then not need to maintain an ordering since we can retrieve elements by keys, we can then use UnorderedElementsAre. |