From ae01946afa52e660b650ec7bc5817c9acfe54074 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 15 Aug 2013 22:50:29 +0000 Subject: [PATCH] DebugInfo: CollectRecordStaticField -> CreateRecordStaticField to return its result. llvm-svn: 188501 --- clang/lib/CodeGen/CGDebugInfo.cpp | 15 +++++++-------- clang/lib/CodeGen/CGDebugInfo.h | 5 ++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 5f56e1695917..0c6f549e21c3 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -866,10 +866,9 @@ CollectRecordLambdaFields(const CXXRecordDecl *CXXDecl, } /// CollectRecordStaticField - Helper for CollectRecordFields. -void CGDebugInfo:: -CollectRecordStaticField(const VarDecl *Var, - SmallVectorImpl &elements, - llvm::DIType RecordTy) { +llvm::DIDerivedType +CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, + llvm::DIType RecordTy) { // Create the descriptor for the static variable, with or without // constant initializers. llvm::DIFile VUnit = getOrCreateFile(Var->getLocation()); @@ -898,10 +897,10 @@ CollectRecordStaticField(const VarDecl *Var, else if (Access == clang::AS_protected) Flags |= llvm::DIDescriptor::FlagProtected; - llvm::DIType GV = DBuilder.createStaticMemberType(RecordTy, VName, VUnit, - LineNumber, VTy, Flags, C); - elements.push_back(GV); + llvm::DIDerivedType GV = DBuilder.createStaticMemberType( + RecordTy, VName, VUnit, LineNumber, VTy, Flags, C); StaticDataMemberCache[Var->getCanonicalDecl()] = llvm::WeakVH(GV); + return GV; } /// CollectRecordNormalField - Helper for CollectRecordFields. @@ -952,7 +951,7 @@ CollectRecordFields(const RecordDecl *record, llvm::DIFile tunit, for (RecordDecl::decl_iterator I = record->decls_begin(), E = record->decls_end(); I != E; ++I) if (const VarDecl *V = dyn_cast(*I)) - CollectRecordStaticField(V, elements, RecordTy); + elements.push_back(CreateRecordStaticField(V, RecordTy)); else if (FieldDecl *field = dyn_cast(*I)) { CollectRecordNormalField(field, layout.getFieldOffset(fieldNo), tunit, elements, RecordTy); diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index 6c4c34c3680d..c3d283423437 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -184,9 +184,8 @@ class CGDebugInfo { void CollectRecordLambdaFields(const CXXRecordDecl *CXXDecl, SmallVectorImpl &E, llvm::DIType RecordTy); - void CollectRecordStaticField(const VarDecl *Var, - SmallVectorImpl &E, - llvm::DIType RecordTy); + llvm::DIDerivedType CreateRecordStaticField(const VarDecl *Var, + llvm::DIType RecordTy); void CollectRecordNormalField(const FieldDecl *Field, uint64_t OffsetInBits, llvm::DIFile F, SmallVectorImpl &E, -- 2.34.1