bool isGlobalVariable() const;
bool isScope() const;
bool isCompileUnit() const;
+ bool isLexicalBlock() const;
};
/// DISubrange - This is used to represent ranges, for array bounds.
void dump() const;
};
- /// DIBlock - This is a wrapper for a block (e.g. a function, scope, etc).
- class DIBlock : public DIDescriptor {
+ /// DILexicalBlock - This is a wrapper for a lexical block.
+ class DILexicalBlock : public DIScope {
public:
- explicit DIBlock(MDNode *N = 0)
- : DIDescriptor(N, dwarf::DW_TAG_lexical_block) {}
-
+ explicit DILexicalBlock(MDNode *N = 0) {
+ DbgNode = N;
+ if (DbgNode && !isLexicalBlock())
+ DbgNode = 0;
+ }
DIDescriptor getContext() const { return getDescriptorField(1); }
};
DICompileUnit CompileUnit, unsigned LineNo,
DIType Type);
- /// CreateBlock - This creates a descriptor for a lexical block with the
- /// specified parent context.
- DIBlock CreateBlock(DIDescriptor Context);
+ /// CreateLexicalBlock - This creates a descriptor for a lexical block
+ /// with the specified parent context.
+ DILexicalBlock CreateLexicalBlock(DIDescriptor Context);
/// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation,
/// inserting it at the end of the specified basic block.
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
//===----------------------------------------------------------------------===//
/// CreateBlock - This creates a descriptor for a lexical block with the
/// specified parent VMContext.
-DIBlock DIFactory::CreateBlock(DIDescriptor Context) {
+DILexicalBlock DIFactory::CreateLexicalBlock(DIDescriptor Context) {
Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_lexical_block),
Context.getNode()
};
- return DIBlock(MDNode::get(VMContext, &Elts[0], 2));
+ return DILexicalBlock(MDNode::get(VMContext, &Elts[0], 2));
}