From: Eric Christopher Date: Thu, 16 May 2013 00:45:12 +0000 (+0000) Subject: Whitespace. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6537f083555f9606c495d05c562878aa49bae987;p=clang Whitespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181960 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 2dd1741d83..f9abae91be 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -150,13 +150,13 @@ StringRef CGDebugInfo::getObjCMethodName(const ObjCMethodDecl *OMD) { llvm::raw_svector_ostream OS(MethodName); OS << (OMD->isInstanceMethod() ? '-' : '+') << '['; const DeclContext *DC = OMD->getDeclContext(); - if (const ObjCImplementationDecl *OID = + if (const ObjCImplementationDecl *OID = dyn_cast(DC)) { OS << OID->getName(); - } else if (const ObjCInterfaceDecl *OID = + } else if (const ObjCInterfaceDecl *OID = dyn_cast(DC)) { OS << OID->getName(); - } else if (const ObjCCategoryImplDecl *OCD = + } else if (const ObjCCategoryImplDecl *OCD = dyn_cast(DC)){ OS << ((const NamedDecl *)OCD)->getIdentifier()->getNameStart() << '(' << OCD->getIdentifier()->getNameStart() << ')'; @@ -178,7 +178,7 @@ StringRef CGDebugInfo::getSelectorName(Selector S) { } /// getClassName - Get class name including template argument list. -StringRef +StringRef CGDebugInfo::getClassName(const RecordDecl *RD) { const ClassTemplateSpecializationDecl *Spec = dyn_cast(RD); @@ -316,7 +316,7 @@ void CGDebugInfo::CreateCompileUnit() { char *SplitDwarfPtr = DebugInfoNames.Allocate(SplitDwarfFile.length()); memcpy(SplitDwarfPtr, SplitDwarfFile.c_str(), SplitDwarfFile.length()); StringRef SplitDwarfFilename(SplitDwarfPtr, SplitDwarfFile.length()); - + unsigned LangTag; const LangOptions &LO = CGM.getLangOpts(); if (LO.CPlusPlus) { @@ -387,7 +387,7 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { getOrCreateMainFile(), 0); unsigned Size = CGM.getContext().getTypeSize(CGM.getContext().VoidPtrTy); - + llvm::DIType ISATy = DBuilder.createPointerType(ClassTy, Size); ObjTy = @@ -412,7 +412,7 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { return getOrCreateStructPtrType("opencl_image1d_t", OCLImage1dDITy); case BuiltinType::OCLImage1dArray: - return getOrCreateStructPtrType("opencl_image1d_array_t", + return getOrCreateStructPtrType("opencl_image1d_array_t", OCLImage1dArrayDITy); case BuiltinType::OCLImage1dBuffer: return getOrCreateStructPtrType("opencl_image1d_buffer_t", @@ -472,7 +472,7 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(BT); uint64_t Align = CGM.getContext().getTypeAlign(BT); - llvm::DIType DbgTy = + llvm::DIType DbgTy = DBuilder.createBasicType(BTName, Size, Align, Encoding); return DbgTy; } @@ -485,7 +485,7 @@ llvm::DIType CGDebugInfo::CreateType(const ComplexType *Ty) { uint64_t Size = CGM.getContext().getTypeSize(Ty); uint64_t Align = CGM.getContext().getTypeAlign(Ty); - llvm::DIType DbgTy = + llvm::DIType DbgTy = DBuilder.createBasicType("complex", Size, Align, Encoding); return DbgTy; @@ -524,7 +524,7 @@ llvm::DIType CGDebugInfo::CreateQualifiedType(QualType Ty, llvm::DIFile Unit) { // No need to fill in the Name, Line, Size, Alignment, Offset in case of // CVR derived types. llvm::DIType DbgTy = DBuilder.createQualifiedType(Tag, FromTy); - + return DbgTy; } @@ -538,14 +538,14 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCObjectPointerType *Ty, return getOrCreateType(CGM.getContext().getObjCIdType(), Unit); llvm::DIType DbgTy = - CreatePointerLikeType(llvm::dwarf::DW_TAG_pointer_type, Ty, + CreatePointerLikeType(llvm::dwarf::DW_TAG_pointer_type, Ty, Ty->getPointeeType(), Unit); return DbgTy; } llvm::DIType CGDebugInfo::CreateType(const PointerType *Ty, llvm::DIFile Unit) { - return CreatePointerLikeType(llvm::dwarf::DW_TAG_pointer_type, Ty, + return CreatePointerLikeType(llvm::dwarf::DW_TAG_pointer_type, Ty, Ty->getPointeeType(), Unit); } @@ -583,7 +583,7 @@ llvm::DIDescriptor CGDebugInfo::createContextChain(const Decl *Context) { llvm::Value *V = I->second; return llvm::DIDescriptor(dyn_cast_or_null(V)); } - + // Check namespace. if (const NamespaceDecl *NSDecl = dyn_cast(Context)) return llvm::DIDescriptor(getOrCreateNameSpace(NSDecl)); @@ -628,7 +628,7 @@ llvm::DIType CGDebugInfo::CreatePointeeType(QualType PointeeTy, } llvm::DIType CGDebugInfo::CreatePointerLikeType(unsigned Tag, - const Type *Ty, + const Type *Ty, QualType PointeeTy, llvm::DIFile Unit) { if (Tag == llvm::dwarf::DW_TAG_reference_type || @@ -732,10 +732,10 @@ llvm::DIType CGDebugInfo::CreateType(const TypedefType *Ty, llvm::DIFile Unit) { // declared. unsigned Line = getLineNumber(Ty->getDecl()->getLocation()); const TypedefNameDecl *TyDecl = Ty->getDecl(); - + llvm::DIDescriptor TypedefContext = getContextDescriptor(cast(Ty->getDecl()->getDeclContext())); - + return DBuilder.createTypedef(Src, TyDecl->getName(), Unit, Line, TypedefContext); } @@ -1008,7 +1008,7 @@ llvm::DIType CGDebugInfo::getOrCreateInstanceMethodType( return DBuilder.createSubroutineType(Unit, EltTypeArray); } -/// isFunctionLocalClass - Return true if CXXRecordDecl is defined +/// isFunctionLocalClass - Return true if CXXRecordDecl is defined /// inside a function. static bool isFunctionLocalClass(const CXXRecordDecl *RD) { if (const CXXRecordDecl *NRD = dyn_cast(RD->getDeclContext())) @@ -1024,9 +1024,9 @@ llvm::DISubprogram CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, llvm::DIFile Unit, llvm::DIType RecordTy) { - bool IsCtorOrDtor = + bool IsCtorOrDtor = isa(Method) || isa(Method); - + StringRef MethodName = getFunctionName(Method); llvm::DIType MethodTy = getOrCreateMethodType(Method, Unit); @@ -1042,15 +1042,15 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, // Collect virtual method info. llvm::DIType ContainingType; - unsigned Virtuality = 0; + unsigned Virtuality = 0; unsigned VIndex = 0; - + if (Method->isVirtual()) { if (Method->isPure()) Virtuality = llvm::dwarf::DW_VIRTUALITY_pure_virtual; else Virtuality = llvm::dwarf::DW_VIRTUALITY_virtual; - + // It doesn't make sense to give a virtual destructor a vtable index, // since a single destructor has two entries in the vtable. if (!isa(Method)) @@ -1069,7 +1069,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, if (const CXXConstructorDecl *CXXC = dyn_cast(Method)) { if (CXXC->isExplicit()) Flags |= llvm::DIDescriptor::FlagExplicit; - } else if (const CXXConversionDecl *CXXC = + } else if (const CXXConversionDecl *CXXC = dyn_cast(Method)) { if (CXXC->isExplicit()) Flags |= llvm::DIDescriptor::FlagExplicit; @@ -1079,21 +1079,21 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, llvm::DIArray TParamsArray = CollectFunctionTemplateParams(Method, Unit); llvm::DISubprogram SP = - DBuilder.createMethod(RecordTy, MethodName, MethodLinkageName, + DBuilder.createMethod(RecordTy, MethodName, MethodLinkageName, MethodDefUnit, MethodLine, - MethodTy, /*isLocalToUnit=*/false, + MethodTy, /*isLocalToUnit=*/false, /* isDefinition=*/ false, Virtuality, VIndex, ContainingType, Flags, CGM.getLangOpts().Optimize, NULL, TParamsArray); - + SPCache[Method->getCanonicalDecl()] = llvm::WeakVH(SP); return SP; } /// CollectCXXMemberFunctions - A helper function to collect debug info for -/// C++ member functions. This is used while creating debug info entry for +/// C++ member functions. This is used while creating debug info entry for /// a Record. void CGDebugInfo:: CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DIFile Unit, @@ -1117,7 +1117,7 @@ CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DIFile Unit, EltTys.push_back(CreateCXXMemberFunction(cast(*SI), Unit, RecordTy)); } -} +} /// CollectCXXFriends - A helper function to collect debug info for /// C++ base classes. This is used while creating debug info entry for @@ -1131,14 +1131,14 @@ CollectCXXFriends(const CXXRecordDecl *RD, llvm::DIFile Unit, if ((*BI)->isUnsupportedFriend()) continue; if (TypeSourceInfo *TInfo = (*BI)->getFriendType()) - EltTys.push_back(DBuilder.createFriend(RecordTy, - getOrCreateType(TInfo->getType(), + EltTys.push_back(DBuilder.createFriend(RecordTy, + getOrCreateType(TInfo->getType(), Unit))); } } /// CollectCXXBases - A helper function to collect debug info for -/// C++ base classes. This is used while creating debug info entry for +/// C++ base classes. This is used while creating debug info entry for /// a Record. void CGDebugInfo:: CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile Unit, @@ -1150,14 +1150,14 @@ CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile Unit, BE = RD->bases_end(); BI != BE; ++BI) { unsigned BFlags = 0; uint64_t BaseOffset; - + const CXXRecordDecl *Base = cast(BI->getType()->getAs()->getDecl()); - + if (BI->isVirtual()) { // virtual base offset offset is -ve. The code generator emits dwarf // expression where it expects +ve number. - BaseOffset = + BaseOffset = 0 - CGM.getVTableContext() .getVirtualBaseOffsetOffset(RD, Base).getQuantity(); BFlags = llvm::DIDescriptor::FlagVirtual; @@ -1165,15 +1165,15 @@ CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile Unit, BaseOffset = CGM.getContext().toBits(RL.getBaseClassOffset(Base)); // FIXME: Inconsistent units for BaseOffset. It is in bytes when // BI->isVirtual() and bits when not. - + AccessSpecifier Access = BI->getAccessSpecifier(); if (Access == clang::AS_private) BFlags |= llvm::DIDescriptor::FlagPrivate; else if (Access == clang::AS_protected) BFlags |= llvm::DIDescriptor::FlagProtected; - - llvm::DIType DTy = - DBuilder.createInheritance(RecordTy, + + llvm::DIType DTy = + DBuilder.createInheritance(RecordTy, getOrCreateType(BI->getType(), Unit), BaseOffset, BFlags); EltTys.push_back(DTy); @@ -1185,7 +1185,7 @@ llvm::DIArray CGDebugInfo:: CollectTemplateParams(const TemplateParameterList *TPList, const TemplateArgumentList &TAList, llvm::DIFile Unit) { - SmallVector TemplateParams; + SmallVector TemplateParams; for (unsigned i = 0, e = TAList.size(); i != e; ++i) { const TemplateArgument &TA = TAList[i]; const NamedDecl *ND = TPList->getParam(i); @@ -1289,7 +1289,7 @@ CollectFunctionTemplateParams(const FunctionDecl *FD, llvm::DIFile Unit) { const TemplateParameterList *TList = FD->getTemplateSpecializationInfo()->getTemplate() ->getTemplateParameters(); - return + return CollectTemplateParams(TList, *FD->getTemplateSpecializationArgs(), Unit); } return llvm::DIArray(); @@ -1303,7 +1303,7 @@ CollectCXXTemplateParams(const ClassTemplateSpecializationDecl *TSpecial, llvm::PointerUnion PU = TSpecial->getSpecializedTemplateOrPartial(); - + TemplateParameterList *TPList = PU.is() ? PU.get()->getTemplateParameters() : PU.get()->getTemplateParameters(); @@ -1364,8 +1364,8 @@ CollectVTableInfo(const CXXRecordDecl *RD, llvm::DIFile Unit, EltTys.push_back(VPTR); } -/// getOrCreateRecordType - Emit record type's standalone debug info. -llvm::DIType CGDebugInfo::getOrCreateRecordType(QualType RTy, +/// getOrCreateRecordType - Emit record type's standalone debug info. +llvm::DIType CGDebugInfo::getOrCreateRecordType(QualType RTy, SourceLocation Loc) { assert(CGM.getCodeGenOpts().getDebugInfo() >= CodeGenOptions::LimitedDebugInfo); llvm::DIType T = getOrCreateType(RTy, getOrCreateFile(Loc)); @@ -1508,7 +1508,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, getOrCreateType(CGM.getContext().getObjCInterfaceType(SClass), Unit); if (!SClassTy.isValid()) return llvm::DIType(); - + llvm::DIType InhTag = DBuilder.createInheritance(RealDecl, SClassTy, 0, 0); EltTys.push_back(InhTag); @@ -1541,7 +1541,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, llvm::DIType FieldTy = getOrCreateType(Field->getType(), Unit); if (!FieldTy.isValid()) return llvm::DIType(); - + StringRef FieldName = Field->getName(); // Ignore unnamed fields. @@ -1588,7 +1588,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, llvm::MDNode *PropertyNode = NULL; if (ObjCImplementationDecl *ImpD = ID->getImplementation()) { - if (ObjCPropertyImplDecl *PImpD = + if (ObjCPropertyImplDecl *PImpD = ImpD->FindPropertyImplIvarDecl(Field->getIdentifier())) { if (ObjCPropertyDecl *PD = PImpD->getPropertyDecl()) { SourceLocation Loc = PD->getLocation(); @@ -1623,7 +1623,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, // private ivars that we would miss otherwise. if (ID->getImplementation() == 0) CompletedTypeCache.erase(QualTy.getAsOpaquePtr()); - + LexicalBlockStack.pop_back(); return RealDecl; } @@ -1686,7 +1686,7 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty, int64_t Count = -1; // Count == -1 is an unbounded array. if (const ConstantArrayType *CAT = dyn_cast(Ty)) Count = CAT->getSize().getZExtValue(); - + // FIXME: Verify this is right for VLAs. Subscripts.push_back(DBuilder.getOrCreateSubrange(0, Count)); EltTy = Ty->getElementType(); @@ -1694,25 +1694,25 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIArray SubscriptArray = DBuilder.getOrCreateArray(Subscripts); - llvm::DIType DbgTy = + llvm::DIType DbgTy = DBuilder.createArrayType(Size, Align, getOrCreateType(EltTy, Unit), SubscriptArray); return DbgTy; } -llvm::DIType CGDebugInfo::CreateType(const LValueReferenceType *Ty, +llvm::DIType CGDebugInfo::CreateType(const LValueReferenceType *Ty, llvm::DIFile Unit) { - return CreatePointerLikeType(llvm::dwarf::DW_TAG_reference_type, + return CreatePointerLikeType(llvm::dwarf::DW_TAG_reference_type, Ty, Ty->getPointeeType(), Unit); } -llvm::DIType CGDebugInfo::CreateType(const RValueReferenceType *Ty, +llvm::DIType CGDebugInfo::CreateType(const RValueReferenceType *Ty, llvm::DIFile Unit) { - return CreatePointerLikeType(llvm::dwarf::DW_TAG_rvalue_reference_type, + return CreatePointerLikeType(llvm::dwarf::DW_TAG_rvalue_reference_type, Ty, Ty->getPointeeType(), Unit); } -llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty, +llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty, llvm::DIFile U) { llvm::DIType ClassType = getOrCreateType(QualType(Ty->getClass(), 0), U); if (!Ty->getPointeeType()->isFunctionType()) @@ -1725,7 +1725,7 @@ llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty, ClassType); } -llvm::DIType CGDebugInfo::CreateType(const AtomicType *Ty, +llvm::DIType CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile U) { // Ignore the atomic wrapping // FIXME: What is the correct representation? @@ -1770,11 +1770,11 @@ llvm::DIType CGDebugInfo::CreateEnumType(const EnumDecl *ED) { llvm::DIFile DefUnit = getOrCreateFile(ED->getLocation()); unsigned Line = getLineNumber(ED->getLocation()); - llvm::DIDescriptor EnumContext = + llvm::DIDescriptor EnumContext = getContextDescriptor(cast(ED->getDeclContext())); llvm::DIType ClassTy = ED->isFixed() ? getOrCreateType(ED->getIntegerType(), DefUnit) : llvm::DIType(); - llvm::DIType DbgTy = + llvm::DIType DbgTy = DBuilder.createEnumerationType(EnumContext, ED->getName(), DefUnit, Line, Size, Align, EltArray, ClassTy); @@ -1820,7 +1820,7 @@ static QualType UnwrapTypeForDebugInfo(QualType T, const ASTContext &C) { T = cast(T)->getDeducedType(); break; } - + assert(T != LastT && "Type unwrapping failed to unwrap!"); (void)LastT; } while (true); @@ -1831,7 +1831,7 @@ llvm::DIType CGDebugInfo::getTypeOrNull(QualType Ty) { // Unwrap the type as needed for debug information. Ty = UnwrapTypeForDebugInfo(Ty, CGM.getContext()); - + // Check for existing entry. if (Ty->getTypeClass() == Type::ObjCInterface) { llvm::Value *V = getCachedInterfaceTypeOrNull(Ty); @@ -1971,7 +1971,7 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty, llvm::DIFile Unit) { return CreateQualifiedType(Ty, Unit); const char *Diag = 0; - + // Work out details of type. switch (Ty->getTypeClass()) { #define TYPE(Class, Base) @@ -2035,7 +2035,7 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty, llvm::DIFile Unit) { case Type::Auto: llvm_unreachable("type should have been unwrapped!"); } - + assert(Diag && "Fall through without a diagnostic?"); unsigned DiagID = CGM.getDiags().getCustomDiagID(DiagnosticsEngine::Error, "debug information for %0 is not yet supported"); @@ -2076,7 +2076,7 @@ llvm::DIType CGDebugInfo::getOrCreateLimitedType(QualType Ty, // TODO: Currently used for context chains when limiting debug info. llvm::DIType CGDebugInfo::CreateLimitedType(const RecordType *Ty) { RecordDecl *RD = Ty->getDecl(); - + // Get overall information about the record type for the debug info. llvm::DIFile DefUnit = getOrCreateFile(RD->getLocation()); unsigned Line = getLineNumber(RD->getLocation()); @@ -2097,7 +2097,7 @@ llvm::DIType CGDebugInfo::CreateLimitedType(const RecordType *Ty) { uint64_t Align = CGM.getContext().getTypeAlign(Ty); const CXXRecordDecl *CXXDecl = dyn_cast(RD); llvm::DICompositeType RealDecl; - + if (RD->isUnion()) RealDecl = DBuilder.createUnionType(RDContext, RDName, DefUnit, Line, Size, Align, 0, llvm::DIArray()); @@ -2231,7 +2231,7 @@ llvm::DIType CGDebugInfo::getOrCreateFunctionType(const Decl *D, llvm::DIType CmdTy = getOrCreateType(OMethod->getCmdDecl()->getType(), F); Elts.push_back(DBuilder.createArtificialType(CmdTy)); // Get rest of the arguments. - for (ObjCMethodDecl::param_const_iterator PI = OMethod->param_begin(), + for (ObjCMethodDecl::param_const_iterator PI = OMethod->param_begin(), PE = OMethod->param_end(); PI != PE; ++PI) Elts.push_back(getOrCreateType((*PI)->getType(), F)); @@ -2356,7 +2356,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, /// information in the source file. void CGDebugInfo::EmitLocation(CGBuilderTy &Builder, SourceLocation Loc, bool ForceColumnInfo) { - + // Update our current location setLocation(Loc); @@ -2371,7 +2371,7 @@ void CGDebugInfo::EmitLocation(CGBuilderTy &Builder, SourceLocation Loc, Builder.getCurrentDebugLocation().getScope(CGM.getLLVMContext()) == LexicalBlockStack.back()) return; - + // Update last state. PrevLoc = CurLoc; @@ -2434,7 +2434,7 @@ void CGDebugInfo::EmitFunctionEnd(CGBuilderTy &Builder) { FnBeginRegionCount.pop_back(); } -// EmitTypeForVarWithBlocksAttr - Build up structure info for the byref. +// EmitTypeForVarWithBlocksAttr - Build up structure info for the byref. // See BuildByRefType. llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD, uint64_t *XOffset) { @@ -2443,9 +2443,9 @@ llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD, QualType FType; uint64_t FieldSize, FieldOffset; unsigned FieldAlign; - + llvm::DIFile Unit = getOrCreateFile(VD->getLocation()); - QualType Type = VD->getType(); + QualType Type = VD->getType(); FieldOffset = 0; FType = CGM.getContext().getPointerType(CGM.getContext().VoidTy); @@ -2471,17 +2471,17 @@ llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD, EltTys.push_back(CreateMemberType(Unit, FType, "__byref_variable_layout", &FieldOffset)); - + CharUnits Align = CGM.getContext().getDeclAlign(VD); if (Align > CGM.getContext().toCharUnitsFromBits( CGM.getTarget().getPointerAlign(0))) { - CharUnits FieldOffsetInBytes + CharUnits FieldOffsetInBytes = CGM.getContext().toCharUnitsFromBits(FieldOffset); CharUnits AlignedOffsetInBytes = FieldOffsetInBytes.RoundUpToAlignment(Align); CharUnits NumPaddingBytes = AlignedOffsetInBytes - FieldOffsetInBytes; - + if (NumPaddingBytes.isPositive()) { llvm::APInt pad(32, NumPaddingBytes.getQuantity()); FType = CGM.getContext().getConstantArrayType(CGM.getContext().CharTy, @@ -2489,30 +2489,30 @@ llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD, EltTys.push_back(CreateMemberType(Unit, FType, "", &FieldOffset)); } } - + FType = Type; llvm::DIType FieldTy = CGDebugInfo::getOrCreateType(FType, Unit); FieldSize = CGM.getContext().getTypeSize(FType); FieldAlign = CGM.getContext().toBits(Align); - *XOffset = FieldOffset; + *XOffset = FieldOffset; FieldTy = DBuilder.createMemberType(Unit, VD->getName(), Unit, 0, FieldSize, FieldAlign, FieldOffset, 0, FieldTy); EltTys.push_back(FieldTy); FieldOffset += FieldSize; - + llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys); - + unsigned Flags = llvm::DIDescriptor::FlagBlockByrefStruct; - + return DBuilder.createStructType(Unit, "", Unit, 0, FieldOffset, 0, Flags, llvm::DIType(), Elements); } /// EmitDeclare - Emit local variable declaration debug info. void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, - llvm::Value *Storage, + llvm::Value *Storage, unsigned ArgNo, CGBuilderTy &Builder) { assert(CGM.getCodeGenOpts().getDebugInfo() >= CodeGenOptions::LimitedDebugInfo); assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!"); @@ -2522,7 +2522,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, uint64_t XOffset = 0; if (VD->hasAttr()) Ty = EmitTypeForVarWithBlocksAttr(VD, &XOffset); - else + else Ty = getOrCreateType(VD->getType(), Unit); // If there is no debug info for this type then do not emit debug info @@ -2544,7 +2544,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, Ty = DBuilder.createReferenceType(llvm::dwarf::DW_TAG_reference_type, Ty); } } - + // Get location information. unsigned Line = getLineNumber(VD->getLocation()); unsigned Column = getColumnNumber(VD->getLocation()); @@ -2580,11 +2580,11 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, // Create the descriptor for the variable. llvm::DIVariable D = - DBuilder.createComplexVariable(Tag, + DBuilder.createComplexVariable(Tag, llvm::DIDescriptor(Scope), VD->getName(), Unit, Line, Ty, addr, ArgNo); - + // Insert an llvm.dbg.declare into the current block. llvm::Instruction *Call = DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock()); @@ -2618,18 +2618,18 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, FieldDecl *Field = *I; llvm::DIType FieldTy = getOrCreateType(Field->getType(), Unit); StringRef FieldName = Field->getName(); - + // Ignore unnamed fields. Do not ignore unnamed records. if (FieldName.empty() && !isa(Field->getType())) continue; - + // Use VarDecl's Tag, Scope and Line number. llvm::DIVariable D = DBuilder.createLocalVariable(Tag, llvm::DIDescriptor(Scope), - FieldName, Unit, Line, FieldTy, + FieldName, Unit, Line, FieldTy, CGM.getLangOpts().Optimize, Flags, ArgNo); - + // Insert an llvm.dbg.declare into the current block. llvm::Instruction *Call = DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock()); @@ -2677,18 +2677,18 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(const VarDecl *VD, const CGBlockInfo &blockInfo) { assert(CGM.getCodeGenOpts().getDebugInfo() >= CodeGenOptions::LimitedDebugInfo); assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!"); - + if (Builder.GetInsertBlock() == 0) return; - + bool isByRef = VD->hasAttr(); - + uint64_t XOffset = 0; llvm::DIFile Unit = getOrCreateFile(VD->getLocation()); llvm::DIType Ty; if (isByRef) Ty = EmitTypeForVarWithBlocksAttr(VD, &XOffset); - else + else Ty = getOrCreateType(VD->getType(), Unit); // Self is passed along as an implicit non-arg variable in a @@ -2728,7 +2728,7 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(const VarDecl *VD, // Create the descriptor for the variable. llvm::DIVariable D = - DBuilder.createComplexVariable(llvm::dwarf::DW_TAG_auto_variable, + DBuilder.createComplexVariable(llvm::dwarf::DW_TAG_auto_variable, llvm::DIDescriptor(LexicalBlockStack.back()), VD->getName(), Unit, Line, Ty, addr); @@ -2771,7 +2771,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, llvm::DIFile tunit = getOrCreateFile(loc); unsigned line = getLineNumber(loc); unsigned column = getColumnNumber(loc); - + // Build the debug-info type for the block literal. getContextDescriptor(cast(blockDecl->getDeclContext())); @@ -2891,7 +2891,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, // Create the descriptor for the parameter. llvm::DIVariable debugVar = DBuilder.createLocalVariable(llvm::dwarf::DW_TAG_arg_variable, - llvm::DIDescriptor(scope), + llvm::DIDescriptor(scope), Arg->getName(), tunit, line, type, CGM.getLangOpts().Optimize, flags, cast(Arg)->getArgNo() + 1); @@ -2952,7 +2952,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, LinkageName = Var->getName(); if (LinkageName == DeclName) LinkageName = StringRef(); - llvm::DIDescriptor DContext = + llvm::DIDescriptor DContext = getContextDescriptor(dyn_cast(D->getDeclContext())); DBuilder.createStaticVariable(DContext, DeclName, LinkageName, Unit, LineNo, getOrCreateType(T, Unit), @@ -2987,7 +2987,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, } /// EmitGlobalVariable - Emit global variable's debug info. -void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, +void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, llvm::Constant *Init) { assert(CGM.getCodeGenOpts().getDebugInfo() >= CodeGenOptions::LimitedDebugInfo); // Create the descriptor for the variable. @@ -3020,16 +3020,16 @@ void CGDebugInfo::EmitUsingDirective(const UsingDirectiveDecl &UD) { /// getOrCreateNamesSpace - Return namespace descriptor for the given /// namespace decl. -llvm::DINameSpace +llvm::DINameSpace CGDebugInfo::getOrCreateNameSpace(const NamespaceDecl *NSDecl) { - llvm::DenseMap::iterator I = + llvm::DenseMap::iterator I = NameSpaceCache.find(NSDecl); if (I != NameSpaceCache.end()) return llvm::DINameSpace(cast(I->second)); - + unsigned LineNo = getLineNumber(NSDecl->getLocation()); llvm::DIFile FileD = getOrCreateFile(NSDecl->getLocation()); - llvm::DIDescriptor Context = + llvm::DIDescriptor Context = getContextDescriptor(dyn_cast(NSDecl->getDeclContext())); llvm::DINameSpace NS = DBuilder.createNameSpace(Context, NSDecl->getName(), FileD, LineNo); @@ -3044,7 +3044,7 @@ void CGDebugInfo::finalize() { // Verify that the debug info still exists. if (llvm::Value *V = VI->second) Ty = llvm::DIType(cast(V)); - + llvm::DenseMap::iterator it = TypeCache.find(VI->first); if (it != TypeCache.end()) {