[PATCH] D125362: [NFC][analyzer] Transitive interestingness in BugReporter

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 06:05:36 PDT 2022


steakhal added a comment.

I think since it changes how taint spreads, this patch deserves a test.
Could you please demonstrate the correctness of this patch?



================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporter.cpp:2267
+  for (SymbolRef SubSym : SubSyms) {
+    if (SymbolData::classof(SubSym))
+      insertToInterestingnessMap(InterestingSymbols, SubSym, TKind);
----------------



================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporter.cpp:2361-2366
+  auto SubSyms = llvm::make_range(sym->symbol_begin(), sym->symbol_end());
+  for (SymbolRef SubSym : SubSyms) {
+    if (SymbolData::classof(SubSym)) {
+      if (auto MaybeTK = TryToLookupTrackingKind(SubSym))
+        return MaybeTK;
+    }
----------------
The comment of `symbol_iterator` suggests that for `SymbolData` this will be always the symbol data itself; thus it would iterate only once.
Is this the case? If so, can we replace the loop with just the `isa<SymbolData>(sym)` check?

```
  /// Iterator over symbols that the current symbol depends on.
  ///
  /// For SymbolData, it's the symbol itself; for expressions, it's the
  /// expression symbol and all the operands in it. Note, SymbolDerived is
  /// treated as SymbolData - the iterator will NOT visit the parent region.
  class symbol_iterator {...
```


================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporter.cpp:2363
+  for (SymbolRef SubSym : SubSyms) {
+    if (SymbolData::classof(SubSym)) {
+      if (auto MaybeTK = TryToLookupTrackingKind(SubSym))
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125362/new/

https://reviews.llvm.org/D125362



More information about the cfe-commits mailing list