[RFC 10/12] Fix: Set tail pointer to null in field list

Connor Kuehl via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 14:36:49 PST 2019


Co-authored-by: Cole Nixon <nixontcole at gmail.com>
Co-authored-by: Connor Kuehl <cipkuehl at gmail.com>
Co-authored-by: James Foster <jafosterja at gmail.com>
Co-authored-by: Jeff Takahashi <jeffrey.takahashi at gmail.com>
Co-authored-by: Jordan Cantrell <jordan.cantrell at mail.com>
Co-authored-by: Nikk Forbus <nicholas.forbus at gmail.com>
Co-authored-by: Tim Pugh <nwtpugh at gmail.com>
---
 clang/lib/AST/DeclBase.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index e1b5161b027..2694d596755 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1258,6 +1258,9 @@ DeclContext::BuildDeclChain(ArrayRef<Decl *> Decls,
     PrevDecl = D;
   }
 
+  // The last one in the chain should have a null next!
+  PrevDecl->NextInContextAndBits.setPointer(nullptr);
+
   return std::make_pair(FirstNewDecl, PrevDecl);
 }
 
-- 
2.17.1



More information about the cfe-commits mailing list