Deleted Added
full compact
67c67,74
<
---
>
> if (const RecordDecl *RDecl = dyn_cast<RecordDecl>(Context)) {
> if (!RDecl->isDependentType()) {
> llvm::DIType Ty = getOrCreateType(CGM.getContext().getTypeDeclType(RDecl),
> llvm::DIFile(CompileUnit));
> return llvm::DIDescriptor(Ty);
> }
> }
117c124
< DIFileCache[fname] = F.getNode();
---
> DIFileCache[fname] = F;
120a128,146
>
> /// getLineNumber - Get line number for the location. If location is invalid
> /// then use current location.
> unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) {
> assert (CurLoc.isValid() && "Invalid current location!");
> SourceManager &SM = CGM.getContext().getSourceManager();
> PresumedLoc PLoc = SM.getPresumedLoc(Loc.isValid() ? Loc : CurLoc);
> return PLoc.getLine();
> }
>
> /// getColumnNumber - Get column number for the location. If location is
> /// invalid then use current location.
> unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc) {
> assert (CurLoc.isValid() && "Invalid current location!");
> SourceManager &SM = CGM.getContext().getSourceManager();
> PresumedLoc PLoc = SM.getPresumedLoc(Loc.isValid() ? Loc : CurLoc);
> return PLoc.getColumn();
> }
>
329a356
> unsigned LineNo = getLineNumber(CurLoc);
332,333c359,360
< Unit, 0, FieldOffset, 0, 0, Flags,
< llvm::DIType(), Elements);
---
> Unit, LineNo, FieldOffset, 0, 0,
> Flags, llvm::DIType(), Elements);
341c368
< 0, Size, Align, 0, 0, EltTy);
---
> LineNo, Size, Align, 0, 0, EltTy);
358c385
< 0, FieldSize, FieldAlign,
---
> LineNo, FieldSize, FieldAlign,
366,367c393,394
< Unit, 0, FieldOffset, 0, 0, Flags,
< llvm::DIType(), Elements);
---
> Unit, LineNo, FieldOffset, 0, 0,
> Flags, llvm::DIType(), Elements);
373c400
< 0, Size, Align, 0, 0, EltTy);
---
> LineNo, Size, Align, 0, 0, EltTy);
385,387c412
< SourceManager &SM = CGM.getContext().getSourceManager();
< PresumedLoc PLoc = SM.getPresumedLoc(Ty->getDecl()->getLocation());
< unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine();
---
> unsigned Line = getLineNumber(Ty->getDecl()->getLocation());
433d457
< SourceManager &SM = CGM.getContext().getSourceManager();
448,457c472,473
< SourceLocation FieldDefLoc = Field->getLocation();
< PresumedLoc PLoc = SM.getPresumedLoc(FieldDefLoc);
< llvm::DIFile FieldDefUnit;
< unsigned FieldLine = 0;
<
< if (!PLoc.isInvalid()) {
< FieldDefUnit = getOrCreateFile(FieldDefLoc);
< FieldLine = PLoc.getLine();
< }
<
---
> llvm::DIFile FieldDefUnit = getOrCreateFile(Field->getLocation());
> unsigned FieldLine = getLineNumber(Field->getLocation());
509c525
< llvm::DIArray Args = llvm::DICompositeType(FnTy.getNode()).getTypeArray();
---
> llvm::DIArray Args = llvm::DICompositeType(FnTy).getTypeArray();
523c539
< TypeCache[ThisPtr.getAsOpaquePtr()] = ThisPtrType.getNode();
---
> TypeCache[ThisPtr.getAsOpaquePtr()] = ThisPtrType;
558,559d573
< SourceManager &SM = CGM.getContext().getSourceManager();
<
561,564c575,576
< SourceLocation MethodDefLoc = Method->getLocation();
< PresumedLoc PLoc = SM.getPresumedLoc(MethodDefLoc);
< llvm::DIFile MethodDefUnit;
< unsigned MethodLine = 0;
---
> llvm::DIFile MethodDefUnit = getOrCreateFile(Method->getLocation());
> unsigned MethodLine = getLineNumber(Method->getLocation());
566,570d577
< if (!PLoc.isInvalid()) {
< MethodDefUnit = getOrCreateFile(MethodDefLoc);
< MethodLine = PLoc.getLine();
< }
<
600c607
< SPCache[Method] = llvm::WeakVH(SP.getNode());
---
> SPCache[Method] = llvm::WeakVH(SP);
744,745d750
< SourceManager &SM = CGM.getContext().getSourceManager();
<
747,753c752,753
< PresumedLoc PLoc = SM.getPresumedLoc(RD->getLocation());
< llvm::DIFile DefUnit;
< unsigned Line = 0;
< if (!PLoc.isInvalid()) {
< DefUnit = getOrCreateFile(RD->getLocation());
< Line = PLoc.getLine();
< }
---
> llvm::DIFile DefUnit = getOrCreateFile(RD->getLocation());
> unsigned Line = getLineNumber(RD->getLocation());
777c777,778
< llvm::TrackingVH<llvm::MDNode> FwdDeclNode = FwdDecl.getNode();
---
> llvm::MDNode *MN = FwdDecl;
> llvm::TrackingVH<llvm::MDNode> FwdDeclNode = MN;
780c781
< TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl.getNode();
---
> TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl;
782,783c783,784
< RegionStack.push_back(FwdDecl.getNode());
< RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl.getNode());
---
> RegionStack.push_back(FwdDeclNode);
> RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl);
802c803
< getOrCreateType(QualType(PBase->getTypeForDecl(), 0), Unit).getNode();
---
> getOrCreateType(QualType(PBase->getTypeForDecl(), 0), Unit);
804c805
< ContainingType = FwdDecl.getNode();
---
> ContainingType = FwdDecl;
832c833
< RegionMap[RD] = llvm::WeakVH(RealDecl.getNode());
---
> RegionMap[RD] = llvm::WeakVH(RealDecl);
835a837,843
> /// CreateType - get objective-c object type.
> llvm::DIType CGDebugInfo::CreateType(const ObjCObjectType *Ty,
> llvm::DIFile Unit) {
> // Ignore protocols.
> return getOrCreateType(Ty->getBaseType(), Unit);
> }
>
840d847
<
842d848
< SourceManager &SM = CGM.getContext().getSourceManager();
846,849c852
< PresumedLoc PLoc = SM.getPresumedLoc(ID->getLocation());
< unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine();
<
<
---
> unsigned Line = getLineNumber(ID->getLocation());
868c871,872
< llvm::TrackingVH<llvm::MDNode> FwdDeclNode = FwdDecl.getNode();
---
> llvm::MDNode *MN = FwdDecl;
> llvm::TrackingVH<llvm::MDNode> FwdDeclNode = MN;
871c875
< TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl.getNode();
---
> TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl;
873,874c877,878
< RegionStack.push_back(FwdDecl.getNode());
< RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl.getNode());
---
> RegionStack.push_back(FwdDeclNode);
> RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl);
905,910c909,910
< SourceLocation FieldDefLoc = Field->getLocation();
< llvm::DIFile FieldDefUnit = getOrCreateFile(FieldDefLoc);
< PresumedLoc PLoc = SM.getPresumedLoc(FieldDefLoc);
< unsigned FieldLine = PLoc.isInvalid() ? 0 : PLoc.getLine();
<
<
---
> llvm::DIFile FieldDefUnit = getOrCreateFile(Field->getLocation());
> unsigned FieldLine = getLineNumber(Field->getLocation());
965c965
< RegionMap[ID] = llvm::WeakVH(RealDecl.getNode());
---
> RegionMap[ID] = llvm::WeakVH(RealDecl);
988,992c988,989
< SourceLocation DefLoc = ED->getLocation();
< llvm::DIFile DefUnit = getOrCreateFile(DefLoc);
< SourceManager &SM = CGM.getContext().getSourceManager();
< PresumedLoc PLoc = SM.getPresumedLoc(DefLoc);
< unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine();
---
> llvm::DIFile DefUnit = getOrCreateFile(ED->getLocation());
> unsigned Line = getLineNumber(ED->getLocation());
994d990
<
1155,1156c1151,1152
< case Type::QualifiedName:
< T = cast<QualifiedNameType>(T)->getNamedType();
---
> case Type::Elaborated:
> T = cast<ElaboratedType>(T)->getNamedType();
1161,1163d1156
< case Type::Elaborated:
< T = cast<ElaboratedType>(T)->getUnderlyingType();
< break;
1197c1190
< TypeCache[Ty.getAsOpaquePtr()] = Res.getNode();
---
> TypeCache[Ty.getAsOpaquePtr()] = Res;
1226a1220,1221
> case Type::ObjCObject:
> return CreateType(cast<ObjCObjectType>(Ty), Unit);
1254d1248
< case Type::QualifiedName:
1307,1309c1301,1304
< if (SP.isSubprogram() && llvm::DISubprogram(SP.getNode()).isDefinition()) {
< RegionStack.push_back(SP.getNode());
< RegionMap[D] = llvm::WeakVH(SP.getNode());
---
> if (SP.isSubprogram() && llvm::DISubprogram(SP).isDefinition()) {
> llvm::MDNode *SPN = SP;
> RegionStack.push_back(SPN);
> RegionMap[D] = llvm::WeakVH(SP);
1328,1329c1323
< SourceManager &SM = CGM.getContext().getSourceManager();
< unsigned LineNo = SM.getPresumedLoc(CurLoc).getLine();
---
> unsigned LineNo = getLineNumber(CurLoc);
1337,1338c1331,1333
< RegionStack.push_back(SP.getNode());
< RegionMap[D] = llvm::WeakVH(SP.getNode());
---
> llvm::MDNode *SPN = SP;
> RegionStack.push_back(SPN);
> RegionMap[D] = llvm::WeakVH(SP);
1358,1361d1352
< // Get the appropriate compile unit.
< llvm::DIFile Unit = getOrCreateFile(CurLoc);
< PresumedLoc PLoc = SM.getPresumedLoc(CurLoc);
<
1363,1364c1354,1355
< Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(PLoc.getLine(),
< PLoc.getColumn(),
---
> Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(getLineNumber(CurLoc),
> getColumnNumber(CurLoc),
1371,1372d1361
< SourceManager &SM = CGM.getContext().getSourceManager();
< PresumedLoc PLoc = SM.getPresumedLoc(CurLoc);
1377,1378c1366,1369
< PLoc.getLine(), PLoc.getColumn());
< RegionStack.push_back(D.getNode());
---
> getLineNumber(CurLoc),
> getColumnNumber(CurLoc));
> llvm::MDNode *DN = D;
> RegionStack.push_back(DN);
1475a1467,1471
> // If there is not any debug info for type then do not emit debug info
> // for this variable.
> if (!Ty)
> return;
>
1477,1489c1473,1474
< SourceManager &SM = CGM.getContext().getSourceManager();
< PresumedLoc PLoc = SM.getPresumedLoc(VD->getLocation());
< unsigned Line = 0;
< unsigned Column = 0;
< if (PLoc.isInvalid())
< PLoc = SM.getPresumedLoc(CurLoc);
< if (PLoc.isValid()) {
< Line = PLoc.getLine();
< Column = PLoc.getColumn();
< Unit = getOrCreateFile(CurLoc);
< } else {
< Unit = llvm::DIFile();
< }
---
> unsigned Line = getLineNumber(VD->getLocation());
> unsigned Column = getColumnNumber(VD->getLocation());
1523,1529c1508,1509
< SourceManager &SM = CGM.getContext().getSourceManager();
< PresumedLoc PLoc = SM.getPresumedLoc(VD->getLocation());
< unsigned Line = 0;
< if (!PLoc.isInvalid())
< Line = PLoc.getLine();
< else
< Unit = llvm::DIFile();
---
> unsigned Line = getLineNumber(VD->getLocation());
> unsigned Column = getColumnNumber(VD->getLocation());
1561c1541
< Call->setDebugLoc(llvm::DebugLoc::get(Line, PLoc.getColumn(), Scope));
---
> Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
1591,1593c1571
< SourceManager &SM = CGM.getContext().getSourceManager();
< PresumedLoc PLoc = SM.getPresumedLoc(D->getLocation());
< unsigned LineNo = PLoc.isInvalid() ? 0 : PLoc.getLine();
---
> unsigned LineNo = getLineNumber(D->getLocation());
1607a1586,1588
> llvm::StringRef LinkageName;
> if (D->getDeclContext() && !isa<FunctionDecl>(D->getDeclContext()))
> LinkageName = Var->getName();
1610,1612c1591,1592
< DebugFactory.CreateGlobalVariable(DContext, DeclName,
< DeclName, llvm::StringRef(), Unit, LineNo,
< getOrCreateType(T, Unit),
---
> DebugFactory.CreateGlobalVariable(DContext, DeclName, DeclName, LinkageName,
> Unit, LineNo, getOrCreateType(T, Unit),
1622,1624c1602
< SourceManager &SM = CGM.getContext().getSourceManager();
< PresumedLoc PLoc = SM.getPresumedLoc(ID->getLocation());
< unsigned LineNo = PLoc.isInvalid() ? 0 : PLoc.getLine();
---
> unsigned LineNo = getLineNumber(ID->getLocation());
1657,1659c1635
< SourceManager &SM = CGM.getContext().getSourceManager();
< PresumedLoc PLoc = SM.getPresumedLoc(NSDecl->getLocation());
< unsigned LineNo = PLoc.isInvalid() ? 0 : PLoc.getLine();
---
> unsigned LineNo = getLineNumber(NSDecl->getLocation());
1665,1666c1641,1642
< llvm::DIFile(Unit.getNode()), LineNo);
< NameSpaceCache[NSDecl] = llvm::WeakVH(NS.getNode());
---
> llvm::DIFile(Unit), LineNo);
> NameSpaceCache[NSDecl] = llvm::WeakVH(NS);