Index: include/llvm/IR/DIBuilder.h =================================================================== --- include/llvm/IR/DIBuilder.h +++ include/llvm/IR/DIBuilder.h @@ -134,8 +134,8 @@ /// \param SplitDebugInlining Whether to emit inline debug info. /// \param DebugInfoForProfiling Whether to emit extra debug info for /// profile collection. - /// \param GnuPubnames Whether to emit .debug_gnu_pubnames section instead - /// of .debug_pubnames. + /// \param PubnamesKind Whether to emit .debug_gnu_pubnames, + /// .debug_pubnames, or no pubnames at all. DICompileUnit * createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized, StringRef Flags, unsigned RV, @@ -144,7 +144,8 @@ DICompileUnit::DebugEmissionKind::FullDebug, uint64_t DWOId = 0, bool SplitDebugInlining = true, bool DebugInfoForProfiling = false, - bool GnuPubnames = false); + DICompileUnit::DebugPubnamesKind PubnamesKind = + DICompileUnit::DebugPubnamesKind::Default); /// Create a file descriptor to hold debugging information for a file. /// \param Filename File name. Index: include/llvm/IR/DebugInfoMetadata.h =================================================================== --- include/llvm/IR/DebugInfoMetadata.h +++ include/llvm/IR/DebugInfoMetadata.h @@ -1166,8 +1166,17 @@ LastEmissionKind = DebugDirectivesOnly }; + enum DebugPubnamesKind : unsigned { + Default = 0, + GNU = 1, + Omitted = 2, + LastPubnamesKind = Omitted + }; + static Optional getEmissionKind(StringRef Str); static const char *emissionKindString(DebugEmissionKind EK); + static Optional getPubnamesKind(StringRef Str); + static const char *pubnamesKindString(DebugPubnamesKind PK); private: unsigned SourceLanguage; @@ -1177,17 +1186,19 @@ uint64_t DWOId; bool SplitDebugInlining; bool DebugInfoForProfiling; - bool GnuPubnames; + unsigned PubnamesKind; DICompileUnit(LLVMContext &C, StorageType Storage, unsigned SourceLanguage, bool IsOptimized, unsigned RuntimeVersion, unsigned EmissionKind, uint64_t DWOId, bool SplitDebugInlining, - bool DebugInfoForProfiling, bool GnuPubnames, ArrayRef Ops) + bool DebugInfoForProfiling, unsigned PubnamesKind, + ArrayRef Ops) : DIScope(C, DICompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops), SourceLanguage(SourceLanguage), IsOptimized(IsOptimized), RuntimeVersion(RuntimeVersion), EmissionKind(EmissionKind), DWOId(DWOId), SplitDebugInlining(SplitDebugInlining), - DebugInfoForProfiling(DebugInfoForProfiling), GnuPubnames(GnuPubnames) { + DebugInfoForProfiling(DebugInfoForProfiling), + PubnamesKind(PubnamesKind) { assert(Storage != Uniqued); } ~DICompileUnit() = default; @@ -1201,14 +1212,15 @@ DIGlobalVariableExpressionArray GlobalVariables, DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros, uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling, - bool GnuPubnames, StorageType Storage, bool ShouldCreate = true) { + unsigned PubnamesKind, StorageType Storage, + bool ShouldCreate = true) { return getImpl( Context, SourceLanguage, File, getCanonicalMDString(Context, Producer), IsOptimized, getCanonicalMDString(Context, Flags), RuntimeVersion, getCanonicalMDString(Context, SplitDebugFilename), EmissionKind, EnumTypes.get(), RetainedTypes.get(), GlobalVariables.get(), ImportedEntities.get(), Macros.get(), DWOId, SplitDebugInlining, - DebugInfoForProfiling, GnuPubnames, Storage, ShouldCreate); + DebugInfoForProfiling, PubnamesKind, Storage, ShouldCreate); } static DICompileUnit * getImpl(LLVMContext &Context, unsigned SourceLanguage, Metadata *File, @@ -1217,17 +1229,16 @@ unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes, Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros, uint64_t DWOId, bool SplitDebugInlining, - bool DebugInfoForProfiling, bool GnuPubnames, StorageType Storage, - bool ShouldCreate = true); + bool DebugInfoForProfiling, unsigned PubnamesKind, + StorageType Storage, bool ShouldCreate = true); TempDICompileUnit cloneImpl() const { - return getTemporary(getContext(), getSourceLanguage(), getFile(), - getProducer(), isOptimized(), getFlags(), - getRuntimeVersion(), getSplitDebugFilename(), - getEmissionKind(), getEnumTypes(), getRetainedTypes(), - getGlobalVariables(), getImportedEntities(), - getMacros(), DWOId, getSplitDebugInlining(), - getDebugInfoForProfiling(), getGnuPubnames()); + return getTemporary( + getContext(), getSourceLanguage(), getFile(), getProducer(), + isOptimized(), getFlags(), getRuntimeVersion(), getSplitDebugFilename(), + getEmissionKind(), getEnumTypes(), getRetainedTypes(), + getGlobalVariables(), getImportedEntities(), getMacros(), DWOId, + getSplitDebugInlining(), getDebugInfoForProfiling(), getPubnamesKind()); } public: @@ -1243,11 +1254,11 @@ DIGlobalVariableExpressionArray GlobalVariables, DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros, uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling, - bool GnuPubnames), + DebugPubnamesKind PubnamesKind), (SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes, GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining, - DebugInfoForProfiling, GnuPubnames)) + DebugInfoForProfiling, PubnamesKind)) DEFINE_MDNODE_GET_DISTINCT_TEMPORARY( DICompileUnit, (unsigned SourceLanguage, Metadata *File, MDString *Producer, @@ -1255,11 +1266,12 @@ MDString *SplitDebugFilename, unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes, Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros, uint64_t DWOId, - bool SplitDebugInlining, bool DebugInfoForProfiling, bool GnuPubnames), + bool SplitDebugInlining, bool DebugInfoForProfiling, + unsigned PubnamesKind), (SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes, GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining, - DebugInfoForProfiling, GnuPubnames)) + DebugInfoForProfiling, PubnamesKind)) TempDICompileUnit clone() const { return cloneImpl(); } @@ -1273,7 +1285,9 @@ return EmissionKind == DebugDirectivesOnly; } bool getDebugInfoForProfiling() const { return DebugInfoForProfiling; } - bool getGnuPubnames() const { return GnuPubnames; } + DebugPubnamesKind getPubnamesKind() const { + return (DebugPubnamesKind)PubnamesKind; + } StringRef getProducer() const { return getStringOperand(1); } StringRef getFlags() const { return getStringOperand(2); } StringRef getSplitDebugFilename() const { return getStringOperand(3); } Index: lib/AsmParser/LLLexer.cpp =================================================================== --- lib/AsmParser/LLLexer.cpp +++ lib/AsmParser/LLLexer.cpp @@ -910,6 +910,11 @@ return lltok::EmissionKind; } + if (Keyword == "GNU" || Keyword == "Omitted" || Keyword == "Default") { + StrVal.assign(Keyword.begin(), Keyword.end()); + return lltok::Pubnames; + } + // Check for [us]0x[0-9A-Fa-f]+ which are Hexadecimal constant generated by // the CFE to avoid forcing it to deal with 64-bit numbers. if ((TokStart[0] == 'u' || TokStart[0] == 's') && Index: lib/AsmParser/LLParser.cpp =================================================================== --- lib/AsmParser/LLParser.cpp +++ lib/AsmParser/LLParser.cpp @@ -3718,6 +3718,10 @@ EmissionKindField() : MDUnsignedField(0, DICompileUnit::LastEmissionKind) {} }; +struct PubnamesKindField : public MDUnsignedField { + PubnamesKindField() : MDUnsignedField(0, DICompileUnit::LastPubnamesKind) {} +}; + struct DIFlagField : public MDFieldImpl { DIFlagField() : MDFieldImpl(DINode::FlagZero) {} }; @@ -3936,6 +3940,25 @@ return false; } +template <> +bool LLParser::ParseMDField(LocTy Loc, StringRef Name, + PubnamesKindField &Result) { + if (Lex.getKind() == lltok::APSInt) + return ParseMDField(Loc, Name, static_cast(Result)); + + if (Lex.getKind() != lltok::Pubnames) + return TokError("expected pubnames kind"); + + auto Kind = DICompileUnit::getPubnamesKind(Lex.getStrVal()); + if (!Kind) + return TokError("invalid pubnames kind" + Twine(" '") + Lex.getStrVal() + + "'"); + assert(*Kind <= Result.Max && "Expected valid pubnames kind"); + Result.assign(*Kind); + Lex.Lex(); + return false; +} + template <> bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DwarfAttEncodingField &Result) { @@ -4446,7 +4469,7 @@ OPTIONAL(dwoId, MDUnsignedField, ); \ OPTIONAL(splitDebugInlining, MDBoolField, = true); \ OPTIONAL(debugInfoForProfiling, MDBoolField, = false); \ - OPTIONAL(gnuPubnames, MDBoolField, = false); + OPTIONAL(pubnames, PubnamesKindField, ); PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS @@ -4454,7 +4477,7 @@ Context, language.Val, file.Val, producer.Val, isOptimized.Val, flags.Val, runtimeVersion.Val, splitDebugFilename.Val, emissionKind.Val, enums.Val, retainedTypes.Val, globals.Val, imports.Val, macros.Val, dwoId.Val, - splitDebugInlining.Val, debugInfoForProfiling.Val, gnuPubnames.Val); + splitDebugInlining.Val, debugInfoForProfiling.Val, pubnames.Val); return false; } Index: lib/AsmParser/LLToken.h =================================================================== --- lib/AsmParser/LLToken.h +++ lib/AsmParser/LLToken.h @@ -434,6 +434,7 @@ DwarfLang, // DW_LANG_foo DwarfCC, // DW_CC_foo EmissionKind, // lineTablesOnly + Pubnames, // GNU DwarfOp, // DW_OP_foo DIFlag, // DIFlagFoo DwarfMacinfo, // DW_MACINFO_foo Index: lib/Bitcode/Reader/MetadataLoader.cpp =================================================================== --- lib/Bitcode/Reader/MetadataLoader.cpp +++ lib/Bitcode/Reader/MetadataLoader.cpp @@ -1390,7 +1390,7 @@ Record.size() <= 14 ? 0 : Record[14], Record.size() <= 16 ? true : Record[16], Record.size() <= 17 ? false : Record[17], - Record.size() <= 18 ? false : Record[18]); + Record.size() <= 18 ? 0 : Record[18]); MetadataList.assignValue(CU, NextMetadataNo); NextMetadataNo++; Index: lib/Bitcode/Writer/BitcodeWriter.cpp =================================================================== --- lib/Bitcode/Writer/BitcodeWriter.cpp +++ lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1602,7 +1602,7 @@ Record.push_back(VE.getMetadataOrNullID(N->getMacros().get())); Record.push_back(N->getSplitDebugInlining()); Record.push_back(N->getDebugInfoForProfiling()); - Record.push_back(N->getGnuPubnames()); + Record.push_back(N->getPubnamesKind()); Stream.EmitRecord(bitc::METADATA_COMPILE_UNIT, Record, Abbrev); Record.clear(); Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -883,13 +883,17 @@ } bool DwarfCompileUnit::hasDwarfPubSections() const { - // Opting in to GNU Pubnames/types overrides the default to ensure these are - // generated for things like Gold's gdb_index generation. - if (CUNode->getGnuPubnames()) + switch (CUNode->getPubnamesKind()) { + case DICompileUnit::DebugPubnamesKind::Omitted: + return false; + // Opting in to GNU Pubnames/types overrides the default to ensure these are + // generated for things like Gold's gdb_index generation. + case DICompileUnit::DebugPubnamesKind::GNU: return true; - - return DD->tuneForGDB() && DD->usePubSections() && - !includeMinimalInlineScopes() && !CUNode->isDebugDirectivesOnly(); + case DICompileUnit::DebugPubnamesKind::Default: + return DD->tuneForGDB() && DD->usePubSections() && + !includeMinimalInlineScopes() && !CUNode->isDebugDirectivesOnly(); + } } /// addGlobalName - Add a new global name to the compile unit. Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1643,7 +1643,8 @@ if (!TheU->hasDwarfPubSections()) continue; - bool GnuStyle = TheU->getCUNode()->getGnuPubnames(); + bool GnuStyle = TheU->getCUNode()->getPubnamesKind() == + DICompileUnit::DebugPubnamesKind::GNU; Asm->OutStreamer->SwitchSection( GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection() Index: lib/IR/AsmWriter.cpp =================================================================== --- lib/IR/AsmWriter.cpp +++ lib/IR/AsmWriter.cpp @@ -1604,6 +1604,7 @@ void printDwarfEnum(StringRef Name, IntTy Value, Stringifier toString, bool ShouldSkipZero = true); void printEmissionKind(StringRef Name, DICompileUnit::DebugEmissionKind EK); + void printPubnamesKind(StringRef Name, DICompileUnit::DebugPubnamesKind PK); }; } // end anonymous namespace @@ -1701,6 +1702,13 @@ Out << FS << Name << ": " << DICompileUnit::emissionKindString(EK); } +void MDFieldPrinter::printPubnamesKind(StringRef Name, + DICompileUnit::DebugPubnamesKind PK) { + if (PK == DICompileUnit::Default) + return; + Out << FS << Name << ": " << DICompileUnit::pubnamesKindString(PK); +} + template void MDFieldPrinter::printDwarfEnum(StringRef Name, IntTy Value, Stringifier toString, bool ShouldSkipZero) { @@ -1890,7 +1898,7 @@ Printer.printBool("splitDebugInlining", N->getSplitDebugInlining(), true); Printer.printBool("debugInfoForProfiling", N->getDebugInfoForProfiling(), false); - Printer.printBool("gnuPubnames", N->getGnuPubnames(), false); + Printer.printPubnamesKind("pubnames", N->getPubnamesKind()); Out << ")"; } Index: lib/IR/DIBuilder.cpp =================================================================== --- lib/IR/DIBuilder.cpp +++ lib/IR/DIBuilder.cpp @@ -139,7 +139,8 @@ unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized, StringRef Flags, unsigned RunTimeVer, StringRef SplitName, DICompileUnit::DebugEmissionKind Kind, uint64_t DWOId, - bool SplitDebugInlining, bool DebugInfoForProfiling, bool GnuPubnames) { + bool SplitDebugInlining, bool DebugInfoForProfiling, + DICompileUnit::DebugPubnamesKind PubnamesKind) { assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) || (Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) && @@ -149,7 +150,7 @@ CUNode = DICompileUnit::getDistinct( VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer, SplitName, Kind, nullptr, nullptr, nullptr, nullptr, nullptr, DWOId, - SplitDebugInlining, DebugInfoForProfiling, GnuPubnames); + SplitDebugInlining, DebugInfoForProfiling, PubnamesKind); // Create a named metadata so that it is easier to find cu in a module. NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu"); Index: lib/IR/DebugInfo.cpp =================================================================== --- lib/IR/DebugInfo.cpp +++ lib/IR/DebugInfo.cpp @@ -491,7 +491,7 @@ CU->getSplitDebugFilename(), DICompileUnit::LineTablesOnly, EnumTypes, RetainedTypes, GlobalVariables, ImportedEntities, CU->getMacros(), CU->getDWOId(), CU->getSplitDebugInlining(), - CU->getDebugInfoForProfiling(), CU->getGnuPubnames()); + CU->getDebugInfoForProfiling(), CU->getPubnamesKind()); } DILocation *getReplacementMDLocation(DILocation *MLD) { Index: lib/IR/DebugInfoMetadata.cpp =================================================================== --- lib/IR/DebugInfoMetadata.cpp +++ lib/IR/DebugInfoMetadata.cpp @@ -449,7 +449,7 @@ unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes, Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros, uint64_t DWOId, bool SplitDebugInlining, bool DebugInfoForProfiling, - bool GnuPubnames, StorageType Storage, bool ShouldCreate) { + unsigned PubnamesKind, StorageType Storage, bool ShouldCreate) { assert(Storage != Uniqued && "Cannot unique DICompileUnit"); assert(isCanonical(Producer) && "Expected canonical MDString"); assert(isCanonical(Flags) && "Expected canonical MDString"); @@ -462,7 +462,7 @@ return storeImpl(new (array_lengthof(Ops)) DICompileUnit( Context, Storage, SourceLanguage, IsOptimized, RuntimeVersion, EmissionKind, DWOId, SplitDebugInlining, - DebugInfoForProfiling, GnuPubnames, Ops), + DebugInfoForProfiling, PubnamesKind, Ops), Storage); } @@ -476,6 +476,15 @@ .Default(None); } +Optional +DICompileUnit::getPubnamesKind(StringRef Str) { + return StringSwitch>(Str) + .Case("Default", Default) + .Case("GNU", GNU) + .Case("Omitted", Omitted) + .Default(None); +} + const char *DICompileUnit::emissionKindString(DebugEmissionKind EK) { switch (EK) { case NoDebug: return "NoDebug"; @@ -486,6 +495,18 @@ return nullptr; } +const char *DICompileUnit::pubnamesKindString(DebugPubnamesKind PK) { + switch (PK) { + case Default: + return nullptr; + case GNU: + return "GNU"; + case Omitted: + return "Omitted"; + } + return nullptr; +} + DISubprogram *DILocalScope::getSubprogram() const { if (auto *Block = dyn_cast(this)) return Block->getScope()->getSubprogram(); Index: test/Bitcode/dicompileunit-gnu-pubnames.ll =================================================================== --- test/Bitcode/dicompileunit-gnu-pubnames.ll +++ test/Bitcode/dicompileunit-gnu-pubnames.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as -disable-verify -o - %s | llvm-dis | FileCheck %s !named = !{!0} -; CHECK: !DICompileUnit({{.*}}, gnuPubnames: true) -!0 = distinct !DICompileUnit(language: 12, file: !1, gnuPubnames: true) +; CHECK: !DICompileUnit({{.*}}, pubnames: GNU) +!0 = distinct !DICompileUnit(language: 12, file: !1, pubnames: GNU) !1 = !DIFile(filename: "path/to/file", directory: "/path/to/dir") Index: test/DebugInfo/X86/gnu-public-names-empty.ll =================================================================== --- test/DebugInfo/X86/gnu-public-names-empty.ll +++ test/DebugInfo/X86/gnu-public-names-empty.ll @@ -17,7 +17,7 @@ !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!3, !4} -!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (trunk 191846) (llvm/trunk 191866)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !5, globals: !2, imports: !2, gnuPubnames: true) +!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (trunk 191846) (llvm/trunk 191866)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !5, globals: !2, imports: !2, pubnames: GNU) !1 = !DIFile(filename: "foo.c", directory: "/usr/local/google/home/echristo/tmp") !2 = !{} !3 = !{i32 2, !"Dwarf Version", i32 4} Index: test/DebugInfo/X86/gnu-public-names-gmlt.ll =================================================================== --- test/DebugInfo/X86/gnu-public-names-gmlt.ll +++ test/DebugInfo/X86/gnu-public-names-gmlt.ll @@ -1,4 +1,4 @@ -; RUN: sed -e 's/gnuPubnames: false/gnuPubnames: true/' %s | llc -mtriple=x86_64-pc-linux-gnu -filetype=obj | llvm-dwarfdump -v - | FileCheck --check-prefix=GPUB %s +; RUN: sed -e 's/pubnames: Default/pubnames: GNU/' %s | llc -mtriple=x86_64-pc-linux-gnu -filetype=obj | llvm-dwarfdump -v - | FileCheck --check-prefix=GPUB %s ; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck --check-prefix=NONE %s ; Generated from: @@ -46,7 +46,7 @@ !llvm.module.flags = !{!3, !4, !5} !llvm.ident = !{!6} -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 303768) (llvm/trunk 303774)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, gnuPubnames: false) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 303768) (llvm/trunk 303774)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, pubnames: Default) !1 = !DIFile(filename: "gnu-public-names-gmlt.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch") !2 = !{} !3 = !{i32 2, !"Dwarf Version", i32 4} Index: test/DebugInfo/X86/gnu-public-names-multiple-cus.ll =================================================================== --- test/DebugInfo/X86/gnu-public-names-multiple-cus.ll +++ test/DebugInfo/X86/gnu-public-names-multiple-cus.ll @@ -23,4 +23,4 @@ !8 = !DIGlobalVariableExpression(var: !9, expr: !DIExpression()) !9 = !DIGlobalVariable(name: "b", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true) !10 = !{!8} -!11 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !10, gnuPubnames: true) +!11 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !10, pubnames: GNU) Index: test/DebugInfo/X86/gnu-public-names-tu.ll =================================================================== --- test/DebugInfo/X86/gnu-public-names-tu.ll +++ test/DebugInfo/X86/gnu-public-names-tu.ll @@ -39,7 +39,7 @@ !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) !1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true) -!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 5.0.0 (trunk 293904) (llvm/trunk 293908)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, gnuPubnames: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 5.0.0 (trunk 293904) (llvm/trunk 293908)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, pubnames: GNU) !3 = !DIFile(filename: "type.cpp", directory: "/tmp/dbginfo") !4 = !{} !5 = !{!0} Index: test/DebugInfo/X86/gnu-public-names.ll =================================================================== --- test/DebugInfo/X86/gnu-public-names.ll +++ test/DebugInfo/X86/gnu-public-names.ll @@ -302,7 +302,7 @@ !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) !1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !9, isLocal: false, isDefinition: true, declaration: !8) -!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.7.0 (trunk 234897) (llvm/trunk 234911)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !21, imports: !44, gnuPubnames: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.7.0 (trunk 234897) (llvm/trunk 234911)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !21, imports: !44, pubnames: GNU) !3 = !DIFile(filename: "gnu-public-names.cpp", directory: "/tmp/dbginfo") !4 = !{} !5 = !{!6, !17} Index: test/DebugInfo/X86/no-public-sections-metadata.ll =================================================================== --- test/DebugInfo/X86/no-public-sections-metadata.ll +++ test/DebugInfo/X86/no-public-sections-metadata.ll @@ -1,9 +1,6 @@ -; RUN: llc -mtriple=x86_64-pc-linux-gnu -debugger-tune=gdb -filetype=asm < %s -no-dwarf-pub-sections | FileCheck %s --check-prefix=DISABLED -; RUN: llc -mtriple=x86_64-pc-linux-gnu -debugger-tune=gdb -filetype=asm < %s | FileCheck %s +; RUN: llc -mtriple=x86_64-pc-linux-gnu -debugger-tune=gdb -filetype=asm < %s | FileCheck %s --check-prefix=DISABLED -; DISABLED-NOT: {{.debug_pubnames|.debug_pubtypes}} -; CHECK-DAG: .section .debug_pubnames -; CHECK-DAG: .section .debug_pubtypes +; DISABLED-NOT: pub{{names|types}} %struct.bar = type { %"struct.ns::foo" } %"struct.ns::foo" = type { i8 } @@ -16,7 +13,7 @@ !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) !1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true) -!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, gnuPubnames: false) +!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, pubnames: Omitted) !3 = !DIFile(filename: "type.cpp", directory: "/tmp/dbginfo") !4 = !{} !5 = !{!0} Index: test/DebugInfo/X86/no-public-sections.ll =================================================================== --- test/DebugInfo/X86/no-public-sections.ll +++ test/DebugInfo/X86/no-public-sections.ll @@ -16,7 +16,7 @@ !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) !1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true) -!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, gnuPubnames: false) +!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, pubnames: Default) !3 = !DIFile(filename: "type.cpp", directory: "/tmp/dbginfo") !4 = !{} !5 = !{!0} Index: unittests/IR/MetadataTest.cpp =================================================================== --- unittests/IR/MetadataTest.cpp +++ unittests/IR/MetadataTest.cpp @@ -95,7 +95,7 @@ return DICompileUnit::getDistinct( Context, 1, getFile(), "clang", false, "-g", 2, "", DICompileUnit::FullDebug, getTuple(), getTuple(), getTuple(), - getTuple(), getTuple(), 0, true, false, false); + getTuple(), getTuple(), 0, true, false, DICompileUnit::Default); } DIType *getBasicType(StringRef Name) { return DIBasicType::get(Context, dwarf::DW_TAG_unspecified_type, Name); @@ -1499,7 +1499,7 @@ Context, SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes, GlobalVariables, ImportedEntities, Macros, DWOId, true, - false, false); + false, DICompileUnit::Default); EXPECT_EQ(dwarf::DW_TAG_compile_unit, N->getTag()); EXPECT_EQ(SourceLanguage, N->getSourceLanguage()); @@ -1557,7 +1557,7 @@ Context, SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion, SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes, nullptr, ImportedEntities, nullptr, DWOId, true, false, - false); + DICompileUnit::Default); auto *GlobalVariables = MDTuple::getDistinct(Context, None); EXPECT_EQ(nullptr, N->getGlobalVariables().get());