[clang] [NFC][Clang] Fix potential deref of end iterator (PR #70193)

Nathan Gauër via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 06:01:59 PST 2023


================
@@ -65,7 +65,7 @@ class CXXFieldCollector {
 
   /// getCurFields - Pointer to array of fields added to the currently parsed
   /// class.
-  FieldDecl **getCurFields() { return &*(Fields.end() - getCurNumFields()); }
----------------
Keenuts wrote:

Thanks for the review and linked pointers!
This seems to be the case. and generated code does only the pointer arithmetic, no actual load. Closing this as this is not an issue.

btw, I like your C++ trivia on twitter 😊

https://github.com/llvm/llvm-project/pull/70193


More information about the cfe-commits mailing list