[PATCH] D57660: [Sema] SequenceChecker: Handle references, members and structured bindings.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 2 18:07:53 PDT 2020


rsmith added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:2031-2033
+  "%select{|member |static member }0%2"
+  "%select{| of %3| of struct %4| of union %4| of class %4"
+  "| of structured binding %3}1">, InGroup<Unsequenced>;
----------------
I wonder if we could just print out a simple access path here (eg `x.a[3]`). `APValue` has support for representing and pretty-printing such things already, and you could try passing arbitrary lvalue expressions to the constant evaluator to try to form them rather than special-casing a few things in `getMemoryLocationImpl`.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:12782-12783
+  //
+  // FIXME: Is this duplicating some code which already exists somewhere else ?
+  // If not, should this be moved somewhere where it can be reused ?
+  static MemoryLocation
----------------
Per the above, I think this can be replaced by calling `EvaluateAsLValue` on the expression.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D57660





More information about the cfe-commits mailing list