[cfe-commits] r140740 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h CGObjC.cpp CGStmt.cpp
Eric Christopher
echristo at apple.com
Wed Sep 28 17:00:45 PDT 2011
Author: echristo
Date: Wed Sep 28 19:00:45 2011
New Revision: 140740
URL: http://llvm.org/viewvc/llvm-project?rev=140740&view=rev
Log:
Change "Regions" to be "LexicalBlocks" since that's what they
correspond to.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=140740&r1=140739&r2=140740&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Sep 28 19:00:45 2011
@@ -46,7 +46,7 @@
}
CGDebugInfo::~CGDebugInfo() {
- assert(RegionStack.empty() && "Region stack mismatch, stack not empty!");
+ assert(LexicalBlockStack.empty() && "Region stack mismatch, stack not empty!");
}
void CGDebugInfo::setLocation(SourceLocation Loc) {
@@ -1030,7 +1030,7 @@
// it.
TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl;
// Push the struct on region stack.
- RegionStack.push_back(FwdDeclNode);
+ LexicalBlockStack.push_back(FwdDeclNode);
RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl);
// Convert all the elements.
@@ -1076,7 +1076,7 @@
TParamsArray = CollectCXXTemplateParams(TSpecial, Unit);
}
- RegionStack.pop_back();
+ LexicalBlockStack.pop_back();
llvm::DenseMap<const Decl *, llvm::WeakVH>::iterator RI =
RegionMap.find(Ty->getDecl());
if (RI != RegionMap.end())
@@ -1172,7 +1172,7 @@
// it.
TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = FwdDecl;
// Push the struct on region stack.
- RegionStack.push_back(FwdDeclNode);
+ LexicalBlockStack.push_back(FwdDeclNode);
RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl);
// Convert all the elements.
@@ -1256,7 +1256,7 @@
llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys);
- RegionStack.pop_back();
+ LexicalBlockStack.pop_back();
llvm::DenseMap<const Decl *, llvm::WeakVH>::iterator RI =
RegionMap.find(Ty->getDecl());
if (RI != RegionMap.end())
@@ -1679,7 +1679,7 @@
StringRef Name;
StringRef LinkageName;
- FnBeginRegionCount.push_back(RegionStack.size());
+ FnBeginRegionCount.push_back(LexicalBlockStack.size());
const Decl *D = GD.getDecl();
@@ -1695,7 +1695,7 @@
llvm::DIDescriptor SP(dyn_cast_or_null<llvm::MDNode>(&*FI->second));
if (SP.isSubprogram() && llvm::DISubprogram(SP).isDefinition()) {
llvm::MDNode *SPN = SP;
- RegionStack.push_back(SPN);
+ LexicalBlockStack.push_back(SPN);
RegionMap[D] = llvm::WeakVH(SP);
return;
}
@@ -1744,7 +1744,7 @@
// Push function on region stack.
llvm::MDNode *SPN = SP;
- RegionStack.push_back(SPN);
+ LexicalBlockStack.push_back(SPN);
RegionMap[D] = llvm::WeakVH(SP);
// Clear stack used to keep track of #line directives.
@@ -1767,12 +1767,12 @@
// If #line directive stack is empty then we are entering a new scope.
if (LineDirectiveFiles.empty()) {
- EmitRegionStart(Builder);
+ EmitLexicalBlockStart(Builder);
LineDirectiveFiles.push_back(PCLoc.getFilename());
return;
}
- assert (RegionStack.size() >= LineDirectiveFiles.size()
+ assert (LexicalBlockStack.size() >= LineDirectiveFiles.size()
&& "error handling #line regions!");
bool SeenThisFile = false;
@@ -1788,7 +1788,7 @@
if (SeenThisFile) {
while (!LineDirectiveFiles.empty()) {
const char *LastFile = LineDirectiveFiles.back();
- RegionStack.pop_back();
+ LexicalBlockStack.pop_back();
LineDirectiveFiles.pop_back();
if (!strcmp(PPLoc.getFilename(), LastFile))
break;
@@ -1797,7 +1797,7 @@
}
// .. otherwise insert new #line region.
- EmitRegionStart(Builder);
+ EmitLexicalBlockStart(Builder);
LineDirectiveFiles.push_back(PCLoc.getFilename());
return;
@@ -1823,46 +1823,46 @@
// Update last state.
PrevLoc = CurLoc;
- llvm::MDNode *Scope = RegionStack.back();
+ llvm::MDNode *Scope = LexicalBlockStack.back();
Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(getLineNumber(CurLoc),
getColumnNumber(CurLoc),
Scope));
}
-/// EmitRegionStart- Constructs the debug code for entering a declarative
+/// EmitLexicalBlockStart - Constructs the debug code for entering a declarative
/// region - beginning of a DW_TAG_lexical_block.
-void CGDebugInfo::EmitRegionStart(CGBuilderTy &Builder) {
+void CGDebugInfo::EmitLexicalBlockStart(CGBuilderTy &Builder) {
llvm::DIDescriptor D =
- DBuilder.createLexicalBlock(RegionStack.empty() ?
+ DBuilder.createLexicalBlock(LexicalBlockStack.empty() ?
llvm::DIDescriptor() :
- llvm::DIDescriptor(RegionStack.back()),
+ llvm::DIDescriptor(LexicalBlockStack.back()),
getOrCreateFile(CurLoc),
getLineNumber(CurLoc),
getColumnNumber(CurLoc));
llvm::MDNode *DN = D;
- RegionStack.push_back(DN);
+ LexicalBlockStack.push_back(DN);
}
-/// EmitRegionEnd - Constructs the debug code for exiting a declarative
+/// EmitLexicalBlockEnd - Constructs the debug code for exiting a declarative
/// region - end of a DW_TAG_lexical_block.
-void CGDebugInfo::EmitRegionEnd(CGBuilderTy &Builder) {
- assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
+void CGDebugInfo::EmitLexicalBlockEnd(CGBuilderTy &Builder) {
+ assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");
// Provide a region stop point.
EmitLocation(Builder);
- RegionStack.pop_back();
+ LexicalBlockStack.pop_back();
}
/// EmitFunctionEnd - Constructs the debug code for exiting a function.
void CGDebugInfo::EmitFunctionEnd(CGBuilderTy &Builder) {
- assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
+ assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");
unsigned RCount = FnBeginRegionCount.back();
- assert(RCount <= RegionStack.size() && "Region stack mismatch");
+ assert(RCount <= LexicalBlockStack.size() && "Region stack mismatch");
// Pop all regions for this function.
- while (RegionStack.size() != RCount)
- EmitRegionEnd(Builder);
+ while (LexicalBlockStack.size() != RCount)
+ EmitLexicalBlockEnd(Builder);
FnBeginRegionCount.pop_back();
}
@@ -1938,7 +1938,7 @@
void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
llvm::Value *Storage,
unsigned ArgNo, CGBuilderTy &Builder) {
- assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
+ assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");
llvm::DIFile Unit = getOrCreateFile(VD->getLocation());
llvm::DIType Ty;
@@ -1973,7 +1973,7 @@
unsigned Flags = 0;
if (VD->isImplicit())
Flags |= llvm::DIDescriptor::FlagArtificial;
- llvm::MDNode *Scope = RegionStack.back();
+ llvm::MDNode *Scope = LexicalBlockStack.back();
StringRef Name = VD->getName();
if (!Name.empty()) {
@@ -1995,7 +1995,7 @@
// Create the descriptor for the variable.
llvm::DIVariable D =
DBuilder.createComplexVariable(Tag,
- llvm::DIDescriptor(RegionStack.back()),
+ llvm::DIDescriptor(LexicalBlockStack.back()),
VD->getName(), Unit, Line, Ty,
addr, ArgNo);
@@ -2062,7 +2062,7 @@
void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
const VarDecl *VD, llvm::Value *Storage, CGBuilderTy &Builder,
const CGBlockInfo &blockInfo) {
- assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
+ assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");
if (Builder.GetInsertBlock() == 0)
return;
@@ -2107,13 +2107,13 @@
// Create the descriptor for the variable.
llvm::DIVariable D =
DBuilder.createComplexVariable(llvm::dwarf::DW_TAG_auto_variable,
- llvm::DIDescriptor(RegionStack.back()),
+ llvm::DIDescriptor(LexicalBlockStack.back()),
VD->getName(), Unit, Line, Ty, addr);
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *Call =
DBuilder.insertDeclare(Storage, D, Builder.GetInsertPoint());
- llvm::MDNode *Scope = RegionStack.back();
+ llvm::MDNode *Scope = LexicalBlockStack.back();
Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
}
@@ -2261,7 +2261,7 @@
// Get overall information about the block.
unsigned flags = llvm::DIDescriptor::FlagArtificial;
- llvm::MDNode *scope = RegionStack.back();
+ llvm::MDNode *scope = LexicalBlockStack.back();
StringRef name = ".block_descriptor";
// Create the descriptor for the parameter.
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=140740&r1=140739&r2=140740&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Sep 28 19:00:45 2011
@@ -56,11 +56,12 @@
bool BlockLiteralGenericSet;
llvm::DIType BlockLiteralGeneric;
- std::vector<llvm::TrackingVH<llvm::MDNode> > RegionStack;
+ // LexicalBlockStack - Keep track of our current nested lexical block.
+ std::vector<llvm::TrackingVH<llvm::MDNode> > LexicalBlockStack;
llvm::DenseMap<const Decl *, llvm::WeakVH> RegionMap;
- // FnBeginRegionCount - Keep track of RegionStack counter at the beginning
- // of a function. This is used to pop unbalanced regions at the end of a
- // function.
+ // FnBeginRegionCount - Keep track of LexicalBlockStack counter at the
+ // beginning of a function. This is used to pop unbalanced regions at
+ // the end of a function.
std::vector<unsigned> FnBeginRegionCount;
/// LineDirectiveFiles - This stack is used to keep track of
@@ -178,13 +179,13 @@
/// translated.
void UpdateCompletedType(const TagDecl *TD);
- /// EmitRegionStart - Emit a call to llvm.dbg.region.start to indicate start
- /// of a new block.
- void EmitRegionStart(CGBuilderTy &Builder);
-
- /// EmitRegionEnd - Emit call to llvm.dbg.region.end to indicate end of a
- /// block.
- void EmitRegionEnd(CGBuilderTy &Builder);
+ /// EmitLexicalBlockStart - Emit metadata to indicate the beginning of a
+ /// new lexical block and push the block onto the stack.
+ void EmitLexicalBlockStart(CGBuilderTy &Builder);
+
+ /// EmitLexicalBlockEnd - Emit metadata to indicate the end of a new lexical
+ /// block and pop the current block.
+ void EmitLexicalBlockEnd(CGBuilderTy &Builder);
/// EmitDeclareOfAutoVariable - Emit call to llvm.dbg.declare for an automatic
/// variable declaration.
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=140740&r1=140739&r2=140740&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Wed Sep 28 19:00:45 2011
@@ -1210,7 +1210,7 @@
CGDebugInfo *DI = getDebugInfo();
if (DI) {
DI->setLocation(S.getSourceRange().getBegin());
- DI->EmitRegionStart(Builder);
+ DI->EmitLexicalBlockStart(Builder);
}
// The local variable comes into scope immediately.
@@ -1467,7 +1467,7 @@
if (DI) {
DI->setLocation(S.getSourceRange().getEnd());
- DI->EmitRegionEnd(Builder);
+ DI->EmitLexicalBlockEnd(Builder);
}
// Leave the cleanup we entered in ARC.
@@ -2442,7 +2442,7 @@
CGDebugInfo *DI = getDebugInfo();
if (DI) {
DI->setLocation(S.getLBracLoc());
- DI->EmitRegionStart(Builder);
+ DI->EmitLexicalBlockStart(Builder);
}
// Keep track of the current cleanup stack depth.
@@ -2461,7 +2461,7 @@
if (DI) {
DI->setLocation(S.getRBracLoc());
- DI->EmitRegionEnd(Builder);
+ DI->EmitLexicalBlockEnd(Builder);
}
}
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=140740&r1=140739&r2=140740&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Wed Sep 28 19:00:45 2011
@@ -192,7 +192,7 @@
CGDebugInfo *DI = getDebugInfo();
if (DI) {
DI->setLocation(S.getLBracLoc());
- DI->EmitRegionStart(Builder);
+ DI->EmitLexicalBlockStart(Builder);
}
// Keep track of the current cleanup stack depth.
@@ -204,7 +204,7 @@
if (DI) {
DI->setLocation(S.getRBracLoc());
- DI->EmitRegionEnd(Builder);
+ DI->EmitLexicalBlockEnd(Builder);
}
RValue RV;
@@ -572,7 +572,7 @@
CGDebugInfo *DI = getDebugInfo();
if (DI) {
DI->setLocation(S.getSourceRange().getBegin());
- DI->EmitRegionStart(Builder);
+ DI->EmitLexicalBlockStart(Builder);
}
// Evaluate the first part before the loop.
@@ -654,7 +654,7 @@
if (DI) {
DI->setLocation(S.getSourceRange().getEnd());
- DI->EmitRegionEnd(Builder);
+ DI->EmitLexicalBlockEnd(Builder);
}
// Emit the fall-through block.
@@ -669,7 +669,7 @@
CGDebugInfo *DI = getDebugInfo();
if (DI) {
DI->setLocation(S.getSourceRange().getBegin());
- DI->EmitRegionStart(Builder);
+ DI->EmitLexicalBlockStart(Builder);
}
// Evaluate the first pieces before the loop.
@@ -728,7 +728,7 @@
if (DI) {
DI->setLocation(S.getSourceRange().getEnd());
- DI->EmitRegionEnd(Builder);
+ DI->EmitLexicalBlockEnd(Builder);
}
// Emit the fall-through block.
More information about the cfe-commits
mailing list