From bf2040f00cb80eb03d4ef33fe98d286e6d963e7d Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Fri, 31 Jul 2015 18:58:39 +0000 Subject: [PATCH] DI: Remove DW_TAG_arg_variable and DW_TAG_auto_variable Remove the fake `DW_TAG_auto_variable` and `DW_TAG_arg_variable` tags, using `DW_TAG_variable` in their place Stop exposing the `tag:` field at all in the assembly format for `DILocalVariable`. Most of the testcase updates were generated by the following sed script: find test/ -name "*.ll" -o -name "*.mir" | xargs grep -l 'DILocalVariable' | xargs sed -i '' \ -e 's/tag: DW_TAG_arg_variable, //' \ -e 's/tag: DW_TAG_auto_variable, //' There were only a handful of tests in `test/Assembly` that I needed to update by hand. (Note: a follow-up could change `DILocalVariable::DILocalVariable()` to set the tag to `DW_TAG_formal_parameter` instead of `DW_TAG_variable` (as appropriate), instead of having that logic magically in the backend in `DbgVariable`. I've added a FIXME to that effect.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243774 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.rst | 22 +- docs/SourceLevelDebugging.rst | 6 +- include/llvm/IR/DebugInfoMetadata.h | 60 ++-- include/llvm/Support/Dwarf.def | 4 - lib/AsmParser/LLParser.cpp | 11 +- lib/Bitcode/Reader/BitcodeReader.cpp | 14 +- lib/Bitcode/Writer/BitcodeWriter.cpp | 1 - lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 2 +- lib/CodeGen/AsmPrinter/DwarfDebug.h | 3 +- lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 2 - .../SelectionDAG/SelectionDAGBuilder.cpp | 3 +- lib/IR/AsmWriter.cpp | 5 +- lib/IR/DIBuilder.cpp | 7 +- lib/IR/DebugInfoMetadata.cpp | 16 +- lib/IR/LLVMContextImpl.h | 25 +- lib/IR/Verifier.cpp | 6 +- ...-02-05-FunctionLocalMetadataBecomesNull.ll | 2 +- test/Assembler/dilocalvariable-arg-large.ll | 4 +- test/Assembler/dilocalvariable.ll | 16 +- .../invalid-dilocalvariable-arg-large.ll | 6 +- .../invalid-dilocalvariable-arg-negative.ll | 8 +- .../invalid-dilocalvariable-missing-scope.ll | 4 +- .../invalid-dilocalvariable-missing-tag.ll | 4 - test/Bitcode/DILocalVariable-explicit-tags.ll | 16 + .../DILocalVariable-explicit-tags.ll.bc | Bin 0 -> 500 bytes ...aarch64-2014-08-11-MachineCombinerCrash.ll | 40 +-- .../arm64-2011-03-17-AsmPrinterCrash.ll | 2 +- test/CodeGen/ARM/2009-10-16-Scope.ll | 2 +- .../ARM/2010-04-15-ScavengerDebugValue.ll | 2 +- .../ARM/2010-06-25-Thumb2ITInvalidIterator.ll | 8 +- test/CodeGen/ARM/2010-08-04-StackVariable.ll | 10 +- .../CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll | 20 +- .../CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll | 20 +- test/CodeGen/ARM/coalesce-dbgvalue.ll | 4 +- test/CodeGen/ARM/debug-frame-vararg.ll | 8 +- test/CodeGen/ARM/debug-frame.ll | 20 +- test/CodeGen/ARM/debug-info-arg.ll | 12 +- test/CodeGen/ARM/debug-info-blocks.ll | 14 +- test/CodeGen/ARM/debug-info-branch-folding.ll | 18 +- test/CodeGen/ARM/debug-info-d16-reg.ll | 24 +- test/CodeGen/ARM/debug-info-no-frame.ll | 2 +- test/CodeGen/ARM/debug-info-qreg.ll | 18 +- test/CodeGen/ARM/debug-info-s16-reg.ll | 24 +- test/CodeGen/ARM/debug-info-sreg2.ll | 4 +- test/CodeGen/ARM/debug-segmented-stacks.ll | 8 +- test/CodeGen/ARM/sched-it-debug-nodes.ll | 8 +- test/CodeGen/Generic/dbg_value.ll | 2 +- test/CodeGen/Hexagon/hwloop-dbg.ll | 6 +- test/CodeGen/Inputs/DbgValueOtherTargets.ll | 2 +- ...ted-metadata-node-after-debug-location.mir | 2 +- .../expected-metadata-node-after-exclaim.mir | 2 +- .../MIR/X86/instructions-debug-location.mir | 2 +- test/CodeGen/MIR/X86/metadata-operands.mir | 2 +- .../CodeGen/MIR/X86/unknown-metadata-node.mir | 2 +- test/CodeGen/PowerPC/dbg.ll | 4 +- test/CodeGen/PowerPC/pr17168.ll | 306 +++++++++--------- .../CodeGen/Thumb/2010-07-15-debugOrdering.ll | 2 +- test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll | 4 +- test/CodeGen/X86/2009-10-16-Scope.ll | 2 +- test/CodeGen/X86/2010-01-18-DbgValue.ll | 2 +- test/CodeGen/X86/2010-02-01-DbgValueCrash.ll | 2 +- test/CodeGen/X86/2010-05-25-DotDebugLoc.ll | 16 +- test/CodeGen/X86/2010-05-26-DotDebugLoc.ll | 10 +- test/CodeGen/X86/2010-05-28-Crash.ll | 4 +- .../CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll | 16 +- test/CodeGen/X86/2010-07-06-DbgCrash.ll | 2 +- test/CodeGen/X86/2010-08-04-StackVariable.ll | 10 +- test/CodeGen/X86/2010-11-02-DbgParameter.ll | 2 +- .../X86/2011-01-24-DbgValue-Before-Use.ll | 10 +- test/CodeGen/X86/2012-11-30-handlemove-dbg.ll | 2 +- test/CodeGen/X86/2012-11-30-misched-dbg.ll | 4 +- test/CodeGen/X86/2012-11-30-regpres-dbg.ll | 2 +- test/CodeGen/X86/MachineSink-DbgValue.ll | 6 +- test/CodeGen/X86/StackColoring-dbg.ll | 2 +- .../X86/dbg-changes-codegen-branch-folding.ll | 38 +-- test/CodeGen/X86/dbg-changes-codegen.ll | 4 +- test/CodeGen/X86/dbg-combine.ll | 6 +- test/CodeGen/X86/fpstack-debuginstr-kill.ll | 10 +- .../X86/machine-trace-metrics-crash.ll | 2 +- .../X86/misched-code-difference-with-debug.ll | 4 +- test/CodeGen/X86/stack-protector-dbginfo.ll | 24 +- test/CodeGen/X86/unknown-location.ll | 2 +- test/CodeGen/XCore/dwarf_debug.ll | 2 +- test/DebugInfo/2009-11-10-CurrentFn.ll | 2 +- test/DebugInfo/2010-03-12-llc-crash.ll | 2 +- test/DebugInfo/2010-03-19-DbgDeclare.ll | 2 +- test/DebugInfo/2010-03-24-MemberFn.ll | 4 +- test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll | 10 +- test/DebugInfo/2010-05-03-DisableFramePtr.ll | 2 +- test/DebugInfo/2010-05-03-OriginDIE.ll | 10 +- .../DebugInfo/2010-06-29-InlinedFnLocalVar.ll | 8 +- test/DebugInfo/2010-07-19-Crash.ll | 2 +- test/DebugInfo/2010-10-01-crash.ll | 2 +- test/DebugInfo/AArch64/cfi-eof-prologue.ll | 6 +- test/DebugInfo/AArch64/coalescing.ll | 2 +- test/DebugInfo/AArch64/frameindices.ll | 10 +- test/DebugInfo/AArch64/struct_by_value.ll | 2 +- test/DebugInfo/ARM/PR16736.ll | 10 +- test/DebugInfo/ARM/cfi-eof-prologue.ll | 6 +- test/DebugInfo/ARM/lowerbdgdeclare_vla.ll | 8 +- test/DebugInfo/ARM/s-super-register.ll | 4 +- test/DebugInfo/ARM/selectiondag-deadcode.ll | 2 +- .../single-constant-use-preserves-dbgloc.ll | 2 +- test/DebugInfo/Mips/InlinedFnLocalVar.ll | 8 +- test/DebugInfo/Mips/delay-slot.ll | 2 +- test/DebugInfo/PR20038.ll | 10 +- test/DebugInfo/SystemZ/variable-loc.ll | 4 +- test/DebugInfo/X86/2010-04-13-PubType.ll | 4 +- .../X86/2011-09-26-GlobalVarContext.ll | 2 +- test/DebugInfo/X86/2011-12-16-BadStructRef.ll | 22 +- test/DebugInfo/X86/DW_AT_byte_size.ll | 2 +- test/DebugInfo/X86/DW_AT_linkage_name.ll | 6 +- .../DebugInfo/X86/DW_AT_location-reference.ll | 2 +- test/DebugInfo/X86/DW_AT_object_pointer.ll | 8 +- test/DebugInfo/X86/InlinedFnLocalVar.ll | 8 +- test/DebugInfo/X86/aligned_stack_var.ll | 2 +- test/DebugInfo/X86/arguments.ll | 4 +- test/DebugInfo/X86/array.ll | 8 +- test/DebugInfo/X86/array2.ll | 10 +- test/DebugInfo/X86/block-capture.ll | 4 +- test/DebugInfo/X86/byvalstruct.ll | 10 +- test/DebugInfo/X86/concrete_out_of_line.ll | 10 +- test/DebugInfo/X86/constant-aggregate.ll | 6 +- test/DebugInfo/X86/cu-ranges-odr.ll | 4 +- test/DebugInfo/X86/cu-ranges.ll | 4 +- test/DebugInfo/X86/dbg-byval-parameter.ll | 2 +- test/DebugInfo/X86/dbg-const-int.ll | 2 +- test/DebugInfo/X86/dbg-const.ll | 2 +- test/DebugInfo/X86/dbg-declare-arg.ll | 10 +- test/DebugInfo/X86/dbg-declare.ll | 4 +- test/DebugInfo/X86/dbg-i128-const.ll | 2 +- test/DebugInfo/X86/dbg-merge-loc-entry.ll | 4 +- test/DebugInfo/X86/dbg-prolog-end.ll | 4 +- test/DebugInfo/X86/dbg-value-const-byref.ll | 2 +- test/DebugInfo/X86/dbg-value-dag-combine.ll | 6 +- .../X86/dbg-value-inlined-parameter.ll | 4 +- test/DebugInfo/X86/dbg-value-isel.ll | 8 +- test/DebugInfo/X86/dbg-value-location.ll | 2 +- test/DebugInfo/X86/dbg-value-range.ll | 4 +- test/DebugInfo/X86/dbg-value-terminator.ll | 6 +- test/DebugInfo/X86/dbg_value_direct.ll | 4 +- test/DebugInfo/X86/debug-dead-local-var.ll | 2 +- .../X86/debug-info-block-captured-self.ll | 4 +- test/DebugInfo/X86/debug-info-blocks.ll | 20 +- .../DebugInfo/X86/debug-info-static-member.ll | 2 +- test/DebugInfo/X86/debug-loc-asan.ll | 2 +- test/DebugInfo/X86/debug-loc-empty-entries.ll | 2 +- test/DebugInfo/X86/debug-loc-offset.ll | 6 +- test/DebugInfo/X86/debug-ranges-offset.ll | 4 +- test/DebugInfo/X86/decl-derived-member.ll | 6 +- test/DebugInfo/X86/deleted-bit-piece.ll | 2 +- .../X86/dwarf-aranges-no-dwarf-labels.ll | 4 +- test/DebugInfo/X86/dwarf-public-names.ll | 2 +- test/DebugInfo/X86/earlydup-crash.ll | 2 +- test/DebugInfo/X86/elf-names.ll | 6 +- .../DebugInfo/X86/empty-and-one-elem-array.ll | 4 +- test/DebugInfo/X86/ending-run.ll | 4 +- test/DebugInfo/X86/fission-ranges.ll | 12 +- test/DebugInfo/X86/float_const.ll | 2 +- test/DebugInfo/X86/formal_parameter.ll | 2 +- test/DebugInfo/X86/frame-register.ll | 4 +- test/DebugInfo/X86/generate-odr-hash.ll | 4 +- test/DebugInfo/X86/ghost-sdnode-dbgvalues.ll | 12 +- test/DebugInfo/X86/gnu-public-names.ll | 2 +- test/DebugInfo/X86/inline-member-function.ll | 4 +- test/DebugInfo/X86/inline-seldag-test.ll | 4 +- .../DebugInfo/X86/inlined-formal-parameter.ll | 2 +- test/DebugInfo/X86/instcombine-instrinsics.ll | 2 +- test/DebugInfo/X86/lexical_block.ll | 2 +- test/DebugInfo/X86/line-info.ll | 2 +- test/DebugInfo/X86/linkage-name.ll | 4 +- test/DebugInfo/X86/mi-print.ll | 6 +- test/DebugInfo/X86/misched-dbg-value.ll | 12 +- test/DebugInfo/X86/missing-file-line.ll | 2 +- test/DebugInfo/X86/nodebug_with_debug_loc.ll | 6 +- test/DebugInfo/X86/nophysreg.ll | 14 +- test/DebugInfo/X86/objc-property-void.ll | 4 +- test/DebugInfo/X86/op_deref.ll | 6 +- test/DebugInfo/X86/parameters.ll | 6 +- test/DebugInfo/X86/pieces-1.ll | 6 +- test/DebugInfo/X86/pieces-2.ll | 4 +- test/DebugInfo/X86/pieces-3.ll | 10 +- test/DebugInfo/X86/pr11300.ll | 4 +- test/DebugInfo/X86/pr12831.ll | 10 +- test/DebugInfo/X86/pr19307.ll | 6 +- test/DebugInfo/X86/recursive_inlining.ll | 8 +- test/DebugInfo/X86/reference-argument.ll | 14 +- test/DebugInfo/X86/rvalue-ref.ll | 2 +- test/DebugInfo/X86/sret.ll | 34 +- test/DebugInfo/X86/sroasplit-1.ll | 6 +- test/DebugInfo/X86/sroasplit-2.ll | 8 +- test/DebugInfo/X86/sroasplit-3.ll | 4 +- test/DebugInfo/X86/sroasplit-4.ll | 4 +- test/DebugInfo/X86/sroasplit-5.ll | 4 +- .../X86/stmt-list-multiple-compile-units.ll | 4 +- test/DebugInfo/X86/subrange-type.ll | 2 +- test/DebugInfo/X86/subreg.ll | 2 +- test/DebugInfo/X86/subregisters.ll | 6 +- test/DebugInfo/X86/union-const.ll | 2 +- test/DebugInfo/X86/union-template.ll | 4 +- test/DebugInfo/X86/vla.ll | 8 +- test/DebugInfo/array.ll | 2 +- test/DebugInfo/block-asan.ll | 2 +- test/DebugInfo/cross-cu-inlining.ll | 4 +- test/DebugInfo/cross-cu-linkonce-distinct.ll | 2 +- test/DebugInfo/cross-cu-linkonce.ll | 2 +- test/DebugInfo/cu-range-hole.ll | 4 +- test/DebugInfo/cu-ranges.ll | 4 +- test/DebugInfo/dead-argument-order.ll | 4 +- test/DebugInfo/debug-info-qualifiers.ll | 6 +- test/DebugInfo/dwarf-public-names.ll | 2 +- test/DebugInfo/enum-types.ll | 4 +- test/DebugInfo/enum.ll | 2 +- test/DebugInfo/incorrect-variable-debugloc.ll | 6 +- .../DebugInfo/incorrect-variable-debugloc1.ll | 2 +- test/DebugInfo/inheritance.ll | 8 +- test/DebugInfo/inline-debug-info-multiret.ll | 6 +- test/DebugInfo/inline-debug-info.ll | 6 +- test/DebugInfo/inline-scopes.ll | 4 +- test/DebugInfo/inlined-arguments.ll | 8 +- test/DebugInfo/inlined-vars.ll | 8 +- test/DebugInfo/member-order.ll | 2 +- test/DebugInfo/missing-abstract-variable.ll | 12 +- test/DebugInfo/namespace.ll | 4 +- .../namespace_inline_function_definition.ll | 4 +- test/DebugInfo/piece-verifier.ll | 6 +- test/DebugInfo/restrict.ll | 2 +- test/DebugInfo/sugared-constants.ll | 6 +- test/DebugInfo/tu-composite.ll | 14 +- test/DebugInfo/two-cus-from-same-file.ll | 4 +- test/DebugInfo/unconditional-branch.ll | 2 +- test/DebugInfo/varargs.ll | 6 +- .../AddressSanitizer/debug_info.ll | 8 +- .../MemorySanitizer/store-origin.ll | 4 +- .../SanitizerCoverage/coverage-dbg.ll | 2 +- .../SanitizerCoverage/coverage2-dbg.ll | 2 +- test/JitListener/multiple.ll | 6 +- test/JitListener/simple.ll | 2 +- test/Linker/2011-08-18-unique-class-type.ll | 2 +- test/Linker/2011-08-18-unique-class-type2.ll | 2 +- test/Linker/DbgDeclare.ll | 4 +- test/Linker/DbgDeclare2.ll | 6 +- .../Inputs/type-unique-inheritance-a.ll | 4 +- .../Inputs/type-unique-inheritance-b.ll | 6 +- test/Linker/Inputs/type-unique-simple2-a.ll | 4 +- test/Linker/Inputs/type-unique-simple2-b.ll | 4 +- test/Linker/type-unique-odr-a.ll | 2 +- test/Linker/type-unique-odr-b.ll | 2 +- test/Linker/type-unique-simple-a.ll | 4 +- test/Linker/type-unique-simple-b.ll | 4 +- test/Linker/type-unique-simple2-a.ll | 4 +- test/Linker/type-unique-simple2-b.ll | 4 +- test/Linker/type-unique-type-array-a.ll | 8 +- test/Linker/type-unique-type-array-b.ll | 8 +- .../AddDiscriminators/no-discriminators.ll | 2 +- .../DeadArgElim/2010-04-30-DbgInfo.ll | 18 +- test/Transforms/DeadArgElim/dbginfo.ll | 2 +- .../DeadStoreElimination/inst-limits.ll | 2 +- test/Transforms/GCOVProfiling/linezero.ll | 8 +- test/Transforms/GlobalOpt/2009-03-05-dbg.ll | 2 +- test/Transforms/Inline/alloca-dbgdeclare.ll | 4 +- test/Transforms/Inline/ignore-debug-info.ll | 12 +- test/Transforms/Inline/inline_dbg_declare.ll | 6 +- test/Transforms/InstCombine/debuginfo.ll | 6 +- test/Transforms/LICM/debug-value.ll | 2 +- test/Transforms/LoopIdiom/debug-line.ll | 4 +- test/Transforms/LoopRotate/dbgvalue.ll | 8 +- test/Transforms/LoopStrengthReduce/pr12018.ll | 2 +- test/Transforms/LoopVectorize/dbg.value.ll | 2 +- test/Transforms/LoopVectorize/debugloc.ll | 8 +- test/Transforms/Mem2Reg/ConvertDebugInfo.ll | 8 +- test/Transforms/Mem2Reg/ConvertDebugInfo2.ll | 8 +- test/Transforms/ObjCARC/basic.ll | 4 +- ...e-that-exception-unwind-path-is-visited.ll | 8 +- .../SLPVectorizer/X86/debug_info.ll | 10 +- test/Transforms/SampleProfile/branch.ll | 14 +- .../ScalarRepl/debuginfo-preserved.ll | 6 +- test/Transforms/Scalarizer/dbginfo.ll | 6 +- .../Transforms/SimplifyCFG/branch-fold-dbg.ll | 2 +- test/Transforms/SimplifyCFG/hoist-dbgvalue.ll | 4 +- .../StripSymbols/2010-06-30-StripDebug.ll | 2 +- .../StripSymbols/strip-dead-debug-info.ll | 4 +- test/Verifier/llvm.dbg.declare-address.ll | 2 +- test/Verifier/llvm.dbg.declare-expression.ll | 2 +- .../llvm.dbg.intrinsic-dbg-attachment.ll | 8 +- test/Verifier/llvm.dbg.value-expression.ll | 2 +- test/Verifier/llvm.dbg.value-value.ll | 2 +- test/tools/dsymutil/Inputs/frame-dw2.ll | 6 +- test/tools/dsymutil/Inputs/frame-dw4.ll | 6 +- test/tools/dsymutil/Inputs/odr1.ll | 16 +- test/tools/dsymutil/Inputs/odr2.ll | 6 +- test/tools/dsymutil/Inputs/odr3.ll | 8 +- test/tools/dsymutil/Inputs/odr4.ll | 2 +- test/tools/dsymutil/Inputs/odr5.ll | 6 +- test/tools/dsymutil/Inputs/odr6.ll | 6 +- test/tools/dsymutil/Inputs/odr7.ll | 2 +- unittests/IR/MetadataTest.cpp | 58 ++-- 297 files changed, 1100 insertions(+), 1111 deletions(-) delete mode 100644 test/Assembler/invalid-dilocalvariable-missing-tag.ll create mode 100644 test/Bitcode/DILocalVariable-explicit-tags.ll create mode 100644 test/Bitcode/DILocalVariable-explicit-tags.ll.bc diff --git a/docs/LangRef.rst b/docs/LangRef.rst index 2030c475b09..0fa2341a267 100644 --- a/docs/LangRef.rst +++ b/docs/LangRef.rst @@ -3900,22 +3900,18 @@ mandatory, and points at an :ref:`DILexicalBlockFile`, an DILocalVariable """"""""""""""" -``DILocalVariable`` nodes represent local variables in the source language. -Instead of ``DW_TAG_variable``, they use LLVM-specific fake tags to -discriminate between local variables (``DW_TAG_auto_variable``) and subprogram -arguments (``DW_TAG_arg_variable``). In the latter case, the ``arg:`` field -specifies the argument position, and this variable will be included in the -``variables:`` field of its :ref:`DISubprogram`. +``DILocalVariable`` nodes represent local variables in the source language. If +the ``arg:`` field is set to non-zero, then this variable is a subprogram +parameter, and it will be included in the ``variables:`` field of its +:ref:`DISubprogram`. .. code-block:: llvm - !0 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, - scope: !3, file: !2, line: 7, type: !3, - flags: DIFlagArtificial) - !1 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 2, - scope: !4, file: !2, line: 7, type: !3) - !2 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "y", - scope: !5, file: !2, line: 7, type: !3) + !0 = !DILocalVariable(name: "this", arg: 1, scope: !3, file: !2, line: 7, + type: !3, flags: DIFlagArtificial) + !1 = !DILocalVariable(name: "x", arg: 2, scope: !4, file: !2, line: 7, + type: !3) + !2 = !DILocalVariable(name: "y", scope: !5, file: !2, line: 7, type: !3) DIExpression """""""""""" diff --git a/docs/SourceLevelDebugging.rst b/docs/SourceLevelDebugging.rst index 99186f58188..67b81c61d8a 100644 --- a/docs/SourceLevelDebugging.rst +++ b/docs/SourceLevelDebugging.rst @@ -270,13 +270,13 @@ Compiled to LLVM, this function would be represented like this: !8 = !{i32 2, !"Debug Info Version", i32 3} !9 = !{i32 1, !"PIC Level", i32 2} !10 = !{!"clang version 3.7.0 (trunk 231150) (llvm/trunk 231154)"} - !11 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "X", scope: !4, file: !1, line: 2, type: !12) + !11 = !DILocalVariable(name: "X", scope: !4, file: !1, line: 2, type: !12) !12 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !13 = !DIExpression() !14 = !DILocation(line: 2, column: 9, scope: !4) - !15 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "Y", scope: !4, file: !1, line: 3, type: !12) + !15 = !DILocalVariable(name: "Y", scope: !4, file: !1, line: 3, type: !12) !16 = !DILocation(line: 3, column: 9, scope: !4) - !17 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "Z", scope: !18, file: !1, line: 5, type: !12) + !17 = !DILocalVariable(name: "Z", scope: !18, file: !1, line: 5, type: !12) !18 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 5) !19 = !DILocation(line: 5, column: 11, scope: !18) !20 = !DILocation(line: 6, column: 11, scope: !18) diff --git a/include/llvm/IR/DebugInfoMetadata.h b/include/llvm/IR/DebugInfoMetadata.h index 1f247f59b65..98a4f155d98 100644 --- a/include/llvm/IR/DebugInfoMetadata.h +++ b/include/llvm/IR/DebugInfoMetadata.h @@ -1750,15 +1750,13 @@ public: }; /// \brief Base class for variables. -/// -/// TODO: Hardcode to DW_TAG_variable. class DIVariable : public DINode { unsigned Line; protected: - DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, - unsigned Line, ArrayRef Ops) - : DINode(C, ID, Storage, Tag, Ops), Line(Line) {} + DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Line, + ArrayRef Ops) + : DINode(C, ID, Storage, dwarf::DW_TAG_variable, Ops), Line(Line) {} ~DIVariable() = default; public: @@ -1803,8 +1801,7 @@ class DIGlobalVariable : public DIVariable { DIGlobalVariable(LLVMContext &C, StorageType Storage, unsigned Line, bool IsLocalToUnit, bool IsDefinition, ArrayRef Ops) - : DIVariable(C, DIGlobalVariableKind, Storage, dwarf::DW_TAG_variable, - Line, Ops), + : DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops), IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {} ~DIGlobalVariable() = default; @@ -1876,8 +1873,6 @@ public: /// \brief Local variable. /// -/// TODO: Split between arguments and otherwise. -/// TODO: Use \c DW_TAG_variable instead of fake tags. /// TODO: Split up flags. class DILocalVariable : public DIVariable { friend class LLVMContextImpl; @@ -1886,42 +1881,42 @@ class DILocalVariable : public DIVariable { unsigned Arg; unsigned Flags; - DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Tag, - unsigned Line, unsigned Arg, unsigned Flags, - ArrayRef Ops) - : DIVariable(C, DILocalVariableKind, Storage, Tag, Line, Ops), Arg(Arg), + DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Line, + unsigned Arg, unsigned Flags, ArrayRef Ops) + : DIVariable(C, DILocalVariableKind, Storage, Line, Ops), Arg(Arg), Flags(Flags) {} ~DILocalVariable() = default; - static DILocalVariable *getImpl(LLVMContext &Context, unsigned Tag, - DIScope *Scope, StringRef Name, DIFile *File, - unsigned Line, DITypeRef Type, unsigned Arg, - unsigned Flags, StorageType Storage, + static DILocalVariable *getImpl(LLVMContext &Context, DIScope *Scope, + StringRef Name, DIFile *File, unsigned Line, + DITypeRef Type, unsigned Arg, unsigned Flags, + StorageType Storage, bool ShouldCreate = true) { - return getImpl(Context, Tag, Scope, getCanonicalMDString(Context, Name), - File, Line, Type, Arg, Flags, Storage, ShouldCreate); + return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File, + Line, Type, Arg, Flags, Storage, ShouldCreate); } - static DILocalVariable * - getImpl(LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name, - Metadata *File, unsigned Line, Metadata *Type, unsigned Arg, - unsigned Flags, StorageType Storage, bool ShouldCreate = true); + static DILocalVariable *getImpl(LLVMContext &Context, Metadata *Scope, + MDString *Name, Metadata *File, unsigned Line, + Metadata *Type, unsigned Arg, unsigned Flags, + StorageType Storage, + bool ShouldCreate = true); TempDILocalVariable cloneImpl() const { - return getTemporary(getContext(), getTag(), getScope(), getName(), - getFile(), getLine(), getType(), getArg(), getFlags()); + return getTemporary(getContext(), getScope(), getName(), getFile(), + getLine(), getType(), getArg(), getFlags()); } public: DEFINE_MDNODE_GET(DILocalVariable, - (unsigned Tag, DILocalScope *Scope, StringRef Name, - DIFile *File, unsigned Line, DITypeRef Type, unsigned Arg, + (DILocalScope * Scope, StringRef Name, DIFile *File, + unsigned Line, DITypeRef Type, unsigned Arg, unsigned Flags), - (Tag, Scope, Name, File, Line, Type, Arg, Flags)) + (Scope, Name, File, Line, Type, Arg, Flags)) DEFINE_MDNODE_GET(DILocalVariable, - (unsigned Tag, Metadata *Scope, MDString *Name, - Metadata *File, unsigned Line, Metadata *Type, - unsigned Arg, unsigned Flags), - (Tag, Scope, Name, File, Line, Type, Arg, Flags)) + (Metadata * Scope, MDString *Name, Metadata *File, + unsigned Line, Metadata *Type, unsigned Arg, + unsigned Flags), + (Scope, Name, File, Line, Type, Arg, Flags)) TempDILocalVariable clone() const { return cloneImpl(); } @@ -1932,6 +1927,7 @@ public: return cast(DIVariable::getScope()); } + bool isParameter() const { return Arg; } unsigned getArg() const { return Arg; } unsigned getFlags() const { return Flags; } diff --git a/include/llvm/Support/Dwarf.def b/include/llvm/Support/Dwarf.def index 4b923b897e6..c035ebfb834 100644 --- a/include/llvm/Support/Dwarf.def +++ b/include/llvm/Support/Dwarf.def @@ -99,10 +99,6 @@ HANDLE_DW_TAG(0x0041, type_unit) HANDLE_DW_TAG(0x0042, rvalue_reference_type) HANDLE_DW_TAG(0x0043, template_alias) -// Mock tags we use as discriminators. -HANDLE_DW_TAG(0x0100, auto_variable) // Tag for local (auto) variables. -HANDLE_DW_TAG(0x0101, arg_variable) // Tag for argument variables. - // New in DWARF v5. HANDLE_DW_TAG(0x0044, coarray_type) HANDLE_DW_TAG(0x0045, generic_subrange) diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 6c2cd08e580..58d4d7e6976 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -3773,24 +3773,25 @@ bool LLParser::ParseDIGlobalVariable(MDNode *&Result, bool IsDistinct) { } /// ParseDILocalVariable: -/// ::= !DILocalVariable(tag: DW_TAG_arg_variable, scope: !0, name: "foo", +/// ::= !DILocalVariable(arg: 7, scope: !0, name: "foo", +/// file: !1, line: 7, type: !2, arg: 2, flags: 7) +/// ::= !DILocalVariable(scope: !0, name: "foo", /// file: !1, line: 7, type: !2, arg: 2, flags: 7) bool LLParser::ParseDILocalVariable(MDNode *&Result, bool IsDistinct) { #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \ - REQUIRED(tag, DwarfTagField, ); \ REQUIRED(scope, MDField, (/* AllowNull */ false)); \ OPTIONAL(name, MDStringField, ); \ + OPTIONAL(arg, MDUnsignedField, (0, UINT16_MAX)); \ OPTIONAL(file, MDField, ); \ OPTIONAL(line, LineField, ); \ OPTIONAL(type, MDField, ); \ - OPTIONAL(arg, MDUnsignedField, (0, UINT16_MAX)); \ OPTIONAL(flags, DIFlagField, ); PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS Result = GET_OR_DISTINCT(DILocalVariable, - (Context, tag.Val, scope.Val, name.Val, file.Val, - line.Val, type.Val, arg.Val, flags.Val)); + (Context, scope.Val, name.Val, file.Val, line.Val, + type.Val, arg.Val, flags.Val)); return false; } diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index fea4c167ae3..17bb64b1e1c 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1972,15 +1972,19 @@ std::error_code BitcodeReader::parseMetadata() { } case bitc::METADATA_LOCAL_VAR: { // 10th field is for the obseleted 'inlinedAt:' field. - if (Record.size() != 9 && Record.size() != 10) + if (Record.size() < 8 || Record.size() > 10) return error("Invalid record"); + // 2nd field used to be an artificial tag, either DW_TAG_auto_variable or + // DW_TAG_arg_variable. + bool HasTag = Record.size() > 8; MDValueList.assignValue( GET_OR_DISTINCT(DILocalVariable, Record[0], - (Context, Record[1], getMDOrNull(Record[2]), - getMDString(Record[3]), getMDOrNull(Record[4]), - Record[5], getMDOrNull(Record[6]), Record[7], - Record[8])), + (Context, getMDOrNull(Record[1 + HasTag]), + getMDString(Record[2 + HasTag]), + getMDOrNull(Record[3 + HasTag]), Record[4 + HasTag], + getMDOrNull(Record[5 + HasTag]), Record[6 + HasTag], + Record[7 + HasTag])), NextMDValueNo++); break; } diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 20e31d1a102..951d10b919c 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1100,7 +1100,6 @@ static void WriteDILocalVariable(const DILocalVariable *N, SmallVectorImpl &Record, unsigned Abbrev) { Record.push_back(N->isDistinct()); - Record.push_back(N->getTag()); Record.push_back(VE.getMetadataOrNullID(N->getScope())); Record.push_back(VE.getMetadataOrNullID(N->getRawName())); Record.push_back(VE.getMetadataOrNullID(N->getFile())); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 5611ae6fcd8..a2dc8c839c7 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1156,7 +1156,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) { // The first mention of a function argument gets the CurrentFnBegin // label, so arguments are visible when breaking at function entry. const DILocalVariable *DIVar = Ranges.front().first->getDebugVariable(); - if (DIVar->getTag() == dwarf::DW_TAG_arg_variable && + if (DIVar->isParameter() && getDISubprogram(DIVar->getScope())->describes(MF->getFunction())) { LabelsBeforeInsn[Ranges.front().first] = Asm->getFunctionBegin(); if (Ranges.front().first->getDebugExpression()->isBitPiece()) { diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index 57bb8d0229d..d17589cba9e 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -156,7 +156,8 @@ public: // Translate tag to proper Dwarf tag. dwarf::Tag getTag() const { - if (Var->getTag() == dwarf::DW_TAG_arg_variable) + // FIXME: Why don't we just infer this tag and store it all along? + if (Var->isParameter()) return dwarf::DW_TAG_formal_parameter; return dwarf::DW_TAG_variable; diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 2240868229b..e36225ae408 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -299,8 +299,6 @@ void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, } DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N) { - assert(Tag != dwarf::DW_TAG_auto_variable && - Tag != dwarf::DW_TAG_arg_variable); DIE &Die = Parent.addChild(DIE::get(DIEValueAllocator, (dwarf::Tag)Tag)); if (N) insertDIE(N, &Die); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index f15c95f4d5e..b4f8cadd556 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4251,8 +4251,7 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) { if (const BitCastInst *BCI = dyn_cast(Address)) Address = BCI->getOperand(0); // Parameters are handled specially. - bool isParameter = Variable->getTag() == dwarf::DW_TAG_arg_variable || - isa(Address); + bool isParameter = Variable->isParameter() || isa(Address); const AllocaInst *AI = dyn_cast(Address); diff --git a/lib/IR/AsmWriter.cpp b/lib/IR/AsmWriter.cpp index e3905de6597..4f4e9850061 100644 --- a/lib/IR/AsmWriter.cpp +++ b/lib/IR/AsmWriter.cpp @@ -1800,11 +1800,8 @@ static void writeDILocalVariable(raw_ostream &Out, const DILocalVariable *N, SlotTracker *Machine, const Module *Context) { Out << "!DILocalVariable("; MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); - Printer.printTag(N); Printer.printString("name", N->getName()); - Printer.printInt("arg", N->getArg(), - /* ShouldSkipZero */ - N->getTag() == dwarf::DW_TAG_auto_variable); + Printer.printInt("arg", N->getArg()); Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false); Printer.printMetadata("file", N->getRawFile()); Printer.printInt("line", N->getLine()); diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index 7a4c5203965..3e5a50a8952 100644 --- a/lib/IR/DIBuilder.cpp +++ b/lib/IR/DIBuilder.cpp @@ -613,10 +613,9 @@ static DILocalVariable *createLocalVariable( // the only valid scopes)? DIScope *Context = getNonCompileUnitScope(Scope); - dwarf::Tag Tag = ArgNo ? dwarf::DW_TAG_arg_variable : dwarf::DW_TAG_auto_variable; - auto *Node = DILocalVariable::get( - VMContext, Tag, cast_or_null(Context), Name, File, LineNo, - DITypeRef::get(Ty), ArgNo, Flags); + auto *Node = + DILocalVariable::get(VMContext, cast_or_null(Context), Name, + File, LineNo, DITypeRef::get(Ty), ArgNo, Flags); if (AlwaysPreserve) { // The optimizer may remove local variables. If there is an interest // to preserve variable info in such situation then stash it in a diff --git a/lib/IR/DebugInfoMetadata.cpp b/lib/IR/DebugInfoMetadata.cpp index db6da05cfd8..4adda6fb293 100644 --- a/lib/IR/DebugInfoMetadata.cpp +++ b/lib/IR/DebugInfoMetadata.cpp @@ -466,21 +466,21 @@ DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name, Ops); } -DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, unsigned Tag, - Metadata *Scope, MDString *Name, - Metadata *File, unsigned Line, - Metadata *Type, unsigned Arg, - unsigned Flags, StorageType Storage, +DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope, + MDString *Name, Metadata *File, + unsigned Line, Metadata *Type, + unsigned Arg, unsigned Flags, + StorageType Storage, bool ShouldCreate) { // 64K ought to be enough for any frontend. assert(Arg <= UINT16_MAX && "Expected argument number to fit in 16-bits"); assert(Scope && "Expected scope"); assert(isCanonical(Name) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP(DILocalVariable, (Tag, Scope, getString(Name), File, - Line, Type, Arg, Flags)); + DEFINE_GETIMPL_LOOKUP(DILocalVariable, + (Scope, getString(Name), File, Line, Type, Arg, Flags)); Metadata *Ops[] = {Scope, Name, File, Type}; - DEFINE_GETIMPL_STORE(DILocalVariable, (Tag, Line, Arg, Flags), Ops); + DEFINE_GETIMPL_STORE(DILocalVariable, (Line, Arg, Flags), Ops); } DIExpression *DIExpression::getImpl(LLVMContext &Context, diff --git a/lib/IR/LLVMContextImpl.h b/lib/IR/LLVMContextImpl.h index cbbf11e334c..35897a93788 100644 --- a/lib/IR/LLVMContextImpl.h +++ b/lib/IR/LLVMContextImpl.h @@ -759,7 +759,6 @@ template <> struct MDNodeKeyImpl { }; template <> struct MDNodeKeyImpl { - unsigned Tag; Metadata *Scope; StringRef Name; Metadata *File; @@ -768,23 +767,23 @@ template <> struct MDNodeKeyImpl { unsigned Arg; unsigned Flags; - MDNodeKeyImpl(unsigned Tag, Metadata *Scope, StringRef Name, Metadata *File, - unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags) - : Tag(Tag), Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), - Arg(Arg), Flags(Flags) {} + MDNodeKeyImpl(Metadata *Scope, StringRef Name, Metadata *File, unsigned Line, + Metadata *Type, unsigned Arg, unsigned Flags) + : Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), Arg(Arg), + Flags(Flags) {} MDNodeKeyImpl(const DILocalVariable *N) - : Tag(N->getTag()), Scope(N->getRawScope()), Name(N->getName()), - File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()), - Arg(N->getArg()), Flags(N->getFlags()) {} + : Scope(N->getRawScope()), Name(N->getName()), File(N->getRawFile()), + Line(N->getLine()), Type(N->getRawType()), Arg(N->getArg()), + Flags(N->getFlags()) {} bool isKeyOf(const DILocalVariable *RHS) const { - return Tag == RHS->getTag() && Scope == RHS->getRawScope() && - Name == RHS->getName() && File == RHS->getRawFile() && - Line == RHS->getLine() && Type == RHS->getRawType() && - Arg == RHS->getArg() && Flags == RHS->getFlags(); + return Scope == RHS->getRawScope() && Name == RHS->getName() && + File == RHS->getRawFile() && Line == RHS->getLine() && + Type == RHS->getRawType() && Arg == RHS->getArg() && + Flags == RHS->getFlags(); } unsigned getHashValue() const { - return hash_combine(Tag, Scope, Name, File, Line, Type, Arg, Flags); + return hash_combine(Scope, Name, File, Line, Type, Arg, Flags); } }; diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index 855456d0b2b..7d791acf838 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -1077,13 +1077,9 @@ void Verifier::visitDILocalVariable(const DILocalVariable &N) { // Checks common to all variables. visitDIVariable(N); - Assert(N.getTag() == dwarf::DW_TAG_auto_variable || - N.getTag() == dwarf::DW_TAG_arg_variable, - "invalid tag", &N); + Assert(N.getTag() == dwarf::DW_TAG_variable, "invalid tag", &N); Assert(N.getRawScope() && isa(N.getRawScope()), "local variable requires a valid scope", &N, N.getRawScope()); - Assert(bool(N.getArg()) == (N.getTag() == dwarf::DW_TAG_arg_variable), - "local variable should have arg iff it's a DW_TAG_arg_variable", &N); } void Verifier::visitDIExpression(const DIExpression &N) { diff --git a/test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll b/test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll index 8a6735fbca4..df9719baf07 100644 --- a/test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll +++ b/test/Assembler/2010-02-05-FunctionLocalMetadataBecomesNull.ll @@ -26,7 +26,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone !7 = !{!1} !6 = !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 131941)", isOptimized: true, emissionKind: 0, file: !8, enums: !9, retainedTypes: !9, subprograms: !7) -!0 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "c", line: 2, scope: !1, file: !2, type: !5) +!0 = !DILocalVariable(name: "c", line: 2, scope: !1, file: !2, type: !5) !1 = !DISubprogram(name: "main", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !8, scope: !2, type: !3, function: i32 ()* @main) !2 = !DIFile(filename: "/d/j/debug-test.c", directory: "/Volumes/Data/b") !3 = !DISubroutineType(types: !4) diff --git a/test/Assembler/dilocalvariable-arg-large.ll b/test/Assembler/dilocalvariable-arg-large.ll index 7788186a54a..a4c3f8c9763 100644 --- a/test/Assembler/dilocalvariable-arg-large.ll +++ b/test/Assembler/dilocalvariable-arg-large.ll @@ -6,5 +6,5 @@ !0 = distinct !DISubprogram() -; CHECK: !1 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "foo", arg: 65535, scope: !0) -!1 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "foo", arg: 65535, scope: !0) +; CHECK: !1 = !DILocalVariable(name: "foo", arg: 65535, scope: !0) +!1 = !DILocalVariable(name: "foo", arg: 65535, scope: !0) diff --git a/test/Assembler/dilocalvariable.ll b/test/Assembler/dilocalvariable.ll index affe6105e1c..d286dd92a40 100644 --- a/test/Assembler/dilocalvariable.ll +++ b/test/Assembler/dilocalvariable.ll @@ -12,15 +12,15 @@ !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !4 = !DILocation(scope: !0) -; CHECK: !5 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "foo", arg: 3, scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial) -; CHECK: !6 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "foo", scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial) -!5 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "foo", arg: 3, +; CHECK: !5 = !DILocalVariable(name: "foo", arg: 3, scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial) +; CHECK: !6 = !DILocalVariable(name: "foo", scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial) +!5 = !DILocalVariable(name: "foo", arg: 3, scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial) -!6 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "foo", scope: !0, +!6 = !DILocalVariable(name: "foo", scope: !0, file: !2, line: 7, type: !3, flags: DIFlagArtificial) -; CHECK: !7 = !DILocalVariable(tag: DW_TAG_arg_variable, arg: 1, scope: !0) -; CHECK: !8 = !DILocalVariable(tag: DW_TAG_auto_variable, scope: !0) -!7 = !DILocalVariable(tag: DW_TAG_arg_variable, scope: !0, arg: 1) -!8 = !DILocalVariable(tag: DW_TAG_auto_variable, scope: !0) +; CHECK: !7 = !DILocalVariable(arg: 1, scope: !0) +; CHECK: !8 = !DILocalVariable(scope: !0) +!7 = !DILocalVariable(scope: !0, arg: 1) +!8 = !DILocalVariable(scope: !0) diff --git a/test/Assembler/invalid-dilocalvariable-arg-large.ll b/test/Assembler/invalid-dilocalvariable-arg-large.ll index d62da601e13..e6e4a76b1c1 100644 --- a/test/Assembler/invalid-dilocalvariable-arg-large.ll +++ b/test/Assembler/invalid-dilocalvariable-arg-large.ll @@ -1,6 +1,6 @@ ; RUN: not llvm-as < %s 2>&1 | FileCheck %s -!0 = !DILocalVariable(tag: DW_TAG_arg_variable, scope: !{}, arg: 65535) +!0 = !DILocalVariable(scope: !{}, arg: 65535) -; CHECK: :[[@LINE+1]]:66: error: value for 'arg' too large, limit is 65535 -!1 = !DILocalVariable(tag: DW_TAG_arg_variable, scope: !{}, arg: 65536) +; CHECK: :[[@LINE+1]]:40: error: value for 'arg' too large, limit is 65535 +!1 = !DILocalVariable(scope: !{}, arg: 65536) diff --git a/test/Assembler/invalid-dilocalvariable-arg-negative.ll b/test/Assembler/invalid-dilocalvariable-arg-negative.ll index ff90d66fa11..9cf8e973db2 100644 --- a/test/Assembler/invalid-dilocalvariable-arg-negative.ll +++ b/test/Assembler/invalid-dilocalvariable-arg-negative.ll @@ -1,7 +1,7 @@ ; RUN: not llvm-as < %s 2>&1 | FileCheck %s -!0 = !DILocalVariable(tag: DW_TAG_arg_variable, scope: !{}, arg: 1) -!1 = !DILocalVariable(tag: DW_TAG_auto_variable, scope: !{}, arg: 0) +!0 = !DILocalVariable(scope: !{}, arg: 1) +!1 = !DILocalVariable(scope: !{}) -; CHECK: :[[@LINE+1]]:66: error: expected unsigned integer -!2 = !DILocalVariable(tag: DW_TAG_arg_variable, scope: !{}, arg: -1) +; CHECK: :[[@LINE+1]]:40: error: expected unsigned integer +!2 = !DILocalVariable(scope: !{}, arg: -1) diff --git a/test/Assembler/invalid-dilocalvariable-missing-scope.ll b/test/Assembler/invalid-dilocalvariable-missing-scope.ll index 45dcad71360..86bf52ddf2d 100644 --- a/test/Assembler/invalid-dilocalvariable-missing-scope.ll +++ b/test/Assembler/invalid-dilocalvariable-missing-scope.ll @@ -1,4 +1,4 @@ ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s -; CHECK: :[[@LINE+1]]:48: error: missing required field 'scope' -!0 = !DILocalVariable(tag: DW_TAG_auto_variable) +; CHECK: :[[@LINE+1]]:23: error: missing required field 'scope' +!0 = !DILocalVariable() diff --git a/test/Assembler/invalid-dilocalvariable-missing-tag.ll b/test/Assembler/invalid-dilocalvariable-missing-tag.ll deleted file mode 100644 index 18062edf75b..00000000000 --- a/test/Assembler/invalid-dilocalvariable-missing-tag.ll +++ /dev/null @@ -1,4 +0,0 @@ -; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s - -; CHECK: :[[@LINE+1]]:45: error: missing required field 'tag' -!0 = !DILocalVariable(scope: !DISubprogram()) diff --git a/test/Bitcode/DILocalVariable-explicit-tags.ll b/test/Bitcode/DILocalVariable-explicit-tags.ll new file mode 100644 index 00000000000..bca0a4c7bb0 --- /dev/null +++ b/test/Bitcode/DILocalVariable-explicit-tags.ll @@ -0,0 +1,16 @@ +; Bitcode compiled with 3.7_rc2. 3.7 had redundant (but mandatory) tag fields +; on DILocalVariable. +; +; RUN: llvm-dis < %s.bc -o - | llvm-as | llvm-dis | FileCheck %s + +; CHECK: ![[SP:[0-9]+]] = !DISubprogram(name: "foo",{{.*}} variables: ![[VARS:[0-9]+]] +; CHECK: ![[VARS]] = !{![[PARAM:[0-9]+]], ![[AUTO:[0-9]+]]} +; CHECK: ![[PARAM]] = !DILocalVariable(name: "param", arg: 1, scope: ![[SP]]) +; CHECK: ![[AUTO]] = !DILocalVariable(name: "auto", scope: ![[SP]]) + +!named = !{!0} + +!0 = !DISubprogram(name: "foo", variables: !1) +!1 = !{!2, !3} +!2 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "param", arg: 1, scope: !0) +!3 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "auto", scope: !0) diff --git a/test/Bitcode/DILocalVariable-explicit-tags.ll.bc b/test/Bitcode/DILocalVariable-explicit-tags.ll.bc new file mode 100644 index 0000000000000000000000000000000000000000..4efcbe878f84c471bf746ba6e096bfb171dee6af GIT binary patch literal 500 zcmZ>AK5$Qwhk>Drfq{X$Nr8b0NDBiod!zD1#}h1`Yyw7>lNeigR9QJBBH-msB2T)-`vw_HJH3kr~0f<4sAZkbJ z)~OSHIf4EHndbx)Gv;WJIr2~@O@z_5!`Y(caF0_1du0WC@r**AXAJyr1^B)+@EP+s z$sIZ=* zy_vxG(11VBfdBCaz7GL>#sWuV?#qv=_~2ubk1S^X>!Ry9az< z5AeM)U`{%*Q0B=(nKNMWPNK{yMVTXwvZoT+u1#>ZJmG9P15EBXY%#^zqJ!Cb%3*z= RrGJ{NuP|G0U