diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 21 |
3 files changed, 36 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 85a76287434..69240f870f9 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1218,6 +1218,12 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) { (Language == dwarf::DW_LANG_C89 || Language == dwarf::DW_LANG_C99 || Language == dwarf::DW_LANG_ObjC)) addFlag(&Buffer, dwarf::DW_AT_prototyped); + + if (CTy.isLValueReference()) + addFlag(&Buffer, dwarf::DW_AT_reference); + + if (CTy.isRValueReference()) + addFlag(&Buffer, dwarf::DW_AT_rvalue_reference); } break; case dwarf::DW_TAG_structure_type: case dwarf::DW_TAG_union_type: @@ -1520,6 +1526,12 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) { addUInt(SPDie, dwarf::DW_AT_APPLE_isa, dwarf::DW_FORM_flag, isa); } + if (SP.isLValueReference()) + addFlag(SPDie, dwarf::DW_AT_reference); + + if (SP.isRValueReference()) + addFlag(SPDie, dwarf::DW_AT_rvalue_reference); + return SPDie; } diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index c4a9f411306..c7e75849005 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -706,7 +706,8 @@ DICompositeType DIBuilder::createUnionType(DIDescriptor Scope, StringRef Name, /// createSubroutineType - Create subroutine type. DICompositeType DIBuilder::createSubroutineType(DIFile File, - DIArray ParameterTypes) { + DIArray ParameterTypes, + unsigned Flags) { // TAG_subroutine_type is encoded in DICompositeType format. Value *Elts[] = { GetTagConstant(VMContext, dwarf::DW_TAG_subroutine_type), @@ -717,7 +718,7 @@ DICompositeType DIBuilder::createSubroutineType(DIFile File, ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset - ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags + ConstantInt::get(Type::getInt32Ty(VMContext), Flags), // Flags NULL, ParameterTypes, ConstantInt::get(Type::getInt32Ty(VMContext), 0), diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 75a70965a3a..ba45e828636 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -504,6 +504,10 @@ bool DICompositeType::Verify() const { if (!fieldIsMDString(DbgNode, 14)) return false; + // A subroutine type can't be both & and &&. + if (isLValueReference() && isRValueReference()) + return false; + return DbgNode->getNumOperands() == 15; } @@ -520,6 +524,11 @@ bool DISubprogram::Verify() const { // Containing type @ field 12. if (!fieldIsTypeRef(DbgNode, 12)) return false; + + // A subprogram can't be both & and &&. + if (isLValueReference() && isRValueReference()) + return false; + return DbgNode->getNumOperands() == 20; } @@ -1297,6 +1306,12 @@ void DIType::printInternal(raw_ostream &OS) const { OS << " [vector]"; if (isStaticMember()) OS << " [static]"; + + if (isLValueReference()) + OS << " [reference]"; + + if (isRValueReference()) + OS << " [rvalue reference]"; } void DIDerivedType::printInternal(raw_ostream &OS) const { @@ -1336,6 +1351,12 @@ void DISubprogram::printInternal(raw_ostream &OS) const { else if (isProtected()) OS << " [protected]"; + if (isLValueReference()) + OS << " [reference]"; + + if (isRValueReference()) + OS << " [rvalue reference]"; + StringRef Res = getName(); if (!Res.empty()) OS << " [" << Res << ']'; |