[PATCH] D121063: [AST] Make the last element in the linked list null

Bill Wendling via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 5 16:42:28 PST 2022


void created this revision.
void added reviewers: erichkeane, aaron.ballman, urnathan.
Herald added a project: All.
void requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The last element in a linked list should point to null, so that we can
identify when the linked list ends.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121063

Files:
  clang/lib/AST/DeclBase.cpp


Index: clang/lib/AST/DeclBase.cpp
===================================================================
--- clang/lib/AST/DeclBase.cpp
+++ clang/lib/AST/DeclBase.cpp
@@ -1344,6 +1344,10 @@
     PrevDecl = D;
   }
 
+  if (PrevDecl)
+    // Last item in the linked list should have a null next pointer.
+    PrevDecl->NextInContextAndBits.setPointer(nullptr);
+
   return std::make_pair(FirstNewDecl, PrevDecl);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121063.413264.patch
Type: text/x-patch
Size: 414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220306/287c1d73/attachment.bin>


More information about the cfe-commits mailing list