[PATCH] D45679: [clang-tidy] Add a helper function isModified, that checks whether an expression is modified within a statement.

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 18 13:50:09 PDT 2018


JonasToth added inline comments.


================
Comment at: clang-tidy/utils/ASTUtils.cpp:226
+
+  // If 'Exp' is bound to a non-const reference, check all declRefExpr to that.
+  const auto Refs = match(
----------------
What about transitive references and pointers?
It seems that only references are checked, but if a pointer is taken through that reference and vice versa, is that tracked correctly?


================
Comment at: clang-tidy/utils/ASTUtils.cpp:233
+                                   conditionalOperator(anyOf(
+                                       hasTrueExpression(equalsNode(&Exp)),
+                                       hasFalseExpression(equalsNode(&Exp)))))),
----------------
If the `Exp` is an array, that will not match array subscript?

Are there other similar cases?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45679





More information about the cfe-commits mailing list