Rename DIBlock as DILexicalBlock.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80633 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2009-08-31 22:00:15 +00:00
parent a5505cb9c9
commit 5e005d814f
3 changed files with 22 additions and 11 deletions

View File

@ -96,6 +96,7 @@ namespace llvm {
bool isGlobalVariable() const; bool isGlobalVariable() const;
bool isScope() const; bool isScope() const;
bool isCompileUnit() const; bool isCompileUnit() const;
bool isLexicalBlock() const;
}; };
/// DISubrange - This is used to represent ranges, for array bounds. /// DISubrange - This is used to represent ranges, for array bounds.
@ -419,12 +420,14 @@ namespace llvm {
void dump() const; void dump() const;
}; };
/// DIBlock - This is a wrapper for a block (e.g. a function, scope, etc). /// DILexicalBlock - This is a wrapper for a lexical block.
class DIBlock : public DIDescriptor { class DILexicalBlock : public DIScope {
public: public:
explicit DIBlock(MDNode *N = 0) explicit DILexicalBlock(MDNode *N = 0) {
: DIDescriptor(N, dwarf::DW_TAG_lexical_block) {} DbgNode = N;
if (DbgNode && !isLexicalBlock())
DbgNode = 0;
}
DIDescriptor getContext() const { return getDescriptorField(1); } DIDescriptor getContext() const { return getDescriptorField(1); }
}; };
@ -524,9 +527,9 @@ namespace llvm {
DICompileUnit CompileUnit, unsigned LineNo, DICompileUnit CompileUnit, unsigned LineNo,
DIType Type); DIType Type);
/// CreateBlock - This creates a descriptor for a lexical block with the /// CreateLexicalBlock - This creates a descriptor for a lexical block
/// specified parent context. /// with the specified parent context.
DIBlock CreateBlock(DIDescriptor Context); DILexicalBlock CreateLexicalBlock(DIDescriptor Context);
/// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation, /// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation,
/// inserting it at the end of the specified basic block. /// inserting it at the end of the specified basic block.

View File

@ -235,6 +235,14 @@ bool DIDescriptor::isCompileUnit() const {
return Tag == dwarf::DW_TAG_compile_unit; return Tag == dwarf::DW_TAG_compile_unit;
} }
/// isLexicalBlock - Return true if the specified tag is DW_TAG_lexical_block.
bool DIDescriptor::isLexicalBlock() const {
assert (!isNull() && "Invalid descriptor!");
unsigned Tag = getTag();
return Tag == dwarf::DW_TAG_lexical_block;
}
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Simple Descriptor Constructors and other Methods // Simple Descriptor Constructors and other Methods
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -758,12 +766,12 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
/// CreateBlock - This creates a descriptor for a lexical block with the /// CreateBlock - This creates a descriptor for a lexical block with the
/// specified parent VMContext. /// specified parent VMContext.
DIBlock DIFactory::CreateBlock(DIDescriptor Context) { DILexicalBlock DIFactory::CreateLexicalBlock(DIDescriptor Context) {
Value *Elts[] = { Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_lexical_block), GetTagConstant(dwarf::DW_TAG_lexical_block),
Context.getNode() Context.getNode()
}; };
return DIBlock(MDNode::get(VMContext, &Elts[0], 2)); return DILexicalBlock(MDNode::get(VMContext, &Elts[0], 2));
} }

View File

@ -1222,7 +1222,7 @@ DbgScope *DwarfDebug::getOrCreateScope(MDNode *N) {
if (Slot) return Slot; if (Slot) return Slot;
DbgScope *Parent = NULL; DbgScope *Parent = NULL;
DIBlock Block(N); DILexicalBlock Block(N);
// Don't create a new scope if we already created one for an inlined function. // Don't create a new scope if we already created one for an inlined function.
DenseMap<const MDNode *, DbgScope *>::iterator DenseMap<const MDNode *, DbgScope *>::iterator