[cfe-commits] r88677 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h
Devang Patel
dpatel at apple.com
Fri Nov 13 11:10:24 PST 2009
Author: dpatel
Date: Fri Nov 13 13:10:24 2009
New Revision: 88677
URL: http://llvm.org/viewvc/llvm-project?rev=88677&view=rev
Log:
Do not store DIDescriptor directly into a container. Store MDNode directly, through TrackingVH.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=88677&r1=88676&r2=88677&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Nov 13 13:10:24 2009
@@ -57,7 +57,7 @@
if (Decl->getDeclContext()->isFunctionOrMethod()) {
// Find the last subprogram in region stack.
for (unsigned RI = RegionStack.size(), RE = 0; RI != RE; --RI) {
- llvm::DIDescriptor R = RegionStack[RI - 1];
+ llvm::DIDescriptor R(RegionStack[RI - 1]);
if (R.isSubprogram())
return R;
}
@@ -935,7 +935,7 @@
Fn->hasInternalLinkage(), true/*definition*/);
// Push function on region stack.
- RegionStack.push_back(SP);
+ RegionStack.push_back(SP.getNode());
}
@@ -957,7 +957,7 @@
llvm::DICompileUnit Unit = getOrCreateCompileUnit(CurLoc);
PresumedLoc PLoc = SM.getPresumedLoc(CurLoc);
- llvm::DIDescriptor DR = RegionStack.back();
+ llvm::DIDescriptor DR(RegionStack.back());
llvm::DIScope DS = llvm::DIScope(DR.getNode());
llvm::DILocation DO(NULL);
llvm::DILocation DL =
@@ -969,11 +969,11 @@
/// EmitRegionStart- Constructs the debug code for entering a declarative
/// region - "llvm.dbg.region.start.".
void CGDebugInfo::EmitRegionStart(llvm::Function *Fn, CGBuilderTy &Builder) {
- llvm::DIDescriptor D;
- if (!RegionStack.empty())
- D = RegionStack.back();
- D = DebugFactory.CreateLexicalBlock(D);
- RegionStack.push_back(D);
+ llvm::DIDescriptor D =
+ DebugFactory.CreateLexicalBlock(RegionStack.empty() ?
+ llvm::DIDescriptor() :
+ llvm::DIDescriptor(RegionStack.back()));
+ RegionStack.push_back(D.getNode());
}
/// EmitRegionEnd - Constructs the debug code for exiting a declarative
@@ -1145,14 +1145,14 @@
// Create the descriptor for the variable.
llvm::DIVariable D =
- DebugFactory.CreateVariable(Tag, RegionStack.back(),Decl->getNameAsCString(),
+ DebugFactory.CreateVariable(Tag, llvm::DIDescriptor(RegionStack.back()),
+ Decl->getNameAsCString(),
Unit, Line, Ty);
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *Call =
DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());
- llvm::DIDescriptor DR = RegionStack.back();
- llvm::DIScope DS = llvm::DIScope(DR.getNode());
+ llvm::DIScope DS(RegionStack.back());
llvm::DILocation DO(NULL);
llvm::DILocation DL =
DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
@@ -1346,15 +1346,14 @@
// Create the descriptor for the variable.
llvm::DIVariable D =
- DebugFactory.CreateComplexVariable(Tag, RegionStack.back(),
+ DebugFactory.CreateComplexVariable(Tag, llvm::DIDescriptor(RegionStack.back()),
Decl->getNameAsCString(), Unit, Line, Ty,
addr);
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *Call =
DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertPoint());
- llvm::DIDescriptor DR = RegionStack.back();
- llvm::DIScope DS = llvm::DIScope(DR.getNode());
+ llvm::DIScope DS(RegionStack.back());
llvm::DILocation DO(NULL);
llvm::DILocation DL =
DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=88677&r1=88676&r2=88677&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Fri Nov 13 13:10:24 2009
@@ -56,7 +56,7 @@
bool BlockLiteralGenericSet;
llvm::DIType BlockLiteralGeneric;
- std::vector<llvm::DIDescriptor> RegionStack;
+ std::vector<llvm::TrackingVH<llvm::MDNode> > RegionStack;
/// Helper functions for getOrCreateType.
llvm::DIType CreateType(const BuiltinType *Ty, llvm::DICompileUnit U);
More information about the cfe-commits
mailing list