shuaiwang added a comment.

> Why do you think that looping is required? From my understanding, we
>  need the first usage (DeclRefExpr) to get the analysis started. The
>  analysis itself will check all remaining uses. Is this necessary,
>  because we analysis on a `Expr` basis?

Yes. the analyzer traces starting from the given DeclRefExpr, e.g.:

  int a; // <- varDecl
  const int& b = a;  // <- first DeclRefExpr
  int& c = a; // <- second DeclRefExpr
  
  const int& b2 = b;
  int& c2 = c;
  c2 = 10;

If we start from the first DeclRefExpr, we'll only trace to `b` and then to 
`b2`. We need to start from varDecl (or loop over all DeclRefExpr) to be able 
to trace to the second DeclRefExpr from where we can get to `c` -> `c2` -> `c2 
= 10`.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45444



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D45444: [clang-tidy] WI... Shuai Wang via Phabricator via cfe-commits

Reply via email to