suoyuan666 wrote: > For chained member/arrow operations, we should highlight each step in the > chain (with distinct ranges): > > ```c++ > const char* x = temporary().begin()->second.data(); > ``` > > Would produce: > > ```c++ > warning: object whose reference is captured does not live long enough > const char* x = temporary().begin()->second.data(); > ^~~~~~~~~~~ > note: destroyed here > const char* x = temporary().begin()->second.data(); > ^ > note: expression aliases the storage of the temporary > const char* x = temporary().begin()->second.data(); > ^~~~~~~~~~~~~~~~~~~ > note: member access aliases the storage of the temporary > const char* x = temporary().begin()->second.data(); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > note: function call result aliases the storage of the temporary > const char* x = temporary().begin()->second.data(); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > note: variable 'x' aliases the storage of the temporary > const char* x = temporary().begin()->second.data(); > ^ > note: later used here > (void)x; > ^ > ```
Hi, I’ve moved the assignment backtracking logic from `LifetimeChecker` into a dedicated file and refactored the diagnostic handling to align with the format you suggested. Regarding your example: `const char* x = temporary().begin()->second.data();` I noticed the trace starts from `temporary().begin()` rather than `temporary()`. Are we intentionally skipping `CXXOperatorCallExpr` here, or is there a specific reason for this starting point? https://github.com/llvm/llvm-project/pull/188467 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
