return NULL;
RecordDecl *RecDecl = type->getAsRecordType()->getDecl();
+ // We can not get the type for forward declarations.
+ // FIXME: What *should* we be doing here?
+ if (!RecDecl->getDefinition(M->getContext()))
+ return NULL;
const ASTRecordLayout &RL = M->getContext().getASTRecordLayout(RecDecl);
SourceManager &SM = M->getContext().getSourceManager();
llvm::IRBuilder<> &Builder)
{
llvm::BlockDesc *Block = new llvm::BlockDesc();
- if (RegionStack.size() > 0)
+ if (!RegionStack.empty())
Block->setContext(RegionStack.back());
RegionStack.push_back(Block);
/// region - "llvm.dbg.region.end."
void CGDebugInfo::EmitRegionEnd(llvm::Function *Fn, llvm::IRBuilder<> &Builder)
{
+ assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
+
// Lazily construct llvm.dbg.region.end function.
if (!RegionEndFn)
RegionEndFn =llvm::Intrinsic::getDeclaration(&M->getModule(),
llvm::Value *AI,
llvm::IRBuilder<> &Builder)
{
+ assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
+
// FIXME: If it is a compiler generated temporary then return.
// Construct llvm.dbg.declare function.