mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 03:25:23 +00:00
Fix decl/def debug info for template functions. Radar 8063111.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107919 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -134,7 +134,7 @@ namespace llvm {
|
|||||||
public:
|
public:
|
||||||
explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {}
|
explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {}
|
||||||
|
|
||||||
unsigned getLanguage() const { return getUnsignedField(2); }
|
unsigned getLanguage() const { return getUnsignedField(2); }
|
||||||
StringRef getFilename() const { return getStringField(3); }
|
StringRef getFilename() const { return getStringField(3); }
|
||||||
StringRef getDirectory() const { return getStringField(4); }
|
StringRef getDirectory() const { return getStringField(4); }
|
||||||
StringRef getProducer() const { return getStringField(5); }
|
StringRef getProducer() const { return getStringField(5); }
|
||||||
@@ -504,10 +504,18 @@ namespace llvm {
|
|||||||
public:
|
public:
|
||||||
explicit DILexicalBlock(const MDNode *N = 0) : DIScope(N) {}
|
explicit DILexicalBlock(const MDNode *N = 0) : DIScope(N) {}
|
||||||
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
||||||
StringRef getDirectory() const { return getContext().getDirectory(); }
|
|
||||||
StringRef getFilename() const { return getContext().getFilename(); }
|
|
||||||
unsigned getLineNumber() const { return getUnsignedField(2); }
|
unsigned getLineNumber() const { return getUnsignedField(2); }
|
||||||
unsigned getColumnNumber() const { return getUnsignedField(3); }
|
unsigned getColumnNumber() const { return getUnsignedField(3); }
|
||||||
|
StringRef getDirectory() const {
|
||||||
|
DIFile F = getFieldAs<DIFile>(4);
|
||||||
|
StringRef dir = F.getDirectory();
|
||||||
|
return !dir.empty() ? dir : getContext().getDirectory();
|
||||||
|
}
|
||||||
|
StringRef getFilename() const {
|
||||||
|
DIFile F = getFieldAs<DIFile>(4);
|
||||||
|
StringRef filename = F.getFilename();
|
||||||
|
return !filename.empty() ? filename : getContext().getFilename();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DINameSpace - A wrapper for a C++ style name space.
|
/// DINameSpace - A wrapper for a C++ style name space.
|
||||||
@@ -693,8 +701,8 @@ namespace llvm {
|
|||||||
|
|
||||||
/// CreateLexicalBlock - This creates a descriptor for a lexical block
|
/// CreateLexicalBlock - This creates a descriptor for a lexical block
|
||||||
/// with the specified parent context.
|
/// with the specified parent context.
|
||||||
DILexicalBlock CreateLexicalBlock(DIDescriptor Context, unsigned Line = 0,
|
DILexicalBlock CreateLexicalBlock(DIDescriptor Context, DIFile F,
|
||||||
unsigned Col = 0);
|
unsigned Line = 0, unsigned Col = 0);
|
||||||
|
|
||||||
/// CreateNameSpace - This creates new descriptor for a namespace
|
/// CreateNameSpace - This creates new descriptor for a namespace
|
||||||
/// with the specified parent context.
|
/// with the specified parent context.
|
||||||
|
@@ -1107,14 +1107,19 @@ DIVariable DIFactory::CreateComplexVariable(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.
|
||||||
DILexicalBlock DIFactory::CreateLexicalBlock(DIDescriptor Context,
|
DILexicalBlock DIFactory::CreateLexicalBlock(DIDescriptor Context,
|
||||||
unsigned LineNo, unsigned Col) {
|
DIFile F, unsigned LineNo,
|
||||||
|
unsigned Col) {
|
||||||
|
// Defeat MDNode uniqing for lexical blocks.
|
||||||
|
static unsigned int unique_id = 0;
|
||||||
Value *Elts[] = {
|
Value *Elts[] = {
|
||||||
GetTagConstant(dwarf::DW_TAG_lexical_block),
|
GetTagConstant(dwarf::DW_TAG_lexical_block),
|
||||||
Context,
|
Context,
|
||||||
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
||||||
ConstantInt::get(Type::getInt32Ty(VMContext), Col)
|
ConstantInt::get(Type::getInt32Ty(VMContext), Col),
|
||||||
|
F,
|
||||||
|
ConstantInt::get(Type::getInt32Ty(VMContext), unique_id++)
|
||||||
};
|
};
|
||||||
return DILexicalBlock(MDNode::get(VMContext, &Elts[0], 4));
|
return DILexicalBlock(MDNode::get(VMContext, &Elts[0], 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CreateNameSpace - This creates new descriptor for a namespace
|
/// CreateNameSpace - This creates new descriptor for a namespace
|
||||||
|
@@ -2682,18 +2682,21 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
|||||||
if (FDL.isUnknown()) return;
|
if (FDL.isUnknown()) return;
|
||||||
|
|
||||||
const MDNode *Scope = FDL.getScope(MF->getFunction()->getContext());
|
const MDNode *Scope = FDL.getScope(MF->getFunction()->getContext());
|
||||||
|
const MDNode *TheScope = 0;
|
||||||
|
|
||||||
DISubprogram SP = getDISubprogram(Scope);
|
DISubprogram SP = getDISubprogram(Scope);
|
||||||
unsigned Line, Col;
|
unsigned Line, Col;
|
||||||
if (SP.Verify()) {
|
if (SP.Verify()) {
|
||||||
Line = SP.getLineNumber();
|
Line = SP.getLineNumber();
|
||||||
Col = 0;
|
Col = 0;
|
||||||
|
TheScope = SP;
|
||||||
} else {
|
} else {
|
||||||
Line = FDL.getLine();
|
Line = FDL.getLine();
|
||||||
Col = FDL.getCol();
|
Col = FDL.getCol();
|
||||||
|
TheScope = Scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
recordSourceLine(Line, Col, Scope);
|
recordSourceLine(Line, Col, TheScope);
|
||||||
|
|
||||||
/// ProcessedArgs - Collection of arguments already processed.
|
/// ProcessedArgs - Collection of arguments already processed.
|
||||||
SmallPtrSet<const MDNode *, 8> ProcessedArgs;
|
SmallPtrSet<const MDNode *, 8> ProcessedArgs;
|
||||||
@@ -2899,16 +2902,6 @@ MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col,
|
|||||||
Src = GetOrCreateSourceID(Dir, Fn);
|
Src = GetOrCreateSourceID(Dir, Fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (!Lines.empty()) {
|
|
||||||
SrcLineInfo lastSrcLineInfo = Lines.back();
|
|
||||||
// Emitting sequential line records with the same line number (but
|
|
||||||
// different addresses) seems to confuse GDB. Avoid this.
|
|
||||||
if (lastSrcLineInfo.getLine() == Line)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MCSymbol *Label = MMI->getContext().CreateTempSymbol();
|
MCSymbol *Label = MMI->getContext().CreateTempSymbol();
|
||||||
Lines.push_back(SrcLineInfo(Line, Col, Src, Label));
|
Lines.push_back(SrcLineInfo(Line, Col, Src, Label));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user