[clang][analyzer] Output in deterministic order
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Hi,
we use clang static analyzer checks in a custom tool that consumes the produced diagnostics in the order they are reported.
We sporadically noticed a few instances of non-deterministic order of the reported explanatory notes.
1) This affect the list of uninitialized fields for [clang-analyzer-optin.cplusplus.UninitializedObject]. If multiple fields are to be reported, the order of the notes we receive seems to jitter. Looking at the checker code, it seems the fileds are collected in a pointer map and produces notes in that order:
`
for (const auto &Pair : UninitFields) {
Report->addNote(Pair.second,
PathDiagnosticLocation::create(Pair.first->getDecl(),
Context.getSourceManager()));
}
`
2) For the same checker, we noticed differences in the reported path. So actually it seems that different paths are reported as notes from time to time for the same warning (at the same "primary" cause location).
Are such differences expected by the architecture of the (path-sensitive) checkers? I did not find any definite information on whether determinism is expected in general, or in specific for the reported path that is explored during the analysis.
Any comments of whether that is expected or considered a bug are very welcome.
Thanks a lot.
Contributor guide
Assessment
This issue has not been assessed yet.