зеркало из https://github.com/microsoft/clang-1.git
Change "Regions" to be "LexicalBlocks" since that's what they
correspond to. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140740 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
5321bc492b
Коммит
aa2164cc2a
|
@ -46,7 +46,7 @@ CGDebugInfo::CGDebugInfo(CodeGenModule &CGM)
|
|||
}
|
||||
|
||||
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 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) {
|
|||
// 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 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) {
|
|||
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 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
|
|||
// 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::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
|
|||
|
||||
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 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType,
|
|||
StringRef Name;
|
||||
StringRef LinkageName;
|
||||
|
||||
FnBeginRegionCount.push_back(RegionStack.size());
|
||||
FnBeginRegionCount.push_back(LexicalBlockStack.size());
|
||||
|
||||
const Decl *D = GD.getDecl();
|
||||
|
||||
|
@ -1695,7 +1695,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType,
|
|||
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 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType,
|
|||
|
||||
// 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 @@ void CGDebugInfo::UpdateLineDirectiveRegion(CGBuilderTy &Builder) {
|
|||
|
||||
// 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 @@ void CGDebugInfo::UpdateLineDirectiveRegion(CGBuilderTy &Builder) {
|
|||
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 @@ void CGDebugInfo::UpdateLineDirectiveRegion(CGBuilderTy &Builder) {
|
|||
}
|
||||
|
||||
// .. otherwise insert new #line region.
|
||||
EmitRegionStart(Builder);
|
||||
EmitLexicalBlockStart(Builder);
|
||||
LineDirectiveFiles.push_back(PCLoc.getFilename());
|
||||
|
||||
return;
|
||||
|
@ -1823,46 +1823,46 @@ void CGDebugInfo::EmitLocation(CGBuilderTy &Builder) {
|
|||
// 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 @@ llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const ValueDecl *VD,
|
|||
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 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
|
|||
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 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
|
|||
// 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::EmitDeclareOfAutoVariable(const VarDecl *VD,
|
|||
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 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
|
|||
// 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 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block,
|
|||
|
||||
// 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.
|
||||
|
|
|
@ -56,11 +56,12 @@ class CGDebugInfo {
|
|||
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 @@ public:
|
|||
/// 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);
|
||||
/// EmitLexicalBlockStart - Emit metadata to indicate the beginning of a
|
||||
/// new lexical block and push the block onto the stack.
|
||||
void EmitLexicalBlockStart(CGBuilderTy &Builder);
|
||||
|
||||
/// EmitRegionEnd - Emit call to llvm.dbg.region.end to indicate end of a
|
||||
/// block.
|
||||
void EmitRegionEnd(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.
|
||||
|
|
|
@ -1210,7 +1210,7 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
|
|||
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 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
|
|||
|
||||
if (DI) {
|
||||
DI->setLocation(S.getSourceRange().getEnd());
|
||||
DI->EmitRegionEnd(Builder);
|
||||
DI->EmitLexicalBlockEnd(Builder);
|
||||
}
|
||||
|
||||
// Leave the cleanup we entered in ARC.
|
||||
|
@ -2442,7 +2442,7 @@ void CodeGenFunction::EmitObjCAutoreleasePoolStmt(
|
|||
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 @@ void CodeGenFunction::EmitObjCAutoreleasePoolStmt(
|
|||
|
||||
if (DI) {
|
||||
DI->setLocation(S.getRBracLoc());
|
||||
DI->EmitRegionEnd(Builder);
|
||||
DI->EmitLexicalBlockEnd(Builder);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast,
|
|||
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 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast,
|
|||
|
||||
if (DI) {
|
||||
DI->setLocation(S.getRBracLoc());
|
||||
DI->EmitRegionEnd(Builder);
|
||||
DI->EmitLexicalBlockEnd(Builder);
|
||||
}
|
||||
|
||||
RValue RV;
|
||||
|
@ -572,7 +572,7 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) {
|
|||
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 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) {
|
|||
|
||||
if (DI) {
|
||||
DI->setLocation(S.getSourceRange().getEnd());
|
||||
DI->EmitRegionEnd(Builder);
|
||||
DI->EmitLexicalBlockEnd(Builder);
|
||||
}
|
||||
|
||||
// Emit the fall-through block.
|
||||
|
@ -669,7 +669,7 @@ void CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S) {
|
|||
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 @@ void CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S) {
|
|||
|
||||
if (DI) {
|
||||
DI->setLocation(S.getSourceRange().getEnd());
|
||||
DI->EmitRegionEnd(Builder);
|
||||
DI->EmitLexicalBlockEnd(Builder);
|
||||
}
|
||||
|
||||
// Emit the fall-through block.
|
||||
|
|
Загрузка…
Ссылка в новой задаче