From 4194315681f1f0b04f7c097634aad047f78bd43a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 25 Jan 2007 04:52:46 +0000 Subject: Save the member list of a struct/union in the RecordDecl for the struct. llvm-svn: 39297 --- clang/AST/Decl.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'clang/AST/Decl.cpp') diff --git a/clang/AST/Decl.cpp b/clang/AST/Decl.cpp index 7bad5a1102b..7a88fcbec03 100644 --- a/clang/AST/Decl.cpp +++ b/clang/AST/Decl.cpp @@ -45,3 +45,17 @@ void FunctionDecl::setParams(VarDecl **NewParamInfo, unsigned NumParams) { memcpy(ParamInfo, NewParamInfo, sizeof(VarDecl*)*NumParams); } } + + +/// defineBody - When created, RecordDecl's correspond to a forward declared +/// record. This method is used to mark the decl as being defined, with the +/// specified contents. +void RecordDecl::defineBody(Decl **fields, unsigned numFields) { + assert(!isDefinition() && "Cannot redefine record!"); + setDefinition(true); + NumFields = numFields; + if (numFields) { + Fields = new Decl*[numFields]; + memcpy(Fields, fields, numFields*sizeof(Decl*)); + } +} -- cgit v1.2.3