Adds a general-purpose framework to support testing of dataflow analyses.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/unittests/Analysis/FlowSensitive/TestingSupport.h | ||
---|---|---|
48 | This would also be useful for debugging. I wonder whether utilities not strictly related to testing should be closer to the actual code, so someone wanting to use this for debugging does not need to include the header that is dedicated to the tests. | |
77 | I feel like some of our tests keep recreating lightweight versions of the LibTooling. Not really an action item for this PR, just a rant :) I hope we will have some more centralized stuff at some point. | |
94 | Since this function is actually matching the dataflow results against expectations, I wonder if something like checkDataflow would better describe its function. But feel free to keep the current name. | |
137 | Wouldn't users end up calling the template (not the type erased) version of this function? I wonder if we should mimic how users would interact with the framework in the tests. |
Thanks for the great comments and the fast response time!
clang/unittests/Analysis/FlowSensitive/TestingSupport.h | ||
---|---|---|
48 | Agreed. Added a FIXME. | |
77 | No, I agree! I missed this -- there's no good reason for runOnCode to exist. I've removed it and like the result a lot more. :) | |
94 | Agreed. | |
135 | I've inlined buildAnnotationToOutputStateMapping, since it is only intended for use here anyhow and factoring it out didn't save anything because we still need to translate to typed state. | |
137 | I see your point and tried to move in that direction. However, it makes this code a lot messier because of the need to iterate again over each block with transferBlock to recoved statement level state. Since transferBlock is part of the type-erased engine, interacting with it would require mapping all of the state to untyped before using it, which somewhat defeats the whole purpose of using the typed version. We should consider reporting statement level information from our run...DataflowAnalysis functions, which would make this iteration unnecessary, at which point moving to the typed version would make a lot of sense. |
clang/unittests/Analysis/FlowSensitive/TestingSupport.h | ||
---|---|---|
48–49 | This SFINAE guard doesn't work on some platforms, as evidenced by the many buildbot failures after commit. Any suggestions for
would be appreciated. |
Looks like this breaks building on Windows: http://45.33.8.238/win/50614/step_4.txt
Please take a look!
renames the testing namespace to test
cleans up the code the implementation of operator<< for dataflow state.
This would also be useful for debugging. I wonder whether utilities not strictly related to testing should be closer to the actual code, so someone wanting to use this for debugging does not need to include the header that is dedicated to the tests.