Model nullopt, value, and conversion assignment operators.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp | ||
---|---|---|
94 | While really like the convenience matchers will give us building data flow analyses, I wonder whether a lot of duplicated work is happening in the background. E.g. will we end up string comparing the class name of the parent of the method in the matcher built by optionalClass whenever we process an overloaded operator=? In a handwritten implementation we would only do this once, store the address of the canonical declaration somewhere and subsequent checks would only look up the canonical declaration of the called method and do a pointer comparison. In case this matcher approach is not that efficient, I wonder if it would be possible to come up with some APIs where the matching is only done once and subsequent transfer functions would only use the cached pointers to declarations/types. In case the matchers are already doing something smart in the background feel free to ignore this comment. | |
173–174 | If we never assign values to Parens, shouldn't getValue do the skipping instead? | |
296 | Is this duplicated across here and transferValueOrConversionConstructor? Should we have a separate function like IsValueOperation? |
clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp | ||
---|---|---|
94 | That's a great point! Unfortunately, I'm not familiar with the implementation of matchers so I'll need to take a closer look/ask around to understand if such an optimization is already in place. Let me take a note of this for now. I suggest revising the APIs once we know more about the internals of matchers. |
While really like the convenience matchers will give us building data flow analyses, I wonder whether a lot of duplicated work is happening in the background. E.g. will we end up string comparing the class name of the parent of the method in the matcher built by optionalClass whenever we process an overloaded operator=?
In a handwritten implementation we would only do this once, store the address of the canonical declaration somewhere and subsequent checks would only look up the canonical declaration of the called method and do a pointer comparison.
In case this matcher approach is not that efficient, I wonder if it would be possible to come up with some APIs where the matching is only done once and subsequent transfer functions would only use the cached pointers to declarations/types. In case the matchers are already doing something smart in the background feel free to ignore this comment.