DIArray Args = SPTy.getTypeArray();
uint16_t SPTag = SPTy.getTag();
if (SPTag == dwarf::DW_TAG_subroutine_type)
- for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
- DIE *Arg =
- SPCU->createAndAddDIE(dwarf::DW_TAG_formal_parameter, *SPDie);
- DIType ATy(Args.getElement(i));
- SPCU->addType(Arg, ATy);
- if (ATy.isArtificial())
- SPCU->addFlag(Arg, dwarf::DW_AT_artificial);
- if (ATy.isObjectPointer())
- SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, Arg);
- }
+ SPCU->constructSubprogramArguments(*SPDie, Args);
DIE *SPDeclDie = SPDie;
SPDie = SPCU->createAndAddDIE(dwarf::DW_TAG_subprogram,
*SPCU->getUnitDie());
RI != RE; ++RI) {
RangeSpan Span(getLabelBeforeInsn(RI->first),
getLabelAfterInsn(RI->second));
- List.addRange(llvm_move(Span));
+ List.addRange(std::move(Span));
}
// Add the range list to the set of ranges to be emitted.
- TheCU->addRangeList(llvm_move(List));
+ TheCU->addRangeList(std::move(List));
}
// Construct new DW_TAG_lexical_block for this scope and attach
ObjectPointer = Arg;
}
- // Create the unspecified parameter that marks a function as variadic.
+ // If this is a variadic function, add an unspecified parameter.
DISubprogram SP(Scope->getScopeNode());
- assert(SP.Verify());
DIArray FnArgs = SP.getType().getTypeArray();
- if (FnArgs.getElement(FnArgs.getNumElements()-1).isUnspecifiedParameter()) {
+ if (FnArgs.getElement(FnArgs.getNumElements() - 1)
+ .isUnspecifiedParameter()) {
DIE *Ellipsis = new DIE(dwarf::DW_TAG_unspecified_parameters);
Children.push_back(Ellipsis);
}
DIUnit.getLanguage());
NewCU->addString(Die, dwarf::DW_AT_name, FN);
-
if (!useSplitDwarf()) {
NewCU->initStmtList(DwarfLineSectionSym);
// Add the range of this function to the list of ranges for the CU.
RangeSpan Span(FunctionBeginSym, FunctionEndSym);
- TheCU->addRange(llvm_move(Span));
+ TheCU->addRange(std::move(Span));
// Clear debug info
for (ScopeVariablesMap::iterator I = ScopeVariables.begin(),
if (useSplitDwarf())
DwarfAbbrevDWOSectionSym = emitSectionSym(
Asm, TLOF.getDwarfAbbrevDWOSection(), "section_abbrev_dwo");
- emitSectionSym(Asm, TLOF.getDwarfARangesSection());
+ if (GenerateARangeSection)
+ emitSectionSym(Asm, TLOF.getDwarfARangesSection());
DwarfLineSectionSym =
emitSectionSym(Asm, TLOF.getDwarfLineSection(), "section_line");
}
// Now emit a range for the CU itself.
- if (useCURanges()) {
+ if (useCURanges() && TheCU->getRanges().size()) {
Asm->OutStreamer.EmitLabel(
Asm->GetTempSymbol("cu_ranges", TheCU->getUniqueID()));
const SmallVectorImpl<RangeSpan> &Ranges = TheCU->getRanges();