[PATCH] D71371: [analyzer] Do not cache out on some shared implicit AST nodes.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 11 11:48:16 PST 2019


NoQ added a comment.

Ahaa. Ahaa. Okay.

So the AST is like

  |   |-DeclStmt 0x7f9f3b8932e0 <line:6:3, col:43>
  |   | `-VarDecl 0x7f9f3b892f50 <col:3, col:42> col:7 used a 'int [5]' cinit
  |   |   `-InitListExpr 0x7f9f3b893268 <col:14, col:42> 'int [5]'
  |   |     |-array_filler: ImplicitValueInitExpr 0x7f9f3b8932d0 <<invalid sloc>> 'int'
  |   |     |-IntegerLiteral 0x7f9f3b893118 <col:41> 'int' 4
  |   |     |-ImplicitValueInitExpr 0x7f9f3b8932d0 <<invalid sloc>> 'int'
  |   |     |-IntegerLiteral 0x7f9f3b893078 <col:31> 'int' 15
  |   |     |-ImplicitValueInitExpr 0x7f9f3b8932d0 <<invalid sloc>> 'int'
  |   |     `-IntegerLiteral 0x7f9f3b892fd8 <col:21> 'int' 29

And the CFG is like

  [B1]
     1: 4
     2: [B1.4]
     3: 15
     4: /*implicit*/(int)0
     5: 29
     6: {[4] = [B1.5], [2] = [B1.3], [0] = [B1.1]}
     7: int a[5] = {[4] = 29, [2] = 15, [0] = 4};

And you're trying to avoid agglutinating program points for `[B1.2]` and `[B1.4]`.

Can we simply erase the implicit initializers from the CFG? Under an option, of course. We ignore them in the static analyzer anyway (like all constants).

We could do a custom program point just for this problem (which includes the index as part of its identity), but it's kinda underwhelming to build a whole new program point that always does nothing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71371





More information about the cfe-commits mailing list