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);
 }
 


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);
 }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to