mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
IR: Give 'DI' prefix to debug info metadata
Finish off PR23080 by renaming the debug info IR constructs from `MD*` to `DI*`. The last of the `DIDescriptor` classes were deleted in r235356, and the last of the related typedefs removed in r235413, so this has all baked for about a week. Note: If you have out-of-tree code (like a frontend), I recommend that you get everything compiling and tests passing with the *previous* commit before updating to this one. It'll be easier to keep track of what code is using the `DIDescriptor` hierarchy and what you've already updated, and I think you're extremely unlikely to insert bugs. YMMV of course. Back to *this* commit: I did this using the rename-md-di-nodes.sh upgrade script I've attached to PR23080 (both code and testcases) and filtered through clang-format-diff.py. I edited the tests for test/Assembler/invalid-generic-debug-node-*.ll by hand since the columns were off-by-three. It should work on your out-of-tree testcases (and code, if you've followed the advice in the previous paragraph). Some of the tests are in badly named files now (e.g., test/Assembler/invalid-mdcompositetype-missing-tag.ll should be 'dicompositetype'); I'll come back and move the files in a follow-up commit. llvm-svn: 236120
This commit is contained in:
parent
339d8a9c1b
commit
09b5c9c24d
@ -56,8 +56,8 @@ LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(LLVMDIBuilderRef Dref,
|
||||
unsigned Line,
|
||||
unsigned Column) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
auto *LB = D->createLexicalBlock(unwrap<MDLocalScope>(Scope),
|
||||
unwrap<MDFile>(File), Line, Column);
|
||||
auto *LB = D->createLexicalBlock(unwrap<DILocalScope>(Scope),
|
||||
unwrap<DIFile>(File), Line, Column);
|
||||
return wrap(LB);
|
||||
}
|
||||
|
||||
@ -66,8 +66,8 @@ LLVMMetadataRef LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Dref,
|
||||
LLVMMetadataRef File,
|
||||
unsigned Discriminator) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
return wrap(D->createLexicalBlockFile(unwrap<MDLocalScope>(Scope),
|
||||
unwrap<MDFile>(File), Discriminator));
|
||||
return wrap(D->createLexicalBlockFile(unwrap<DILocalScope>(Scope),
|
||||
unwrap<DIFile>(File), Discriminator));
|
||||
}
|
||||
|
||||
LLVMMetadataRef LLVMDIBuilderCreateFunction(
|
||||
@ -76,9 +76,9 @@ LLVMMetadataRef LLVMDIBuilderCreateFunction(
|
||||
LLVMMetadataRef CompositeType, int IsLocalToUnit, int IsDefinition,
|
||||
unsigned ScopeLine, unsigned Flags, int IsOptimized, LLVMValueRef Func) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
return wrap(D->createFunction(unwrap<MDScope>(Scope), Name, LinkageName,
|
||||
File ? unwrap<MDFile>(File) : nullptr, Line,
|
||||
unwrap<MDSubroutineType>(CompositeType),
|
||||
return wrap(D->createFunction(unwrap<DIScope>(Scope), Name, LinkageName,
|
||||
File ? unwrap<DIFile>(File) : nullptr, Line,
|
||||
unwrap<DISubroutineType>(CompositeType),
|
||||
IsLocalToUnit, IsDefinition, ScopeLine, Flags,
|
||||
IsOptimized, unwrap<Function>(Func)));
|
||||
}
|
||||
@ -89,8 +89,8 @@ LLVMMetadataRef LLVMDIBuilderCreateLocalVariable(
|
||||
int AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
return wrap(D->createLocalVariable(
|
||||
Tag, unwrap<MDScope>(Scope), Name, unwrap<MDFile>(File), Line,
|
||||
unwrap<MDType>(Ty), AlwaysPreserve, Flags, ArgNo));
|
||||
Tag, unwrap<DIScope>(Scope), Name, unwrap<DIFile>(File), Line,
|
||||
unwrap<DIType>(Ty), AlwaysPreserve, Flags, ArgNo));
|
||||
}
|
||||
|
||||
LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Dref,
|
||||
@ -108,7 +108,7 @@ LLVMMetadataRef LLVMDIBuilderCreatePointerType(LLVMDIBuilderRef Dref,
|
||||
uint64_t AlignInBits,
|
||||
const char *Name) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
return wrap(D->createPointerType(unwrap<MDType>(PointeeType), SizeInBits,
|
||||
return wrap(D->createPointerType(unwrap<DIType>(PointeeType), SizeInBits,
|
||||
AlignInBits, Name));
|
||||
}
|
||||
|
||||
@ -117,8 +117,8 @@ LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Dref, LLVMMetadataRef File,
|
||||
LLVMMetadataRef ParameterTypes) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
return wrap(
|
||||
D->createSubroutineType(File ? unwrap<MDFile>(File) : nullptr,
|
||||
MDTypeRefArray(unwrap<MDTuple>(ParameterTypes))));
|
||||
D->createSubroutineType(File ? unwrap<DIFile>(File) : nullptr,
|
||||
DITypeRefArray(unwrap<MDTuple>(ParameterTypes))));
|
||||
}
|
||||
|
||||
LLVMMetadataRef LLVMDIBuilderCreateStructType(
|
||||
@ -128,10 +128,10 @@ LLVMMetadataRef LLVMDIBuilderCreateStructType(
|
||||
LLVMMetadataRef ElementTypes) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
return wrap(D->createStructType(
|
||||
unwrap<MDScope>(Scope), Name, File ? unwrap<MDFile>(File) : nullptr, Line,
|
||||
unwrap<DIScope>(Scope), Name, File ? unwrap<DIFile>(File) : nullptr, Line,
|
||||
SizeInBits, AlignInBits, Flags,
|
||||
DerivedFrom ? unwrap<MDType>(DerivedFrom) : nullptr,
|
||||
ElementTypes ? DebugNodeArray(unwrap<MDTuple>(ElementTypes)) : nullptr));
|
||||
DerivedFrom ? unwrap<DIType>(DerivedFrom) : nullptr,
|
||||
ElementTypes ? DINodeArray(unwrap<MDTuple>(ElementTypes)) : nullptr));
|
||||
}
|
||||
|
||||
LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType(
|
||||
@ -141,7 +141,7 @@ LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType(
|
||||
unsigned Flags) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
return wrap(D->createReplaceableCompositeType(
|
||||
Tag, Name, unwrap<MDScope>(Scope), File ? unwrap<MDFile>(File) : nullptr,
|
||||
Tag, Name, unwrap<DIScope>(Scope), File ? unwrap<DIFile>(File) : nullptr,
|
||||
Line, RuntimeLang, SizeInBits, AlignInBits, Flags));
|
||||
}
|
||||
|
||||
@ -153,8 +153,8 @@ LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef Dref, LLVMMetadataRef Scope,
|
||||
unsigned Flags, LLVMMetadataRef Ty) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
return wrap(D->createMemberType(
|
||||
unwrap<MDScope>(Scope), Name, File ? unwrap<MDFile>(File) : nullptr, Line,
|
||||
SizeInBits, AlignInBits, OffsetInBits, Flags, unwrap<MDType>(Ty)));
|
||||
unwrap<DIScope>(Scope), Name, File ? unwrap<DIFile>(File) : nullptr, Line,
|
||||
SizeInBits, AlignInBits, OffsetInBits, Flags, unwrap<DIType>(Ty)));
|
||||
}
|
||||
|
||||
LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Dref,
|
||||
@ -164,8 +164,8 @@ LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Dref,
|
||||
LLVMMetadataRef Subscripts) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
return wrap(D->createArrayType(SizeInBits, AlignInBits,
|
||||
unwrap<MDType>(ElementType),
|
||||
DebugNodeArray(unwrap<MDTuple>(Subscripts))));
|
||||
unwrap<DIType>(ElementType),
|
||||
DINodeArray(unwrap<MDTuple>(Subscripts))));
|
||||
}
|
||||
|
||||
LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Dref,
|
||||
@ -173,9 +173,9 @@ LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Dref,
|
||||
LLVMMetadataRef File, unsigned Line,
|
||||
LLVMMetadataRef Context) {
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
return wrap(D->createTypedef(unwrap<MDType>(Ty), Name,
|
||||
File ? unwrap<MDFile>(File) : nullptr, Line,
|
||||
Context ? unwrap<MDScope>(Context) : nullptr));
|
||||
return wrap(D->createTypedef(unwrap<DIType>(Ty), Name,
|
||||
File ? unwrap<DIFile>(File) : nullptr, Line,
|
||||
Context ? unwrap<DIScope>(Context) : nullptr));
|
||||
}
|
||||
|
||||
LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Dref,
|
||||
@ -190,7 +190,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Dref,
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
Metadata **DataValue = unwrap(Data);
|
||||
ArrayRef<Metadata *> Elements(DataValue, Length);
|
||||
DebugNodeArray A = D->getOrCreateArray(Elements);
|
||||
DINodeArray A = D->getOrCreateArray(Elements);
|
||||
return wrap(A.get());
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Dref,
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
Metadata **DataValue = unwrap(Data);
|
||||
ArrayRef<Metadata *> Elements(DataValue, Length);
|
||||
MDTypeRefArray A = D->getOrCreateTypeArray(Elements);
|
||||
DITypeRefArray A = D->getOrCreateTypeArray(Elements);
|
||||
return wrap(A.get());
|
||||
}
|
||||
|
||||
@ -221,8 +221,8 @@ LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Dref,
|
||||
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
Instruction *Instr = D->insertDeclare(
|
||||
unwrap(Storage), unwrap<MDLocalVariable>(VarInfo),
|
||||
unwrap<MDExpression>(Expr), /* DebugLoc */ nullptr, unwrap(Block));
|
||||
unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
|
||||
unwrap<DIExpression>(Expr), /* DebugLoc */ nullptr, unwrap(Block));
|
||||
return wrap(Instr);
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ LLVMValueRef LLVMDIBuilderInsertValueAtEnd(LLVMDIBuilderRef Dref,
|
||||
|
||||
DIBuilder *D = unwrap(Dref);
|
||||
Instruction *Instr = D->insertDbgValueIntrinsic(
|
||||
unwrap(Val), Offset, unwrap<MDLocalVariable>(VarInfo),
|
||||
unwrap<MDExpression>(Expr), /* DebugLoc */ nullptr, unwrap(Block));
|
||||
unwrap(Val), Offset, unwrap<DILocalVariable>(VarInfo),
|
||||
unwrap<DIExpression>(Expr), /* DebugLoc */ nullptr, unwrap(Block));
|
||||
return wrap(Instr);
|
||||
}
|
||||
|
@ -200,9 +200,9 @@ For example, the following works like you'd expect:
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDLocation(line: 5, scope: !1, inlinedAt: !2)
|
||||
!0 = !DILocation(line: 5, scope: !1, inlinedAt: !2)
|
||||
|
||||
; CHECK: !MDLocation(line: 5,
|
||||
; CHECK: !DILocation(line: 5,
|
||||
; CHECK-NOT: column:
|
||||
; CHECK-SAME: scope: ![[SCOPE:[0-9]+]]
|
||||
|
||||
|
212
docs/LangRef.rst
212
docs/LangRef.rst
@ -2922,12 +2922,12 @@ order.
|
||||
These aren't inherently debug info centric, but currently all the specialized
|
||||
metadata nodes are related to debug info.
|
||||
|
||||
.. _MDCompileUnit:
|
||||
.. _DICompileUnit:
|
||||
|
||||
MDCompileUnit
|
||||
DICompileUnit
|
||||
"""""""""""""
|
||||
|
||||
``MDCompileUnit`` nodes represent a compile unit. The ``enums:``,
|
||||
``DICompileUnit`` nodes represent a compile unit. The ``enums:``,
|
||||
``retainedTypes:``, ``subprograms:``, ``globals:`` and ``imports:`` fields are
|
||||
tuples containing the debug info to be emitted along with the compile unit,
|
||||
regardless of code optimizations (some nodes are only emitted if there are
|
||||
@ -2935,7 +2935,7 @@ references to them from instructions).
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDCompileUnit(language: DW_LANG_C99, file: !1, producer: "clang",
|
||||
!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang",
|
||||
isOptimized: true, flags: "-O2", runtimeVersion: 2,
|
||||
splitDebugFilename: "abc.debug", emissionKind: 1,
|
||||
enums: !2, retainedTypes: !3, subprograms: !4,
|
||||
@ -2947,33 +2947,33 @@ These descriptors are collected by a named metadata ``!llvm.dbg.cu``. They
|
||||
keep track of subprograms, global variables, type information, and imported
|
||||
entities (declarations and namespaces).
|
||||
|
||||
.. _MDFile:
|
||||
.. _DIFile:
|
||||
|
||||
MDFile
|
||||
DIFile
|
||||
""""""
|
||||
|
||||
``MDFile`` nodes represent files. The ``filename:`` can include slashes.
|
||||
``DIFile`` nodes represent files. The ``filename:`` can include slashes.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
!0 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
|
||||
Files are sometimes used in ``scope:`` fields, and are the only valid target
|
||||
for ``file:`` fields.
|
||||
|
||||
.. _MDLocation:
|
||||
.. _DILocation:
|
||||
|
||||
MDBasicType
|
||||
DIBasicType
|
||||
"""""""""""
|
||||
|
||||
``MDBasicType`` nodes represent primitive types, such as ``int``, ``bool`` and
|
||||
``DIBasicType`` nodes represent primitive types, such as ``int``, ``bool`` and
|
||||
``float``. ``tag:`` defaults to ``DW_TAG_base_type``.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDBasicType(name: "unsigned char", size: 8, align: 8,
|
||||
!0 = !DIBasicType(name: "unsigned char", size: 8, align: 8,
|
||||
encoding: DW_ATE_unsigned_char)
|
||||
!1 = !MDBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
|
||||
!1 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
|
||||
|
||||
The ``encoding:`` describes the details of the type. Usually it's one of the
|
||||
following:
|
||||
@ -2988,12 +2988,12 @@ following:
|
||||
DW_ATE_unsigned = 7
|
||||
DW_ATE_unsigned_char = 8
|
||||
|
||||
.. _MDSubroutineType:
|
||||
.. _DISubroutineType:
|
||||
|
||||
MDSubroutineType
|
||||
DISubroutineType
|
||||
""""""""""""""""
|
||||
|
||||
``MDSubroutineType`` nodes represent subroutine types. Their ``types:`` field
|
||||
``DISubroutineType`` nodes represent subroutine types. Their ``types:`` field
|
||||
refers to a tuple; the first operand is the return type, while the rest are the
|
||||
types of the formal arguments in order. If the first operand is ``null``, that
|
||||
represents a function with no return value (such as ``void foo() {}`` in C++).
|
||||
@ -3002,21 +3002,21 @@ represents a function with no return value (such as ``void foo() {}`` in C++).
|
||||
|
||||
!0 = !BasicType(name: "int", size: 32, align: 32, DW_ATE_signed)
|
||||
!1 = !BasicType(name: "char", size: 8, align: 8, DW_ATE_signed_char)
|
||||
!2 = !MDSubroutineType(types: !{null, !0, !1}) ; void (int, char)
|
||||
!2 = !DISubroutineType(types: !{null, !0, !1}) ; void (int, char)
|
||||
|
||||
.. _MDDerivedType:
|
||||
.. _DIDerivedType:
|
||||
|
||||
MDDerivedType
|
||||
DIDerivedType
|
||||
"""""""""""""
|
||||
|
||||
``MDDerivedType`` nodes represent types derived from other types, such as
|
||||
``DIDerivedType`` nodes represent types derived from other types, such as
|
||||
qualified types.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDBasicType(name: "unsigned char", size: 8, align: 8,
|
||||
!0 = !DIBasicType(name: "unsigned char", size: 8, align: 8,
|
||||
encoding: DW_ATE_unsigned_char)
|
||||
!1 = !MDDerivedType(tag: DW_TAG_pointer_type, baseType: !0, size: 32,
|
||||
!1 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !0, size: 32,
|
||||
align: 32)
|
||||
|
||||
The following ``tag:`` values are valid:
|
||||
@ -3034,7 +3034,7 @@ The following ``tag:`` values are valid:
|
||||
DW_TAG_restrict_type = 55
|
||||
|
||||
``DW_TAG_member`` is used to define a member of a :ref:`composite type
|
||||
<MDCompositeType>` or :ref:`subprogram <MDSubprogram>`. The type of the member
|
||||
<DICompositeType>` or :ref:`subprogram <DISubprogram>`. The type of the member
|
||||
is the ``baseType:``. The ``offset:`` is the member's bit offset.
|
||||
``DW_TAG_formal_parameter`` is used to define a member which is a formal
|
||||
argument of a subprogram.
|
||||
@ -3047,12 +3047,12 @@ argument of a subprogram.
|
||||
|
||||
Note that the ``void *`` type is expressed as a type derived from NULL.
|
||||
|
||||
.. _MDCompositeType:
|
||||
.. _DICompositeType:
|
||||
|
||||
MDCompositeType
|
||||
DICompositeType
|
||||
"""""""""""""""
|
||||
|
||||
``MDCompositeType`` nodes represent types composed of other types, like
|
||||
``DICompositeType`` nodes represent types composed of other types, like
|
||||
structures and unions. ``elements:`` points to a tuple of the composed types.
|
||||
|
||||
If the source language supports ODR, the ``identifier:`` field gives the unique
|
||||
@ -3062,10 +3062,10 @@ can refer to composite types indirectly via a :ref:`metadata string
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDEnumerator(name: "SixKind", value: 7)
|
||||
!1 = !MDEnumerator(name: "SevenKind", value: 7)
|
||||
!2 = !MDEnumerator(name: "NegEightKind", value: -8)
|
||||
!3 = !MDCompositeType(tag: DW_TAG_enumeration_type, name: "Enum", file: !12,
|
||||
!0 = !DIEnumerator(name: "SixKind", value: 7)
|
||||
!1 = !DIEnumerator(name: "SevenKind", value: 7)
|
||||
!2 = !DIEnumerator(name: "NegEightKind", value: -8)
|
||||
!3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum", file: !12,
|
||||
line: 2, size: 32, align: 32, identifier: "_M4Enum",
|
||||
elements: !{!0, !1, !2})
|
||||
|
||||
@ -3083,108 +3083,108 @@ The following ``tag:`` values are valid:
|
||||
|
||||
|
||||
For ``DW_TAG_array_type``, the ``elements:`` should be :ref:`subrange
|
||||
descriptors <MDSubrange>`, each representing the range of subscripts at that
|
||||
descriptors <DISubrange>`, each representing the range of subscripts at that
|
||||
level of indexing. The ``DIFlagVector`` flag to ``flags:`` indicates that an
|
||||
array type is a native packed vector.
|
||||
|
||||
For ``DW_TAG_enumeration_type``, the ``elements:`` should be :ref:`enumerator
|
||||
descriptors <MDEnumerator>`, each representing the definition of an enumeration
|
||||
descriptors <DIEnumerator>`, each representing the definition of an enumeration
|
||||
value for the set. All enumeration type descriptors are collected in the
|
||||
``enums:`` field of the :ref:`compile unit <MDCompileUnit>`.
|
||||
``enums:`` field of the :ref:`compile unit <DICompileUnit>`.
|
||||
|
||||
For ``DW_TAG_structure_type``, ``DW_TAG_class_type``, and
|
||||
``DW_TAG_union_type``, the ``elements:`` should be :ref:`derived types
|
||||
<MDDerivedType>` with ``tag: DW_TAG_member`` or ``tag: DW_TAG_inheritance``.
|
||||
<DIDerivedType>` with ``tag: DW_TAG_member`` or ``tag: DW_TAG_inheritance``.
|
||||
|
||||
.. _MDSubrange:
|
||||
.. _DISubrange:
|
||||
|
||||
MDSubrange
|
||||
DISubrange
|
||||
""""""""""
|
||||
|
||||
``MDSubrange`` nodes are the elements for ``DW_TAG_array_type`` variants of
|
||||
:ref:`MDCompositeType`. ``count: -1`` indicates an empty array.
|
||||
``DISubrange`` nodes are the elements for ``DW_TAG_array_type`` variants of
|
||||
:ref:`DICompositeType`. ``count: -1`` indicates an empty array.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDSubrange(count: 5, lowerBound: 0) ; array counting from 0
|
||||
!1 = !MDSubrange(count: 5, lowerBound: 1) ; array counting from 1
|
||||
!2 = !MDSubrange(count: -1) ; empty array.
|
||||
!0 = !DISubrange(count: 5, lowerBound: 0) ; array counting from 0
|
||||
!1 = !DISubrange(count: 5, lowerBound: 1) ; array counting from 1
|
||||
!2 = !DISubrange(count: -1) ; empty array.
|
||||
|
||||
.. _MDEnumerator:
|
||||
.. _DIEnumerator:
|
||||
|
||||
MDEnumerator
|
||||
DIEnumerator
|
||||
""""""""""""
|
||||
|
||||
``MDEnumerator`` nodes are the elements for ``DW_TAG_enumeration_type``
|
||||
variants of :ref:`MDCompositeType`.
|
||||
``DIEnumerator`` nodes are the elements for ``DW_TAG_enumeration_type``
|
||||
variants of :ref:`DICompositeType`.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDEnumerator(name: "SixKind", value: 7)
|
||||
!1 = !MDEnumerator(name: "SevenKind", value: 7)
|
||||
!2 = !MDEnumerator(name: "NegEightKind", value: -8)
|
||||
!0 = !DIEnumerator(name: "SixKind", value: 7)
|
||||
!1 = !DIEnumerator(name: "SevenKind", value: 7)
|
||||
!2 = !DIEnumerator(name: "NegEightKind", value: -8)
|
||||
|
||||
MDTemplateTypeParameter
|
||||
DITemplateTypeParameter
|
||||
"""""""""""""""""""""""
|
||||
|
||||
``MDTemplateTypeParameter`` nodes represent type parameters to generic source
|
||||
language constructs. They are used (optionally) in :ref:`MDCompositeType` and
|
||||
:ref:`MDSubprogram` ``templateParams:`` fields.
|
||||
``DITemplateTypeParameter`` nodes represent type parameters to generic source
|
||||
language constructs. They are used (optionally) in :ref:`DICompositeType` and
|
||||
:ref:`DISubprogram` ``templateParams:`` fields.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDTemplateTypeParameter(name: "Ty", type: !1)
|
||||
!0 = !DITemplateTypeParameter(name: "Ty", type: !1)
|
||||
|
||||
MDTemplateValueParameter
|
||||
DITemplateValueParameter
|
||||
""""""""""""""""""""""""
|
||||
|
||||
``MDTemplateValueParameter`` nodes represent value parameters to generic source
|
||||
``DITemplateValueParameter`` nodes represent value parameters to generic source
|
||||
language constructs. ``tag:`` defaults to ``DW_TAG_template_value_parameter``,
|
||||
but if specified can also be set to ``DW_TAG_GNU_template_template_param`` or
|
||||
``DW_TAG_GNU_template_param_pack``. They are used (optionally) in
|
||||
:ref:`MDCompositeType` and :ref:`MDSubprogram` ``templateParams:`` fields.
|
||||
:ref:`DICompositeType` and :ref:`DISubprogram` ``templateParams:`` fields.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDTemplateValueParameter(name: "Ty", type: !1, value: i32 7)
|
||||
!0 = !DITemplateValueParameter(name: "Ty", type: !1, value: i32 7)
|
||||
|
||||
MDNamespace
|
||||
DINamespace
|
||||
"""""""""""
|
||||
|
||||
``MDNamespace`` nodes represent namespaces in the source language.
|
||||
``DINamespace`` nodes represent namespaces in the source language.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDNamespace(name: "myawesomeproject", scope: !1, file: !2, line: 7)
|
||||
!0 = !DINamespace(name: "myawesomeproject", scope: !1, file: !2, line: 7)
|
||||
|
||||
MDGlobalVariable
|
||||
DIGlobalVariable
|
||||
""""""""""""""""
|
||||
|
||||
``MDGlobalVariable`` nodes represent global variables in the source language.
|
||||
``DIGlobalVariable`` nodes represent global variables in the source language.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDGlobalVariable(name: "foo", linkageName: "foo", scope: !1,
|
||||
!0 = !DIGlobalVariable(name: "foo", linkageName: "foo", scope: !1,
|
||||
file: !2, line: 7, type: !3, isLocal: true,
|
||||
isDefinition: false, variable: i32* @foo,
|
||||
declaration: !4)
|
||||
|
||||
All global variables should be referenced by the `globals:` field of a
|
||||
:ref:`compile unit <MDCompileUnit>`.
|
||||
:ref:`compile unit <DICompileUnit>`.
|
||||
|
||||
.. _MDSubprogram:
|
||||
.. _DISubprogram:
|
||||
|
||||
MDSubprogram
|
||||
DISubprogram
|
||||
""""""""""""
|
||||
|
||||
``MDSubprogram`` nodes represent functions from the source language. The
|
||||
``variables:`` field points at :ref:`variables <MDLocalVariable>` that must be
|
||||
``DISubprogram`` nodes represent functions from the source language. The
|
||||
``variables:`` field points at :ref:`variables <DILocalVariable>` that must be
|
||||
retained, even if their IR counterparts are optimized out of the IR. The
|
||||
``type:`` field must point at an :ref:`MDSubroutineType`.
|
||||
``type:`` field must point at an :ref:`DISubroutineType`.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDSubprogram(name: "foo", linkageName: "_Zfoov", scope: !1,
|
||||
!0 = !DISubprogram(name: "foo", linkageName: "_Zfoov", scope: !1,
|
||||
file: !2, line: 7, type: !3, isLocal: true,
|
||||
isDefinition: false, scopeLine: 8, containingType: !4,
|
||||
virtuality: DW_VIRTUALITY_pure_virtual, virtualIndex: 10,
|
||||
@ -3192,76 +3192,76 @@ retained, even if their IR counterparts are optimized out of the IR. The
|
||||
function: void ()* @_Z3foov,
|
||||
templateParams: !5, declaration: !6, variables: !7)
|
||||
|
||||
.. _MDLexicalBlock:
|
||||
.. _DILexicalBlock:
|
||||
|
||||
MDLexicalBlock
|
||||
DILexicalBlock
|
||||
""""""""""""""
|
||||
|
||||
``MDLexicalBlock`` nodes describe nested blocks within a :ref:`subprogram
|
||||
<MDSubprogram>`. The line number and column numbers are used to dinstinguish
|
||||
``DILexicalBlock`` nodes describe nested blocks within a :ref:`subprogram
|
||||
<DISubprogram>`. The line number and column numbers are used to dinstinguish
|
||||
two lexical blocks at same depth. They are valid targets for ``scope:``
|
||||
fields.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = distinct !MDLexicalBlock(scope: !1, file: !2, line: 7, column: 35)
|
||||
!0 = distinct !DILexicalBlock(scope: !1, file: !2, line: 7, column: 35)
|
||||
|
||||
Usually lexical blocks are ``distinct`` to prevent node merging based on
|
||||
operands.
|
||||
|
||||
.. _MDLexicalBlockFile:
|
||||
.. _DILexicalBlockFile:
|
||||
|
||||
MDLexicalBlockFile
|
||||
DILexicalBlockFile
|
||||
""""""""""""""""""
|
||||
|
||||
``MDLexicalBlockFile`` nodes are used to discriminate between sections of a
|
||||
:ref:`lexical block <MDLexicalBlock>`. The ``file:`` field can be changed to
|
||||
``DILexicalBlockFile`` nodes are used to discriminate between sections of a
|
||||
:ref:`lexical block <DILexicalBlock>`. The ``file:`` field can be changed to
|
||||
indicate textual inclusion, or the ``discriminator:`` field can be used to
|
||||
discriminate between control flow within a single block in the source language.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDLexicalBlock(scope: !3, file: !4, line: 7, column: 35)
|
||||
!1 = !MDLexicalBlockFile(scope: !0, file: !4, discriminator: 0)
|
||||
!2 = !MDLexicalBlockFile(scope: !0, file: !4, discriminator: 1)
|
||||
!0 = !DILexicalBlock(scope: !3, file: !4, line: 7, column: 35)
|
||||
!1 = !DILexicalBlockFile(scope: !0, file: !4, discriminator: 0)
|
||||
!2 = !DILexicalBlockFile(scope: !0, file: !4, discriminator: 1)
|
||||
|
||||
MDLocation
|
||||
DILocation
|
||||
""""""""""
|
||||
|
||||
``MDLocation`` nodes represent source debug locations. The ``scope:`` field is
|
||||
mandatory, and points at an :ref:`MDLexicalBlockFile`, an
|
||||
:ref:`MDLexicalBlock`, or an :ref:`MDSubprogram`.
|
||||
``DILocation`` nodes represent source debug locations. The ``scope:`` field is
|
||||
mandatory, and points at an :ref:`DILexicalBlockFile`, an
|
||||
:ref:`DILexicalBlock`, or an :ref:`DISubprogram`.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDLocation(line: 2900, column: 42, scope: !1, inlinedAt: !2)
|
||||
!0 = !DILocation(line: 2900, column: 42, scope: !1, inlinedAt: !2)
|
||||
|
||||
.. _MDLocalVariable:
|
||||
.. _DILocalVariable:
|
||||
|
||||
MDLocalVariable
|
||||
DILocalVariable
|
||||
"""""""""""""""
|
||||
|
||||
``MDLocalVariable`` nodes represent local variables in the source language.
|
||||
``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:`MDSubprogram`.
|
||||
``variables:`` field of its :ref:`DISubprogram`.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 0,
|
||||
!0 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 0,
|
||||
scope: !3, file: !2, line: 7, type: !3,
|
||||
flags: DIFlagArtificial)
|
||||
!1 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 1,
|
||||
!1 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 1,
|
||||
scope: !4, file: !2, line: 7, type: !3)
|
||||
!1 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "y",
|
||||
!1 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "y",
|
||||
scope: !5, file: !2, line: 7, type: !3)
|
||||
|
||||
MDExpression
|
||||
DIExpression
|
||||
""""""""""""
|
||||
|
||||
``MDExpression`` nodes represent DWARF expression sequences. They are used in
|
||||
``DIExpression`` nodes represent DWARF expression sequences. They are used in
|
||||
:ref:`debug intrinsics<dbg_intrinsics>` (such as ``llvm.dbg.declare``) to
|
||||
describe how the referenced LLVM variable relates to the source language
|
||||
variable.
|
||||
@ -3275,30 +3275,30 @@ The current supported vocabulary is limited:
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!0 = !MDExpression(DW_OP_deref)
|
||||
!1 = !MDExpression(DW_OP_plus, 3)
|
||||
!2 = !MDExpression(DW_OP_bit_piece, 3, 7)
|
||||
!3 = !MDExpression(DW_OP_deref, DW_OP_plus, 3, DW_OP_bit_piece, 3, 7)
|
||||
!0 = !DIExpression(DW_OP_deref)
|
||||
!1 = !DIExpression(DW_OP_plus, 3)
|
||||
!2 = !DIExpression(DW_OP_bit_piece, 3, 7)
|
||||
!3 = !DIExpression(DW_OP_deref, DW_OP_plus, 3, DW_OP_bit_piece, 3, 7)
|
||||
|
||||
MDObjCProperty
|
||||
DIObjCProperty
|
||||
""""""""""""""
|
||||
|
||||
``MDObjCProperty`` nodes represent Objective-C property nodes.
|
||||
``DIObjCProperty`` nodes represent Objective-C property nodes.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!3 = !MDObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo",
|
||||
!3 = !DIObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo",
|
||||
getter: "getFoo", attributes: 7, type: !2)
|
||||
|
||||
MDImportedEntity
|
||||
DIImportedEntity
|
||||
""""""""""""""""
|
||||
|
||||
``MDImportedEntity`` nodes represent entities (such as modules) imported into a
|
||||
``DIImportedEntity`` nodes represent entities (such as modules) imported into a
|
||||
compile unit.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!2 = !MDImportedEntity(tag: DW_TAG_imported_module, name: "foo", scope: !0,
|
||||
!2 = !DIImportedEntity(tag: DW_TAG_imported_module, name: "foo", scope: !0,
|
||||
entity: !1, line: 7)
|
||||
|
||||
'``tbaa``' Metadata
|
||||
|
@ -153,8 +153,8 @@ debugger to interpret the information.
|
||||
To provide basic functionality, the LLVM debugger does have to make some
|
||||
assumptions about the source-level language being debugged, though it keeps
|
||||
these to a minimum. The only common features that the LLVM debugger assumes
|
||||
exist are `source files <LangRef.html#MDFile>`_, and `program objects
|
||||
<LangRef.html#MDGlobalVariable>`_. These abstract objects are used by a
|
||||
exist are `source files <LangRef.html#DIFile>`_, and `program objects
|
||||
<LangRef.html#DIGlobalVariable>`_. These abstract objects are used by a
|
||||
debugger to form stack traces, show information about local variables, etc.
|
||||
|
||||
This section of the documentation first describes the representation aspects
|
||||
@ -181,9 +181,9 @@ provide debug information at various points in generated code.
|
||||
|
||||
This intrinsic provides information about a local element (e.g., variable).
|
||||
The first argument is metadata holding the alloca for the variable. The second
|
||||
argument is a `local variable <LangRef.html#MDLocalVariable>`_ containing a
|
||||
argument is a `local variable <LangRef.html#DILocalVariable>`_ containing a
|
||||
description of the variable. The third argument is a `complex expression
|
||||
<LangRef.html#MDExpression>`_.
|
||||
<LangRef.html#DIExpression>`_.
|
||||
|
||||
``llvm.dbg.value``
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
@ -196,8 +196,8 @@ This intrinsic provides information when a user source variable is set to a new
|
||||
value. The first argument is the new value (wrapped as metadata). The second
|
||||
argument is the offset in the user source variable where the new value is
|
||||
written. The third argument is a `local variable
|
||||
<LangRef.html#MDLocalVariable>`_ containing a description of the variable. The
|
||||
third argument is a `complex expression <LangRef.html#MDExpression>`_.
|
||||
<LangRef.html#DILocalVariable>`_ containing a description of the variable. The
|
||||
third argument is a `complex expression <LangRef.html#DIExpression>`_.
|
||||
|
||||
Object lifetimes and scoping
|
||||
============================
|
||||
@ -259,31 +259,31 @@ Compiled to LLVM, this function would be represented like this:
|
||||
!llvm.module.flags = !{!7, !8, !9}
|
||||
!llvm.ident = !{!10}
|
||||
|
||||
!0 = !MDCompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 231150) (llvm/trunk 231154)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
|
||||
!1 = !MDFile(filename: "/dev/stdin", directory: "/Users/dexonsmith/data/llvm/debug-info")
|
||||
!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 231150) (llvm/trunk 231154)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
|
||||
!1 = !DIFile(filename: "/dev/stdin", directory: "/Users/dexonsmith/data/llvm/debug-info")
|
||||
!2 = !{}
|
||||
!3 = !{!4}
|
||||
!4 = !MDSubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, function: void ()* @foo, variables: !2)
|
||||
!5 = !MDSubroutineType(types: !6)
|
||||
!4 = !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, function: void ()* @foo, variables: !2)
|
||||
!5 = !DISubroutineType(types: !6)
|
||||
!6 = !{null}
|
||||
!7 = !{i32 2, !"Dwarf Version", i32 2}
|
||||
!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 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "X", scope: !4, file: !1, line: 2, type: !12)
|
||||
!12 = !MDBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
!13 = !MDExpression()
|
||||
!14 = !MDLocation(line: 2, column: 9, scope: !4)
|
||||
!15 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "Y", scope: !4, file: !1, line: 3, type: !12)
|
||||
!16 = !MDLocation(line: 3, column: 9, scope: !4)
|
||||
!17 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "Z", scope: !18, file: !1, line: 5, type: !12)
|
||||
!18 = distinct !MDLexicalBlock(scope: !4, file: !1, line: 4, column: 5)
|
||||
!19 = !MDLocation(line: 5, column: 11, scope: !18)
|
||||
!20 = !MDLocation(line: 6, column: 11, scope: !18)
|
||||
!21 = !MDLocation(line: 6, column: 9, scope: !18)
|
||||
!22 = !MDLocation(line: 8, column: 9, scope: !4)
|
||||
!23 = !MDLocation(line: 8, column: 7, scope: !4)
|
||||
!24 = !MDLocation(line: 9, column: 3, scope: !4)
|
||||
!11 = !DILocalVariable(tag: DW_TAG_auto_variable, 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)
|
||||
!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)
|
||||
!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)
|
||||
!21 = !DILocation(line: 6, column: 9, scope: !18)
|
||||
!22 = !DILocation(line: 8, column: 9, scope: !4)
|
||||
!23 = !DILocation(line: 8, column: 7, scope: !4)
|
||||
!24 = !DILocation(line: 9, column: 3, scope: !4)
|
||||
|
||||
|
||||
This example illustrates a few important details about LLVM debugging
|
||||
@ -303,15 +303,15 @@ scope information for the variable ``X``.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!14 = !MDLocation(line: 2, column: 9, scope: !4)
|
||||
!4 = !MDSubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5,
|
||||
!14 = !DILocation(line: 2, column: 9, scope: !4)
|
||||
!4 = !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5,
|
||||
isLocal: false, isDefinition: true, scopeLine: 1,
|
||||
isOptimized: false, function: void ()* @foo,
|
||||
variables: !2)
|
||||
|
||||
Here ``!14`` is metadata providing `location information
|
||||
<LangRef.html#MDLocation>`_. In this example, scope is encoded by ``!4``, a
|
||||
`subprogram descriptor <LangRef.html#MDSubprogram>`_. This way the location
|
||||
<LangRef.html#DILocation>`_. In this example, scope is encoded by ``!4``, a
|
||||
`subprogram descriptor <LangRef.html#DISubprogram>`_. This way the location
|
||||
information attached to the intrinsics indicates that the variable ``X`` is
|
||||
declared at line number 2 at a function level scope in function ``foo``.
|
||||
|
||||
@ -328,8 +328,8 @@ scope information for the variable ``Z``.
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
!18 = distinct !MDLexicalBlock(scope: !4, file: !1, line: 4, column: 5)
|
||||
!19 = !MDLocation(line: 5, column: 11, scope: !18)
|
||||
!18 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 5)
|
||||
!19 = !DILocation(line: 5, column: 11, scope: !18)
|
||||
|
||||
Here ``!19`` indicates that ``Z`` is declared at line number 5 and column
|
||||
number 0 inside of lexical scope ``!18``. The lexical scope itself resides
|
||||
@ -406,7 +406,7 @@ a C/C++ front-end would generate the following descriptors:
|
||||
!llvm.module.flags = !{!6, !7}
|
||||
|
||||
;; Define the compile unit.
|
||||
!0 = !MDCompileUnit(language: DW_LANG_C99, file: !1,
|
||||
!0 = !DICompileUnit(language: DW_LANG_C99, file: !1,
|
||||
producer:
|
||||
"clang version 3.7.0 (trunk 231150) (llvm/trunk 231154)",
|
||||
isOptimized: false, runtimeVersion: 0, emissionKind: 1,
|
||||
@ -416,7 +416,7 @@ a C/C++ front-end would generate the following descriptors:
|
||||
;;
|
||||
;; Define the file
|
||||
;;
|
||||
!1 = !MDFile(filename: "/dev/stdin",
|
||||
!1 = !DIFile(filename: "/dev/stdin",
|
||||
directory: "/Users/dexonsmith/data/llvm/debug-info")
|
||||
|
||||
;; An empty array.
|
||||
@ -428,14 +428,14 @@ a C/C++ front-end would generate the following descriptors:
|
||||
;;
|
||||
;; Define the global variable itself.
|
||||
;;
|
||||
!4 = !MDGlobalVariable(name: "MyGlobal", scope: !0, file: !1, line: 1,
|
||||
!4 = !DIGlobalVariable(name: "MyGlobal", scope: !0, file: !1, line: 1,
|
||||
type: !5, isLocal: false, isDefinition: true,
|
||||
variable: i32* @MyGlobal)
|
||||
|
||||
;;
|
||||
;; Define the type
|
||||
;;
|
||||
!5 = !MDBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
!5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
|
||||
;; Dwarf version to output.
|
||||
!6 = !{i32 2, !"Dwarf Version", i32 2}
|
||||
@ -461,7 +461,7 @@ a C/C++ front-end would generate the following descriptors:
|
||||
;;
|
||||
;; Define the anchor for subprograms.
|
||||
;;
|
||||
!4 = !MDSubprogram(name: "main", scope: !1, file: !1, line: 1, type: !5,
|
||||
!4 = !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !5,
|
||||
isLocal: false, isDefinition: true, scopeLine: 1,
|
||||
flags: DIFlagPrototyped, isOptimized: false,
|
||||
function: i32 (i32, i8**)* @main, variables: !2)
|
||||
|
@ -187,13 +187,13 @@ expressions:
|
||||
static DIBuilder *DBuilder;
|
||||
|
||||
struct DebugInfo {
|
||||
MDCompileUnit *TheCU;
|
||||
MDType *DblTy;
|
||||
DICompileUnit *TheCU;
|
||||
DIType *DblTy;
|
||||
|
||||
MDType *getDoubleTy();
|
||||
DIType *getDoubleTy();
|
||||
} KSDbgInfo;
|
||||
|
||||
MDType *DebugInfo::getDoubleTy() {
|
||||
DIType *DebugInfo::getDoubleTy() {
|
||||
if (DblTy.isValid())
|
||||
return DblTy;
|
||||
|
||||
@ -245,25 +245,25 @@ So the context:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
MDFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU.getFilename(),
|
||||
DIFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU.getFilename(),
|
||||
KSDbgInfo.TheCU.getDirectory());
|
||||
|
||||
giving us an MDFile and asking the ``Compile Unit`` we created above for the
|
||||
giving us an DIFile and asking the ``Compile Unit`` we created above for the
|
||||
directory and filename where we are currently. Then, for now, we use some
|
||||
source locations of 0 (since our AST doesn't currently have source location
|
||||
information) and construct our function definition:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
MDScope *FContext = Unit;
|
||||
DIScope *FContext = Unit;
|
||||
unsigned LineNo = 0;
|
||||
unsigned ScopeLine = 0;
|
||||
MDSubprogram *SP = DBuilder->createFunction(
|
||||
DISubprogram *SP = DBuilder->createFunction(
|
||||
FContext, Name, StringRef(), Unit, LineNo,
|
||||
CreateFunctionType(Args.size(), Unit), false /* internal linkage */,
|
||||
true /* definition */, ScopeLine, DebugNode::FlagPrototyped, false, F);
|
||||
true /* definition */, ScopeLine, DINode::FlagPrototyped, false, F);
|
||||
|
||||
and we now have an MDSubprogram that contains a reference to all of our
|
||||
and we now have an DISubprogram that contains a reference to all of our
|
||||
metadata for the function.
|
||||
|
||||
Source Locations
|
||||
@ -330,7 +330,7 @@ by constructing another small function:
|
||||
.. code-block:: c++
|
||||
|
||||
void DebugInfo::emitLocation(ExprAST *AST) {
|
||||
MDScope *Scope;
|
||||
DIScope *Scope;
|
||||
if (LexicalBlocks.empty())
|
||||
Scope = TheCU;
|
||||
else
|
||||
@ -347,11 +347,11 @@ of scopes:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
std::vector<MDScope *> LexicalBlocks;
|
||||
std::map<const PrototypeAST *, MDScope *> FnScopeMap;
|
||||
std::vector<DIScope *> LexicalBlocks;
|
||||
std::map<const PrototypeAST *, DIScope *> FnScopeMap;
|
||||
|
||||
and keep a map of each function to the scope that it represents (an
|
||||
MDSubprogram is also an MDScope).
|
||||
DISubprogram is also an DIScope).
|
||||
|
||||
Then we make sure to:
|
||||
|
||||
@ -392,10 +392,10 @@ argument allocas in ``PrototypeAST::CreateArgumentAllocas``.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
MDScope *Scope = KSDbgInfo.LexicalBlocks.back();
|
||||
MDFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU.getFilename(),
|
||||
DIScope *Scope = KSDbgInfo.LexicalBlocks.back();
|
||||
DIFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU.getFilename(),
|
||||
KSDbgInfo.TheCU.getDirectory());
|
||||
MDLocalVariable D = DBuilder->createLocalVariable(
|
||||
DILocalVariable D = DBuilder->createLocalVariable(
|
||||
dwarf::DW_TAG_arg_variable, Scope, Args[Idx], Unit, Line,
|
||||
KSDbgInfo.getDoubleTy(), Idx);
|
||||
|
||||
|
@ -93,13 +93,13 @@ class ExprAST;
|
||||
}
|
||||
static IRBuilder<> Builder(getGlobalContext());
|
||||
struct DebugInfo {
|
||||
MDCompileUnit *TheCU;
|
||||
MDType *DblTy;
|
||||
std::vector<MDScope *> LexicalBlocks;
|
||||
std::map<const PrototypeAST *, MDScope *> FnScopeMap;
|
||||
DICompileUnit *TheCU;
|
||||
DIType *DblTy;
|
||||
std::vector<DIScope *> LexicalBlocks;
|
||||
std::map<const PrototypeAST *, DIScope *> FnScopeMap;
|
||||
|
||||
void emitLocation(ExprAST *AST);
|
||||
MDType *getDoubleTy();
|
||||
DIType *getDoubleTy();
|
||||
} KSDbgInfo;
|
||||
|
||||
static std::string IdentifierStr; // Filled in if tok_identifier
|
||||
@ -816,7 +816,7 @@ static PrototypeAST *ParseExtern() {
|
||||
|
||||
static DIBuilder *DBuilder;
|
||||
|
||||
MDType *DebugInfo::getDoubleTy() {
|
||||
DIType *DebugInfo::getDoubleTy() {
|
||||
if (DblTy)
|
||||
return DblTy;
|
||||
|
||||
@ -827,7 +827,7 @@ MDType *DebugInfo::getDoubleTy() {
|
||||
void DebugInfo::emitLocation(ExprAST *AST) {
|
||||
if (!AST)
|
||||
return Builder.SetCurrentDebugLocation(DebugLoc());
|
||||
MDScope *Scope;
|
||||
DIScope *Scope;
|
||||
if (LexicalBlocks.empty())
|
||||
Scope = TheCU;
|
||||
else
|
||||
@ -836,9 +836,9 @@ void DebugInfo::emitLocation(ExprAST *AST) {
|
||||
DebugLoc::get(AST->getLine(), AST->getCol(), Scope));
|
||||
}
|
||||
|
||||
static MDSubroutineType *CreateFunctionType(unsigned NumArgs, MDFile *Unit) {
|
||||
static DISubroutineType *CreateFunctionType(unsigned NumArgs, DIFile *Unit) {
|
||||
SmallVector<Metadata *, 8> EltTys;
|
||||
MDType *DblTy = KSDbgInfo.getDoubleTy();
|
||||
DIType *DblTy = KSDbgInfo.getDoubleTy();
|
||||
|
||||
// Add the result type.
|
||||
EltTys.push_back(DblTy);
|
||||
@ -1227,15 +1227,15 @@ Function *PrototypeAST::Codegen() {
|
||||
AI->setName(Args[Idx]);
|
||||
|
||||
// Create a subprogram DIE for this function.
|
||||
MDFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU->getFilename(),
|
||||
DIFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU->getFilename(),
|
||||
KSDbgInfo.TheCU->getDirectory());
|
||||
MDScope *FContext = Unit;
|
||||
DIScope *FContext = Unit;
|
||||
unsigned LineNo = Line;
|
||||
unsigned ScopeLine = Line;
|
||||
MDSubprogram *SP = DBuilder->createFunction(
|
||||
DISubprogram *SP = DBuilder->createFunction(
|
||||
FContext, Name, StringRef(), Unit, LineNo,
|
||||
CreateFunctionType(Args.size(), Unit), false /* internal linkage */,
|
||||
true /* definition */, ScopeLine, DebugNode::FlagPrototyped, false, F);
|
||||
true /* definition */, ScopeLine, DINode::FlagPrototyped, false, F);
|
||||
|
||||
KSDbgInfo.FnScopeMap[this] = SP;
|
||||
return F;
|
||||
@ -1250,10 +1250,10 @@ void PrototypeAST::CreateArgumentAllocas(Function *F) {
|
||||
AllocaInst *Alloca = CreateEntryBlockAlloca(F, Args[Idx]);
|
||||
|
||||
// Create a debug descriptor for the variable.
|
||||
MDScope *Scope = KSDbgInfo.LexicalBlocks.back();
|
||||
MDFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU->getFilename(),
|
||||
DIScope *Scope = KSDbgInfo.LexicalBlocks.back();
|
||||
DIFile *Unit = DBuilder->createFile(KSDbgInfo.TheCU->getFilename(),
|
||||
KSDbgInfo.TheCU->getDirectory());
|
||||
MDLocalVariable *D = DBuilder->createLocalVariable(
|
||||
DILocalVariable *D = DBuilder->createLocalVariable(
|
||||
dwarf::DW_TAG_arg_variable, Scope, Args[Idx], Unit, Line,
|
||||
KSDbgInfo.getDoubleTy(), Idx);
|
||||
|
||||
|
@ -45,7 +45,7 @@ typedef std::pair<const MachineInstr *, const MachineInstr *> InsnRange;
|
||||
class LexicalScope {
|
||||
|
||||
public:
|
||||
LexicalScope(LexicalScope *P, const MDLocalScope *D, const MDLocation *I,
|
||||
LexicalScope(LexicalScope *P, const DILocalScope *D, const DILocation *I,
|
||||
bool A)
|
||||
: Parent(P), Desc(D), InlinedAtLocation(I), AbstractScope(A),
|
||||
LastInsn(nullptr), FirstInsn(nullptr), DFSIn(0), DFSOut(0) {
|
||||
@ -58,8 +58,8 @@ public:
|
||||
// Accessors.
|
||||
LexicalScope *getParent() const { return Parent; }
|
||||
const MDNode *getDesc() const { return Desc; }
|
||||
const MDLocation *getInlinedAt() const { return InlinedAtLocation; }
|
||||
const MDLocalScope *getScopeNode() const { return Desc; }
|
||||
const DILocation *getInlinedAt() const { return InlinedAtLocation; }
|
||||
const DILocalScope *getScopeNode() const { return Desc; }
|
||||
bool isAbstractScope() const { return AbstractScope; }
|
||||
SmallVectorImpl<LexicalScope *> &getChildren() { return Children; }
|
||||
SmallVectorImpl<InsnRange> &getRanges() { return Ranges; }
|
||||
@ -119,8 +119,8 @@ public:
|
||||
|
||||
private:
|
||||
LexicalScope *Parent; // Parent to this scope.
|
||||
const MDLocalScope *Desc; // Debug info descriptor.
|
||||
const MDLocation *InlinedAtLocation; // Location at which this
|
||||
const DILocalScope *Desc; // Debug info descriptor.
|
||||
const DILocation *InlinedAtLocation; // Location at which this
|
||||
// scope is inlined.
|
||||
bool AbstractScope; // Abstract Scope
|
||||
SmallVector<LexicalScope *, 4> Children; // Scopes defined in scope.
|
||||
@ -159,16 +159,16 @@ public:
|
||||
/// getMachineBasicBlocks - Populate given set using machine basic blocks
|
||||
/// which have machine instructions that belong to lexical scope identified by
|
||||
/// DebugLoc.
|
||||
void getMachineBasicBlocks(const MDLocation *DL,
|
||||
void getMachineBasicBlocks(const DILocation *DL,
|
||||
SmallPtrSetImpl<const MachineBasicBlock *> &MBBs);
|
||||
|
||||
/// dominates - Return true if DebugLoc's lexical scope dominates at least one
|
||||
/// machine instruction's lexical scope in a given machine basic block.
|
||||
bool dominates(const MDLocation *DL, MachineBasicBlock *MBB);
|
||||
bool dominates(const DILocation *DL, MachineBasicBlock *MBB);
|
||||
|
||||
/// findLexicalScope - Find lexical scope, either regular or inlined, for the
|
||||
/// given DebugLoc. Return NULL if not found.
|
||||
LexicalScope *findLexicalScope(const MDLocation *DL);
|
||||
LexicalScope *findLexicalScope(const DILocation *DL);
|
||||
|
||||
/// getAbstractScopesList - Return a reference to list of abstract scopes.
|
||||
ArrayRef<LexicalScope *> getAbstractScopesList() const {
|
||||
@ -176,19 +176,19 @@ public:
|
||||
}
|
||||
|
||||
/// findAbstractScope - Find an abstract scope or return null.
|
||||
LexicalScope *findAbstractScope(const MDLocalScope *N) {
|
||||
LexicalScope *findAbstractScope(const DILocalScope *N) {
|
||||
auto I = AbstractScopeMap.find(N);
|
||||
return I != AbstractScopeMap.end() ? &I->second : nullptr;
|
||||
}
|
||||
|
||||
/// findInlinedScope - Find an inlined scope for the given scope/inlined-at.
|
||||
LexicalScope *findInlinedScope(const MDLocalScope *N, const MDLocation *IA) {
|
||||
LexicalScope *findInlinedScope(const DILocalScope *N, const DILocation *IA) {
|
||||
auto I = InlinedLexicalScopeMap.find(std::make_pair(N, IA));
|
||||
return I != InlinedLexicalScopeMap.end() ? &I->second : nullptr;
|
||||
}
|
||||
|
||||
/// findLexicalScope - Find regular lexical scope or return null.
|
||||
LexicalScope *findLexicalScope(const MDLocalScope *N) {
|
||||
LexicalScope *findLexicalScope(const DILocalScope *N) {
|
||||
auto I = LexicalScopeMap.find(N);
|
||||
return I != LexicalScopeMap.end() ? &I->second : nullptr;
|
||||
}
|
||||
@ -197,24 +197,24 @@ public:
|
||||
void dump();
|
||||
|
||||
/// getOrCreateAbstractScope - Find or create an abstract lexical scope.
|
||||
LexicalScope *getOrCreateAbstractScope(const MDLocalScope *Scope);
|
||||
LexicalScope *getOrCreateAbstractScope(const DILocalScope *Scope);
|
||||
|
||||
private:
|
||||
/// getOrCreateLexicalScope - Find lexical scope for the given Scope/IA. If
|
||||
/// not available then create new lexical scope.
|
||||
LexicalScope *getOrCreateLexicalScope(const MDLocalScope *Scope,
|
||||
const MDLocation *IA = nullptr);
|
||||
LexicalScope *getOrCreateLexicalScope(const MDLocation *DL) {
|
||||
LexicalScope *getOrCreateLexicalScope(const DILocalScope *Scope,
|
||||
const DILocation *IA = nullptr);
|
||||
LexicalScope *getOrCreateLexicalScope(const DILocation *DL) {
|
||||
return DL ? getOrCreateLexicalScope(DL->getScope(), DL->getInlinedAt())
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
/// getOrCreateRegularScope - Find or create a regular lexical scope.
|
||||
LexicalScope *getOrCreateRegularScope(const MDLocalScope *Scope);
|
||||
LexicalScope *getOrCreateRegularScope(const DILocalScope *Scope);
|
||||
|
||||
/// getOrCreateInlinedScope - Find or create an inlined lexical scope.
|
||||
LexicalScope *getOrCreateInlinedScope(const MDLocalScope *Scope,
|
||||
const MDLocation *InlinedAt);
|
||||
LexicalScope *getOrCreateInlinedScope(const DILocalScope *Scope,
|
||||
const DILocation *InlinedAt);
|
||||
|
||||
/// extractLexicalScopes - Extract instruction ranges for each lexical scopes
|
||||
/// for the given machine function.
|
||||
@ -230,18 +230,18 @@ private:
|
||||
|
||||
/// LexicalScopeMap - Tracks the scopes in the current function.
|
||||
// Use an unordered_map to ensure value pointer validity over insertion.
|
||||
std::unordered_map<const MDLocalScope *, LexicalScope> LexicalScopeMap;
|
||||
std::unordered_map<const DILocalScope *, LexicalScope> LexicalScopeMap;
|
||||
|
||||
/// InlinedLexicalScopeMap - Tracks inlined function scopes in current
|
||||
/// function.
|
||||
std::unordered_map<std::pair<const MDLocalScope *, const MDLocation *>,
|
||||
std::unordered_map<std::pair<const DILocalScope *, const DILocation *>,
|
||||
LexicalScope,
|
||||
pair_hash<const MDLocalScope *, const MDLocation *>>
|
||||
pair_hash<const DILocalScope *, const DILocation *>>
|
||||
InlinedLexicalScopeMap;
|
||||
|
||||
/// AbstractScopeMap - These scopes are not included LexicalScopeMap.
|
||||
// Use an unordered_map to ensure value pointer validity over insertion.
|
||||
std::unordered_map<const MDLocalScope *, LexicalScope> AbstractScopeMap;
|
||||
std::unordered_map<const DILocalScope *, LexicalScope> AbstractScopeMap;
|
||||
|
||||
/// AbstractScopesList - Tracks abstract scopes constructed while processing
|
||||
/// a function.
|
||||
|
@ -246,16 +246,16 @@ public:
|
||||
|
||||
/// \brief Return the debug variable referenced by
|
||||
/// this DBG_VALUE instruction.
|
||||
const MDLocalVariable *getDebugVariable() const {
|
||||
const DILocalVariable *getDebugVariable() const {
|
||||
assert(isDebugValue() && "not a DBG_VALUE");
|
||||
return cast<MDLocalVariable>(getOperand(2).getMetadata());
|
||||
return cast<DILocalVariable>(getOperand(2).getMetadata());
|
||||
}
|
||||
|
||||
/// \brief Return the complex address expression referenced by
|
||||
/// this DBG_VALUE instruction.
|
||||
const MDExpression *getDebugExpression() const {
|
||||
const DIExpression *getDebugExpression() const {
|
||||
assert(isDebugValue() && "not a DBG_VALUE");
|
||||
return cast<MDExpression>(getOperand(3).getMetadata());
|
||||
return cast<DIExpression>(getOperand(3).getMetadata());
|
||||
}
|
||||
|
||||
/// emitError - Emit an error referring to the source location of this
|
||||
|
@ -356,9 +356,9 @@ inline MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL,
|
||||
const MCInstrDesc &MCID, bool IsIndirect,
|
||||
unsigned Reg, unsigned Offset,
|
||||
const MDNode *Variable, const MDNode *Expr) {
|
||||
assert(isa<MDLocalVariable>(Variable) && "not a variable");
|
||||
assert(cast<MDExpression>(Expr)->isValid() && "not an expression");
|
||||
assert(cast<MDLocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
|
||||
assert(isa<DILocalVariable>(Variable) && "not a variable");
|
||||
assert(cast<DIExpression>(Expr)->isValid() && "not an expression");
|
||||
assert(cast<DILocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
if (IsIndirect)
|
||||
return BuildMI(MF, DL, MCID)
|
||||
@ -385,8 +385,8 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB,
|
||||
const MCInstrDesc &MCID, bool IsIndirect,
|
||||
unsigned Reg, unsigned Offset,
|
||||
const MDNode *Variable, const MDNode *Expr) {
|
||||
assert(isa<MDLocalVariable>(Variable) && "not a variable");
|
||||
assert(cast<MDExpression>(Expr)->isValid() && "not an expression");
|
||||
assert(isa<DILocalVariable>(Variable) && "not a variable");
|
||||
assert(cast<DIExpression>(Expr)->isValid() && "not an expression");
|
||||
MachineFunction &MF = *BB.getParent();
|
||||
MachineInstr *MI =
|
||||
BuildMI(MF, DL, MCID, IsIndirect, Reg, Offset, Variable, Expr);
|
||||
|
@ -193,13 +193,13 @@ public:
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
|
||||
struct VariableDbgInfo {
|
||||
const MDLocalVariable *Var;
|
||||
const MDExpression *Expr;
|
||||
const DILocalVariable *Var;
|
||||
const DIExpression *Expr;
|
||||
unsigned Slot;
|
||||
const MDLocation *Loc;
|
||||
const DILocation *Loc;
|
||||
|
||||
VariableDbgInfo(const MDLocalVariable *Var, const MDExpression *Expr,
|
||||
unsigned Slot, const MDLocation *Loc)
|
||||
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
|
||||
unsigned Slot, const DILocation *Loc)
|
||||
: Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
|
||||
};
|
||||
typedef SmallVector<VariableDbgInfo, 4> VariableDbgInfoMapTy;
|
||||
@ -448,8 +448,8 @@ public:
|
||||
|
||||
/// setVariableDbgInfo - Collect information used to emit debugging
|
||||
/// information of a variable.
|
||||
void setVariableDbgInfo(const MDLocalVariable *Var, const MDExpression *Expr,
|
||||
unsigned Slot, const MDLocation *Loc) {
|
||||
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
|
||||
unsigned Slot, const DILocation *Loc) {
|
||||
VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc);
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ namespace llvm {
|
||||
/// source location information in the back end
|
||||
/// without actually changing the output (e.g.,
|
||||
/// when using optimization remarks).
|
||||
MDCompileUnit *createCompileUnit(unsigned Lang, StringRef File,
|
||||
DICompileUnit *createCompileUnit(unsigned Lang, StringRef File,
|
||||
StringRef Dir, StringRef Producer,
|
||||
bool isOptimized, StringRef Flags,
|
||||
unsigned RV, StringRef SplitName = "",
|
||||
@ -113,16 +113,16 @@ namespace llvm {
|
||||
|
||||
/// createFile - Create a file descriptor to hold debugging information
|
||||
/// for a file.
|
||||
MDFile *createFile(StringRef Filename, StringRef Directory);
|
||||
DIFile *createFile(StringRef Filename, StringRef Directory);
|
||||
|
||||
/// createEnumerator - Create a single enumerator value.
|
||||
MDEnumerator *createEnumerator(StringRef Name, int64_t Val);
|
||||
DIEnumerator *createEnumerator(StringRef Name, int64_t Val);
|
||||
|
||||
/// \brief Create a DWARF unspecified type.
|
||||
MDBasicType *createUnspecifiedType(StringRef Name);
|
||||
DIBasicType *createUnspecifiedType(StringRef Name);
|
||||
|
||||
/// \brief Create C++11 nullptr type.
|
||||
MDBasicType *createNullPtrType();
|
||||
DIBasicType *createNullPtrType();
|
||||
|
||||
/// createBasicType - Create debugging information entry for a basic
|
||||
/// type.
|
||||
@ -130,21 +130,21 @@ namespace llvm {
|
||||
/// @param SizeInBits Size of the type.
|
||||
/// @param AlignInBits Type alignment.
|
||||
/// @param Encoding DWARF encoding code, e.g. dwarf::DW_ATE_float.
|
||||
MDBasicType *createBasicType(StringRef Name, uint64_t SizeInBits,
|
||||
DIBasicType *createBasicType(StringRef Name, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, unsigned Encoding);
|
||||
|
||||
/// createQualifiedType - Create debugging information entry for a qualified
|
||||
/// type, e.g. 'const int'.
|
||||
/// @param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
|
||||
/// @param FromTy Base Type.
|
||||
MDDerivedType *createQualifiedType(unsigned Tag, MDType *FromTy);
|
||||
DIDerivedType *createQualifiedType(unsigned Tag, DIType *FromTy);
|
||||
|
||||
/// createPointerType - Create debugging information entry for a pointer.
|
||||
/// @param PointeeTy Type pointed by this pointer.
|
||||
/// @param SizeInBits Size.
|
||||
/// @param AlignInBits Alignment. (optional)
|
||||
/// @param Name Pointer type name. (optional)
|
||||
MDDerivedType *createPointerType(MDType *PointeeTy, uint64_t SizeInBits,
|
||||
DIDerivedType *createPointerType(DIType *PointeeTy, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits = 0,
|
||||
StringRef Name = "");
|
||||
|
||||
@ -153,13 +153,13 @@ namespace llvm {
|
||||
/// @param SizeInBits Size.
|
||||
/// @param AlignInBits Alignment. (optional)
|
||||
/// @param Class Type for which this pointer points to members of.
|
||||
MDDerivedType *createMemberPointerType(MDType *PointeeTy, MDType *Class,
|
||||
DIDerivedType *createMemberPointerType(DIType *PointeeTy, DIType *Class,
|
||||
uint64_t SizeInBits,
|
||||
uint64_t AlignInBits = 0);
|
||||
|
||||
/// createReferenceType - Create debugging information entry for a c++
|
||||
/// style reference or rvalue reference type.
|
||||
MDDerivedType *createReferenceType(unsigned Tag, MDType *RTy);
|
||||
DIDerivedType *createReferenceType(unsigned Tag, DIType *RTy);
|
||||
|
||||
/// createTypedef - Create debugging information entry for a typedef.
|
||||
/// @param Ty Original type.
|
||||
@ -167,11 +167,11 @@ namespace llvm {
|
||||
/// @param File File where this type is defined.
|
||||
/// @param LineNo Line number.
|
||||
/// @param Context The surrounding context for the typedef.
|
||||
MDDerivedType *createTypedef(MDType *Ty, StringRef Name, MDFile *File,
|
||||
unsigned LineNo, MDScope *Context);
|
||||
DIDerivedType *createTypedef(DIType *Ty, StringRef Name, DIFile *File,
|
||||
unsigned LineNo, DIScope *Context);
|
||||
|
||||
/// createFriend - Create debugging information entry for a 'friend'.
|
||||
MDDerivedType *createFriend(MDType *Ty, MDType *FriendTy);
|
||||
DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
|
||||
|
||||
/// createInheritance - Create debugging information entry to establish
|
||||
/// inheritance relationship between two types.
|
||||
@ -180,7 +180,7 @@ namespace llvm {
|
||||
/// @param BaseOffset Base offset.
|
||||
/// @param Flags Flags to describe inheritance attribute,
|
||||
/// e.g. private
|
||||
MDDerivedType *createInheritance(MDType *Ty, MDType *BaseTy,
|
||||
DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
|
||||
uint64_t BaseOffset, unsigned Flags);
|
||||
|
||||
/// createMemberType - Create debugging information entry for a member.
|
||||
@ -193,11 +193,11 @@ namespace llvm {
|
||||
/// @param OffsetInBits Member offset.
|
||||
/// @param Flags Flags to encode member attribute, e.g. private
|
||||
/// @param Ty Parent type.
|
||||
MDDerivedType *createMemberType(MDScope *Scope, StringRef Name,
|
||||
MDFile *File, unsigned LineNo,
|
||||
DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNo,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
MDType *Ty);
|
||||
DIType *Ty);
|
||||
|
||||
/// createStaticMemberType - Create debugging information entry for a
|
||||
/// C++ static data member.
|
||||
@ -208,9 +208,9 @@ namespace llvm {
|
||||
/// @param Ty Type of the static member.
|
||||
/// @param Flags Flags to encode member attribute, e.g. private.
|
||||
/// @param Val Const initializer of the member.
|
||||
MDDerivedType *createStaticMemberType(MDScope *Scope, StringRef Name,
|
||||
MDFile *File, unsigned LineNo,
|
||||
MDType *Ty, unsigned Flags,
|
||||
DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNo,
|
||||
DIType *Ty, unsigned Flags,
|
||||
llvm::Constant *Val);
|
||||
|
||||
/// createObjCIVar - Create debugging information entry for Objective-C
|
||||
@ -224,10 +224,10 @@ namespace llvm {
|
||||
/// @param Flags Flags to encode member attribute, e.g. private
|
||||
/// @param Ty Parent type.
|
||||
/// @param PropertyNode Property associated with this ivar.
|
||||
MDDerivedType *createObjCIVar(StringRef Name, MDFile *File, unsigned LineNo,
|
||||
DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
MDType *Ty, MDNode *PropertyNode);
|
||||
DIType *Ty, MDNode *PropertyNode);
|
||||
|
||||
/// createObjCProperty - Create debugging information entry for Objective-C
|
||||
/// property.
|
||||
@ -238,11 +238,11 @@ namespace llvm {
|
||||
/// @param SetterName Name of the Objective C property setter selector.
|
||||
/// @param PropertyAttributes Objective C property attributes.
|
||||
/// @param Ty Type.
|
||||
MDObjCProperty *createObjCProperty(StringRef Name, MDFile *File,
|
||||
DIObjCProperty *createObjCProperty(StringRef Name, DIFile *File,
|
||||
unsigned LineNumber,
|
||||
StringRef GetterName,
|
||||
StringRef SetterName,
|
||||
unsigned PropertyAttributes, MDType *Ty);
|
||||
unsigned PropertyAttributes, DIType *Ty);
|
||||
|
||||
/// createClassType - Create debugging information entry for a class.
|
||||
/// @param Scope Scope in which this class is defined.
|
||||
@ -260,12 +260,14 @@ namespace llvm {
|
||||
/// for more info.
|
||||
/// @param TemplateParms Template type parameters.
|
||||
/// @param UniqueIdentifier A unique identifier for the class.
|
||||
MDCompositeType *createClassType(
|
||||
MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
unsigned Flags, MDType *DerivedFrom, DebugNodeArray Elements,
|
||||
MDType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr,
|
||||
StringRef UniqueIdentifier = "");
|
||||
DICompositeType *createClassType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
DIType *DerivedFrom, DINodeArray Elements,
|
||||
DIType *VTableHolder = nullptr,
|
||||
MDNode *TemplateParms = nullptr,
|
||||
StringRef UniqueIdentifier = "");
|
||||
|
||||
/// createStructType - Create debugging information entry for a struct.
|
||||
/// @param Scope Scope in which this struct is defined.
|
||||
@ -278,11 +280,11 @@ namespace llvm {
|
||||
/// @param Elements Struct elements.
|
||||
/// @param RunTimeLang Optional parameter, Objective-C runtime version.
|
||||
/// @param UniqueIdentifier A unique identifier for the struct.
|
||||
MDCompositeType *createStructType(
|
||||
MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
|
||||
DICompositeType *createStructType(
|
||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
|
||||
MDType *DerivedFrom, DebugNodeArray Elements, unsigned RunTimeLang = 0,
|
||||
MDType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
|
||||
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
|
||||
DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
|
||||
|
||||
/// createUnionType - Create debugging information entry for an union.
|
||||
/// @param Scope Scope in which this union is defined.
|
||||
@ -295,10 +297,10 @@ namespace llvm {
|
||||
/// @param Elements Union elements.
|
||||
/// @param RunTimeLang Optional parameter, Objective-C runtime version.
|
||||
/// @param UniqueIdentifier A unique identifier for the union.
|
||||
MDCompositeType *createUnionType(MDScope *Scope, StringRef Name,
|
||||
MDFile *File, unsigned LineNumber,
|
||||
DICompositeType *createUnionType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
unsigned Flags, DebugNodeArray Elements,
|
||||
unsigned Flags, DINodeArray Elements,
|
||||
unsigned RunTimeLang = 0,
|
||||
StringRef UniqueIdentifier = "");
|
||||
|
||||
@ -307,8 +309,8 @@ namespace llvm {
|
||||
/// @param Scope Scope in which this type is defined.
|
||||
/// @param Name Type parameter name.
|
||||
/// @param Ty Parameter type.
|
||||
MDTemplateTypeParameter *
|
||||
createTemplateTypeParameter(MDScope *Scope, StringRef Name, MDType *Ty);
|
||||
DITemplateTypeParameter *
|
||||
createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty);
|
||||
|
||||
/// createTemplateValueParameter - Create debugging information for template
|
||||
/// value parameter.
|
||||
@ -316,9 +318,9 @@ namespace llvm {
|
||||
/// @param Name Value parameter name.
|
||||
/// @param Ty Parameter type.
|
||||
/// @param Val Constant parameter value.
|
||||
MDTemplateValueParameter *createTemplateValueParameter(MDScope *Scope,
|
||||
DITemplateValueParameter *createTemplateValueParameter(DIScope *Scope,
|
||||
StringRef Name,
|
||||
MDType *Ty,
|
||||
DIType *Ty,
|
||||
Constant *Val);
|
||||
|
||||
/// \brief Create debugging information for a template template parameter.
|
||||
@ -326,9 +328,9 @@ namespace llvm {
|
||||
/// @param Name Value parameter name.
|
||||
/// @param Ty Parameter type.
|
||||
/// @param Val The fully qualified name of the template.
|
||||
MDTemplateValueParameter *createTemplateTemplateParameter(MDScope *Scope,
|
||||
DITemplateValueParameter *createTemplateTemplateParameter(DIScope *Scope,
|
||||
StringRef Name,
|
||||
MDType *Ty,
|
||||
DIType *Ty,
|
||||
StringRef Val);
|
||||
|
||||
/// \brief Create debugging information for a template parameter pack.
|
||||
@ -336,26 +338,26 @@ namespace llvm {
|
||||
/// @param Name Value parameter name.
|
||||
/// @param Ty Parameter type.
|
||||
/// @param Val An array of types in the pack.
|
||||
MDTemplateValueParameter *createTemplateParameterPack(MDScope *Scope,
|
||||
DITemplateValueParameter *createTemplateParameterPack(DIScope *Scope,
|
||||
StringRef Name,
|
||||
MDType *Ty,
|
||||
DebugNodeArray Val);
|
||||
DIType *Ty,
|
||||
DINodeArray Val);
|
||||
|
||||
/// createArrayType - Create debugging information entry for an array.
|
||||
/// @param Size Array size.
|
||||
/// @param AlignInBits Alignment.
|
||||
/// @param Ty Element type.
|
||||
/// @param Subscripts Subscripts.
|
||||
MDCompositeType *createArrayType(uint64_t Size, uint64_t AlignInBits,
|
||||
MDType *Ty, DebugNodeArray Subscripts);
|
||||
DICompositeType *createArrayType(uint64_t Size, uint64_t AlignInBits,
|
||||
DIType *Ty, DINodeArray Subscripts);
|
||||
|
||||
/// createVectorType - Create debugging information entry for a vector type.
|
||||
/// @param Size Array size.
|
||||
/// @param AlignInBits Alignment.
|
||||
/// @param Ty Element type.
|
||||
/// @param Subscripts Subscripts.
|
||||
MDCompositeType *createVectorType(uint64_t Size, uint64_t AlignInBits,
|
||||
MDType *Ty, DebugNodeArray Subscripts);
|
||||
DICompositeType *createVectorType(uint64_t Size, uint64_t AlignInBits,
|
||||
DIType *Ty, DINodeArray Subscripts);
|
||||
|
||||
/// createEnumerationType - Create debugging information entry for an
|
||||
/// enumeration.
|
||||
@ -368,10 +370,10 @@ namespace llvm {
|
||||
/// @param Elements Enumeration elements.
|
||||
/// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
|
||||
/// @param UniqueIdentifier A unique identifier for the enum.
|
||||
MDCompositeType *createEnumerationType(
|
||||
MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, DebugNodeArray Elements,
|
||||
MDType *UnderlyingType, StringRef UniqueIdentifier = "");
|
||||
DICompositeType *createEnumerationType(
|
||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, DINodeArray Elements,
|
||||
DIType *UnderlyingType, StringRef UniqueIdentifier = "");
|
||||
|
||||
/// createSubroutineType - Create subroutine type.
|
||||
/// @param File File in which this subroutine is defined.
|
||||
@ -379,49 +381,49 @@ namespace llvm {
|
||||
/// includes return type at 0th index.
|
||||
/// @param Flags E.g.: LValueReference.
|
||||
/// These flags are used to emit dwarf attributes.
|
||||
MDSubroutineType *createSubroutineType(MDFile *File,
|
||||
MDTypeRefArray ParameterTypes,
|
||||
DISubroutineType *createSubroutineType(DIFile *File,
|
||||
DITypeRefArray ParameterTypes,
|
||||
unsigned Flags = 0);
|
||||
|
||||
/// createArtificialType - Create a new MDType* with "artificial" flag set.
|
||||
MDType *createArtificialType(MDType *Ty);
|
||||
/// createArtificialType - Create a new DIType* with "artificial" flag set.
|
||||
DIType *createArtificialType(DIType *Ty);
|
||||
|
||||
/// createObjectPointerType - Create a new MDType* with the "object pointer"
|
||||
/// createObjectPointerType - Create a new DIType* with the "object pointer"
|
||||
/// flag set.
|
||||
MDType *createObjectPointerType(MDType *Ty);
|
||||
DIType *createObjectPointerType(DIType *Ty);
|
||||
|
||||
/// \brief Create a permanent forward-declared type.
|
||||
MDCompositeType *createForwardDecl(unsigned Tag, StringRef Name,
|
||||
MDScope *Scope, MDFile *F, unsigned Line,
|
||||
DICompositeType *createForwardDecl(unsigned Tag, StringRef Name,
|
||||
DIScope *Scope, DIFile *F, unsigned Line,
|
||||
unsigned RuntimeLang = 0,
|
||||
uint64_t SizeInBits = 0,
|
||||
uint64_t AlignInBits = 0,
|
||||
StringRef UniqueIdentifier = "");
|
||||
|
||||
/// \brief Create a temporary forward-declared type.
|
||||
MDCompositeType *createReplaceableCompositeType(
|
||||
unsigned Tag, StringRef Name, MDScope *Scope, MDFile *F, unsigned Line,
|
||||
DICompositeType *createReplaceableCompositeType(
|
||||
unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
|
||||
unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
|
||||
uint64_t AlignInBits = 0, unsigned Flags = DebugNode::FlagFwdDecl,
|
||||
uint64_t AlignInBits = 0, unsigned Flags = DINode::FlagFwdDecl,
|
||||
StringRef UniqueIdentifier = "");
|
||||
|
||||
/// retainType - Retain MDType* in a module even if it is not referenced
|
||||
/// retainType - Retain DIType* in a module even if it is not referenced
|
||||
/// through debug info anchors.
|
||||
void retainType(MDType *T);
|
||||
void retainType(DIType *T);
|
||||
|
||||
/// createUnspecifiedParameter - Create unspecified parameter type
|
||||
/// for a subroutine type.
|
||||
MDBasicType *createUnspecifiedParameter();
|
||||
DIBasicType *createUnspecifiedParameter();
|
||||
|
||||
/// getOrCreateArray - Get a DebugNodeArray, create one if required.
|
||||
DebugNodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
|
||||
/// getOrCreateArray - Get a DINodeArray, create one if required.
|
||||
DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
|
||||
|
||||
/// getOrCreateTypeArray - Get a MDTypeRefArray, create one if required.
|
||||
MDTypeRefArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
|
||||
/// getOrCreateTypeArray - Get a DITypeRefArray, create one if required.
|
||||
DITypeRefArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
|
||||
|
||||
/// getOrCreateSubrange - Create a descriptor for a value range. This
|
||||
/// implicitly uniques the values returned.
|
||||
MDSubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
|
||||
DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
|
||||
|
||||
/// createGlobalVariable - Create a new descriptor for the specified
|
||||
/// variable.
|
||||
@ -435,18 +437,18 @@ namespace llvm {
|
||||
/// externally visible or not.
|
||||
/// @param Val llvm::Value of the variable.
|
||||
/// @param Decl Reference to the corresponding declaration.
|
||||
MDGlobalVariable *createGlobalVariable(MDScope *Context, StringRef Name,
|
||||
StringRef LinkageName, MDFile *File,
|
||||
unsigned LineNo, MDType *Ty,
|
||||
DIGlobalVariable *createGlobalVariable(DIScope *Context, StringRef Name,
|
||||
StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DIType *Ty,
|
||||
bool isLocalToUnit,
|
||||
llvm::Constant *Val,
|
||||
MDNode *Decl = nullptr);
|
||||
|
||||
/// createTempGlobalVariableFwdDecl - Identical to createGlobalVariable
|
||||
/// except that the resulting DbgNode is temporary and meant to be RAUWed.
|
||||
MDGlobalVariable *createTempGlobalVariableFwdDecl(
|
||||
MDScope *Context, StringRef Name, StringRef LinkageName, MDFile *File,
|
||||
unsigned LineNo, MDType *Ty, bool isLocalToUnit, llvm::Constant *Val,
|
||||
DIGlobalVariable *createTempGlobalVariableFwdDecl(
|
||||
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DIType *Ty, bool isLocalToUnit, llvm::Constant *Val,
|
||||
MDNode *Decl = nullptr);
|
||||
|
||||
/// createLocalVariable - Create a new descriptor for the specified
|
||||
@ -463,9 +465,9 @@ namespace llvm {
|
||||
/// @param Flags Flags, e.g. artificial variable.
|
||||
/// @param ArgNo If this variable is an argument then this argument's
|
||||
/// number. 1 indicates 1st argument.
|
||||
MDLocalVariable *createLocalVariable(unsigned Tag, MDScope *Scope,
|
||||
StringRef Name, MDFile *File,
|
||||
unsigned LineNo, MDType *Ty,
|
||||
DILocalVariable *createLocalVariable(unsigned Tag, DIScope *Scope,
|
||||
StringRef Name, DIFile *File,
|
||||
unsigned LineNo, DIType *Ty,
|
||||
bool AlwaysPreserve = false,
|
||||
unsigned Flags = 0,
|
||||
unsigned ArgNo = 0);
|
||||
@ -473,19 +475,19 @@ namespace llvm {
|
||||
/// createExpression - Create a new descriptor for the specified
|
||||
/// variable which has a complex address expression for its address.
|
||||
/// @param Addr An array of complex address operations.
|
||||
MDExpression *createExpression(ArrayRef<uint64_t> Addr = None);
|
||||
MDExpression *createExpression(ArrayRef<int64_t> Addr);
|
||||
DIExpression *createExpression(ArrayRef<uint64_t> Addr = None);
|
||||
DIExpression *createExpression(ArrayRef<int64_t> Addr);
|
||||
|
||||
/// createBitPieceExpression - Create a descriptor to describe one part
|
||||
/// of aggregate variable that is fragmented across multiple Values.
|
||||
///
|
||||
/// @param OffsetInBits Offset of the piece in bits.
|
||||
/// @param SizeInBits Size of the piece in bits.
|
||||
MDExpression *createBitPieceExpression(unsigned OffsetInBits,
|
||||
DIExpression *createBitPieceExpression(unsigned OffsetInBits,
|
||||
unsigned SizeInBits);
|
||||
|
||||
/// createFunction - Create a new descriptor for the specified subprogram.
|
||||
/// See comments in MDSubprogram* for descriptions of these fields.
|
||||
/// See comments in DISubprogram* for descriptions of these fields.
|
||||
/// @param Scope Function scope.
|
||||
/// @param Name Function name.
|
||||
/// @param LinkageName Mangled function name.
|
||||
@ -500,9 +502,9 @@ namespace llvm {
|
||||
/// @param isOptimized True if optimization is ON.
|
||||
/// @param Fn llvm::Function pointer.
|
||||
/// @param TParam Function template parameters.
|
||||
MDSubprogram *
|
||||
createFunction(MDScope *Scope, StringRef Name, StringRef LinkageName,
|
||||
MDFile *File, unsigned LineNo, MDSubroutineType *Ty,
|
||||
DISubprogram *
|
||||
createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName,
|
||||
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
|
||||
bool isLocalToUnit, bool isDefinition, unsigned ScopeLine,
|
||||
unsigned Flags = 0, bool isOptimized = false,
|
||||
Function *Fn = nullptr, MDNode *TParam = nullptr,
|
||||
@ -510,25 +512,25 @@ namespace llvm {
|
||||
|
||||
/// createTempFunctionFwdDecl - Identical to createFunction,
|
||||
/// except that the resulting DbgNode is meant to be RAUWed.
|
||||
MDSubprogram *createTempFunctionFwdDecl(
|
||||
MDScope *Scope, StringRef Name, StringRef LinkageName, MDFile *File,
|
||||
unsigned LineNo, MDSubroutineType *Ty, bool isLocalToUnit,
|
||||
DISubprogram *createTempFunctionFwdDecl(
|
||||
DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
||||
bool isDefinition, unsigned ScopeLine, unsigned Flags = 0,
|
||||
bool isOptimized = false, Function *Fn = nullptr,
|
||||
MDNode *TParam = nullptr, MDNode *Decl = nullptr);
|
||||
|
||||
/// FIXME: this is added for dragonegg. Once we update dragonegg
|
||||
/// to call resolve function, this will be removed.
|
||||
MDSubprogram *
|
||||
createFunction(MDScopeRef Scope, StringRef Name, StringRef LinkageName,
|
||||
MDFile *File, unsigned LineNo, MDSubroutineType *Ty,
|
||||
DISubprogram *
|
||||
createFunction(DIScopeRef Scope, StringRef Name, StringRef LinkageName,
|
||||
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
|
||||
bool isLocalToUnit, bool isDefinition, unsigned ScopeLine,
|
||||
unsigned Flags = 0, bool isOptimized = false,
|
||||
Function *Fn = nullptr, MDNode *TParam = nullptr,
|
||||
MDNode *Decl = nullptr);
|
||||
|
||||
/// createMethod - Create a new descriptor for the specified C++ method.
|
||||
/// See comments in MDSubprogram* for descriptions of these fields.
|
||||
/// See comments in DISubprogram* for descriptions of these fields.
|
||||
/// @param Scope Function scope.
|
||||
/// @param Name Function name.
|
||||
/// @param LinkageName Mangled function name.
|
||||
@ -546,11 +548,11 @@ namespace llvm {
|
||||
/// @param isOptimized True if optimization is ON.
|
||||
/// @param Fn llvm::Function pointer.
|
||||
/// @param TParam Function template parameters.
|
||||
MDSubprogram *
|
||||
createMethod(MDScope *Scope, StringRef Name, StringRef LinkageName,
|
||||
MDFile *File, unsigned LineNo, MDSubroutineType *Ty,
|
||||
DISubprogram *
|
||||
createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName,
|
||||
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
|
||||
bool isLocalToUnit, bool isDefinition, unsigned Virtuality = 0,
|
||||
unsigned VTableIndex = 0, MDType *VTableHolder = nullptr,
|
||||
unsigned VTableIndex = 0, DIType *VTableHolder = nullptr,
|
||||
unsigned Flags = 0, bool isOptimized = false,
|
||||
Function *Fn = nullptr, MDNode *TParam = nullptr);
|
||||
|
||||
@ -560,7 +562,7 @@ namespace llvm {
|
||||
/// @param Name Name of this namespace
|
||||
/// @param File Source file
|
||||
/// @param LineNo Line number
|
||||
MDNamespace *createNameSpace(MDScope *Scope, StringRef Name, MDFile *File,
|
||||
DINamespace *createNameSpace(DIScope *Scope, StringRef Name, DIFile *File,
|
||||
unsigned LineNo);
|
||||
|
||||
/// createLexicalBlockFile - This creates a descriptor for a lexical
|
||||
@ -569,7 +571,7 @@ namespace llvm {
|
||||
/// @param Scope Lexical block.
|
||||
/// @param File Source file.
|
||||
/// @param Discriminator DWARF path discriminator value.
|
||||
MDLexicalBlockFile *createLexicalBlockFile(MDScope *Scope, MDFile *File,
|
||||
DILexicalBlockFile *createLexicalBlockFile(DIScope *Scope, DIFile *File,
|
||||
unsigned Discriminator = 0);
|
||||
|
||||
/// createLexicalBlock - This creates a descriptor for a lexical block
|
||||
@ -578,30 +580,30 @@ namespace llvm {
|
||||
/// @param File Source file.
|
||||
/// @param Line Line number.
|
||||
/// @param Col Column number.
|
||||
MDLexicalBlock *createLexicalBlock(MDScope *Scope, MDFile *File,
|
||||
DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
|
||||
unsigned Line, unsigned Col);
|
||||
|
||||
/// \brief Create a descriptor for an imported module.
|
||||
/// @param Context The scope this module is imported into
|
||||
/// @param NS The namespace being imported here
|
||||
/// @param Line Line number
|
||||
MDImportedEntity *createImportedModule(MDScope *Context, MDNamespace *NS,
|
||||
DIImportedEntity *createImportedModule(DIScope *Context, DINamespace *NS,
|
||||
unsigned Line);
|
||||
|
||||
/// \brief Create a descriptor for an imported module.
|
||||
/// @param Context The scope this module is imported into
|
||||
/// @param NS An aliased namespace
|
||||
/// @param Line Line number
|
||||
MDImportedEntity *createImportedModule(MDScope *Context,
|
||||
MDImportedEntity *NS, unsigned Line);
|
||||
DIImportedEntity *createImportedModule(DIScope *Context,
|
||||
DIImportedEntity *NS, unsigned Line);
|
||||
|
||||
/// \brief Create a descriptor for an imported function.
|
||||
/// @param Context The scope this module is imported into
|
||||
/// @param Decl The declaration (or definition) of a function, type, or
|
||||
/// variable
|
||||
/// @param Line Line number
|
||||
MDImportedEntity *createImportedDeclaration(MDScope *Context,
|
||||
DebugNode *Decl, unsigned Line,
|
||||
DIImportedEntity *createImportedDeclaration(DIScope *Context, DINode *Decl,
|
||||
unsigned Line,
|
||||
StringRef Name = "");
|
||||
|
||||
/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
|
||||
@ -610,8 +612,8 @@ namespace llvm {
|
||||
/// @param Expr A complex location expression.
|
||||
/// @param DL Debug info location.
|
||||
/// @param InsertAtEnd Location for the new intrinsic.
|
||||
Instruction *insertDeclare(llvm::Value *Storage, MDLocalVariable *VarInfo,
|
||||
MDExpression *Expr, const MDLocation *DL,
|
||||
Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
|
||||
DIExpression *Expr, const DILocation *DL,
|
||||
BasicBlock *InsertAtEnd);
|
||||
|
||||
/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
|
||||
@ -620,8 +622,8 @@ namespace llvm {
|
||||
/// @param Expr A complex location expression.
|
||||
/// @param DL Debug info location.
|
||||
/// @param InsertBefore Location for the new intrinsic.
|
||||
Instruction *insertDeclare(llvm::Value *Storage, MDLocalVariable *VarInfo,
|
||||
MDExpression *Expr, const MDLocation *DL,
|
||||
Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
|
||||
DIExpression *Expr, const DILocation *DL,
|
||||
Instruction *InsertBefore);
|
||||
|
||||
/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
|
||||
@ -632,9 +634,9 @@ namespace llvm {
|
||||
/// @param DL Debug info location.
|
||||
/// @param InsertAtEnd Location for the new intrinsic.
|
||||
Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
|
||||
MDLocalVariable *VarInfo,
|
||||
MDExpression *Expr,
|
||||
const MDLocation *DL,
|
||||
DILocalVariable *VarInfo,
|
||||
DIExpression *Expr,
|
||||
const DILocation *DL,
|
||||
BasicBlock *InsertAtEnd);
|
||||
|
||||
/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
|
||||
@ -645,25 +647,25 @@ namespace llvm {
|
||||
/// @param DL Debug info location.
|
||||
/// @param InsertBefore Location for the new intrinsic.
|
||||
Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
|
||||
MDLocalVariable *VarInfo,
|
||||
MDExpression *Expr,
|
||||
const MDLocation *DL,
|
||||
DILocalVariable *VarInfo,
|
||||
DIExpression *Expr,
|
||||
const DILocation *DL,
|
||||
Instruction *InsertBefore);
|
||||
|
||||
/// \brief Replace the vtable holder in the given composite type.
|
||||
///
|
||||
/// If this creates a self reference, it may orphan some unresolved cycles
|
||||
/// in the operands of \c T, so \a DIBuilder needs to track that.
|
||||
void replaceVTableHolder(MDCompositeType *&T,
|
||||
MDCompositeType *VTableHolder);
|
||||
void replaceVTableHolder(DICompositeType *&T,
|
||||
DICompositeType *VTableHolder);
|
||||
|
||||
/// \brief Replace arrays on a composite type.
|
||||
///
|
||||
/// If \c T is resolved, but the arrays aren't -- which can happen if \c T
|
||||
/// has a self-reference -- \a DIBuilder needs to track the array to
|
||||
/// resolve cycles.
|
||||
void replaceArrays(MDCompositeType *&T, DebugNodeArray Elements,
|
||||
DebugNodeArray TParems = DebugNodeArray());
|
||||
void replaceArrays(DICompositeType *&T, DINodeArray Elements,
|
||||
DINodeArray TParems = DINodeArray());
|
||||
|
||||
/// \brief Replace a temporary node.
|
||||
///
|
||||
|
@ -34,18 +34,18 @@ class DbgDeclareInst;
|
||||
class DbgValueInst;
|
||||
|
||||
/// \brief Maps from type identifier to the actual MDNode.
|
||||
typedef DenseMap<const MDString *, MDType *> DITypeIdentifierMap;
|
||||
typedef DenseMap<const MDString *, DIType *> DITypeIdentifierMap;
|
||||
|
||||
/// \brief Find subprogram that is enclosing this scope.
|
||||
MDSubprogram *getDISubprogram(const MDNode *Scope);
|
||||
DISubprogram *getDISubprogram(const MDNode *Scope);
|
||||
|
||||
/// \brief Find debug info for a given function.
|
||||
///
|
||||
/// \returns a valid subprogram, if found. Otherwise, return \c nullptr.
|
||||
MDSubprogram *getDISubprogram(const Function *F);
|
||||
DISubprogram *getDISubprogram(const Function *F);
|
||||
|
||||
/// \brief Find underlying composite type.
|
||||
MDCompositeTypeBase *getDICompositeType(MDType *T);
|
||||
DICompositeTypeBase *getDICompositeType(DIType *T);
|
||||
|
||||
/// \brief Generate map by visiting all retained types.
|
||||
DITypeIdentifierMap generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes);
|
||||
@ -81,7 +81,7 @@ public:
|
||||
/// \brief Process DbgValueInst.
|
||||
void processValue(const Module &M, const DbgValueInst *DVI);
|
||||
/// \brief Process debug info location.
|
||||
void processLocation(const Module &M, const MDLocation *Loc);
|
||||
void processLocation(const Module &M, const DILocation *Loc);
|
||||
|
||||
/// \brief Clear all lists.
|
||||
void reset();
|
||||
@ -89,23 +89,23 @@ public:
|
||||
private:
|
||||
void InitializeTypeMap(const Module &M);
|
||||
|
||||
void processType(MDType *DT);
|
||||
void processSubprogram(MDSubprogram *SP);
|
||||
void processScope(MDScope *Scope);
|
||||
bool addCompileUnit(MDCompileUnit *CU);
|
||||
bool addGlobalVariable(MDGlobalVariable *DIG);
|
||||
bool addSubprogram(MDSubprogram *SP);
|
||||
bool addType(MDType *DT);
|
||||
bool addScope(MDScope *Scope);
|
||||
void processType(DIType *DT);
|
||||
void processSubprogram(DISubprogram *SP);
|
||||
void processScope(DIScope *Scope);
|
||||
bool addCompileUnit(DICompileUnit *CU);
|
||||
bool addGlobalVariable(DIGlobalVariable *DIG);
|
||||
bool addSubprogram(DISubprogram *SP);
|
||||
bool addType(DIType *DT);
|
||||
bool addScope(DIScope *Scope);
|
||||
|
||||
public:
|
||||
typedef SmallVectorImpl<MDCompileUnit *>::const_iterator
|
||||
typedef SmallVectorImpl<DICompileUnit *>::const_iterator
|
||||
compile_unit_iterator;
|
||||
typedef SmallVectorImpl<MDSubprogram *>::const_iterator subprogram_iterator;
|
||||
typedef SmallVectorImpl<MDGlobalVariable *>::const_iterator
|
||||
typedef SmallVectorImpl<DISubprogram *>::const_iterator subprogram_iterator;
|
||||
typedef SmallVectorImpl<DIGlobalVariable *>::const_iterator
|
||||
global_variable_iterator;
|
||||
typedef SmallVectorImpl<MDType *>::const_iterator type_iterator;
|
||||
typedef SmallVectorImpl<MDScope *>::const_iterator scope_iterator;
|
||||
typedef SmallVectorImpl<DIType *>::const_iterator type_iterator;
|
||||
typedef SmallVectorImpl<DIScope *>::const_iterator scope_iterator;
|
||||
|
||||
iterator_range<compile_unit_iterator> compile_units() const {
|
||||
return iterator_range<compile_unit_iterator>(CUs.begin(), CUs.end());
|
||||
@ -134,11 +134,11 @@ public:
|
||||
unsigned scope_count() const { return Scopes.size(); }
|
||||
|
||||
private:
|
||||
SmallVector<MDCompileUnit *, 8> CUs;
|
||||
SmallVector<MDSubprogram *, 8> SPs;
|
||||
SmallVector<MDGlobalVariable *, 8> GVs;
|
||||
SmallVector<MDType *, 8> TYs;
|
||||
SmallVector<MDScope *, 8> Scopes;
|
||||
SmallVector<DICompileUnit *, 8> CUs;
|
||||
SmallVector<DISubprogram *, 8> SPs;
|
||||
SmallVector<DIGlobalVariable *, 8> GVs;
|
||||
SmallVector<DIType *, 8> TYs;
|
||||
SmallVector<DIScope *, 8> Scopes;
|
||||
SmallPtrSet<const MDNode *, 64> NodesSeen;
|
||||
DITypeIdentifierMap TypeIdentifierMap;
|
||||
|
||||
@ -146,7 +146,7 @@ private:
|
||||
bool TypeMapInitialized;
|
||||
};
|
||||
|
||||
DenseMap<const Function *, MDSubprogram *> makeSubprogramMap(const Module &M);
|
||||
DenseMap<const Function *, DISubprogram *> makeSubprogramMap(const Module &M);
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,14 +22,14 @@ namespace llvm {
|
||||
|
||||
class LLVMContext;
|
||||
class raw_ostream;
|
||||
class MDLocation;
|
||||
class DILocation;
|
||||
|
||||
/// \brief A debug info location.
|
||||
///
|
||||
/// This class is a wrapper around a tracking reference to an \a MDLocation
|
||||
/// This class is a wrapper around a tracking reference to an \a DILocation
|
||||
/// pointer.
|
||||
///
|
||||
/// To avoid extra includes, \a DebugLoc doubles the \a MDLocation API with a
|
||||
/// To avoid extra includes, \a DebugLoc doubles the \a DILocation API with a
|
||||
/// one based on relatively opaque \a MDNode pointers.
|
||||
class DebugLoc {
|
||||
TrackingMDNodeRef Loc;
|
||||
@ -47,31 +47,31 @@ namespace llvm {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// \brief Construct from an \a MDLocation.
|
||||
DebugLoc(const MDLocation *L);
|
||||
/// \brief Construct from an \a DILocation.
|
||||
DebugLoc(const DILocation *L);
|
||||
|
||||
/// \brief Construct from an \a MDNode.
|
||||
///
|
||||
/// Note: if \c N is not an \a MDLocation, a verifier check will fail, and
|
||||
/// Note: if \c N is not an \a DILocation, a verifier check will fail, and
|
||||
/// accessors will crash. However, construction from other nodes is
|
||||
/// supported in order to handle forward references when reading textual
|
||||
/// IR.
|
||||
explicit DebugLoc(const MDNode *N);
|
||||
|
||||
/// \brief Get the underlying \a MDLocation.
|
||||
/// \brief Get the underlying \a DILocation.
|
||||
///
|
||||
/// \pre !*this or \c isa<MDLocation>(getAsMDNode()).
|
||||
/// \pre !*this or \c isa<DILocation>(getAsMDNode()).
|
||||
/// @{
|
||||
MDLocation *get() const;
|
||||
operator MDLocation *() const { return get(); }
|
||||
MDLocation *operator->() const { return get(); }
|
||||
MDLocation &operator*() const { return *get(); }
|
||||
DILocation *get() const;
|
||||
operator DILocation *() const { return get(); }
|
||||
DILocation *operator->() const { return get(); }
|
||||
DILocation &operator*() const { return *get(); }
|
||||
/// @}
|
||||
|
||||
/// \brief Check for null.
|
||||
///
|
||||
/// Check for null in a way that is safe with broken debug info. Unlike
|
||||
/// the conversion to \c MDLocation, this doesn't require that \c Loc is of
|
||||
/// the conversion to \c DILocation, this doesn't require that \c Loc is of
|
||||
/// the right type. Important for cases like \a llvm::StripDebugInfo() and
|
||||
/// \a Instruction::hasMetadata().
|
||||
explicit operator bool() const { return Loc; }
|
||||
@ -82,18 +82,18 @@ namespace llvm {
|
||||
/// \brief Create a new DebugLoc.
|
||||
///
|
||||
/// Create a new DebugLoc at the specified line/col and scope/inline. This
|
||||
/// forwards to \a MDLocation::get().
|
||||
/// forwards to \a DILocation::get().
|
||||
///
|
||||
/// If \c !Scope, returns a default-constructed \a DebugLoc.
|
||||
///
|
||||
/// FIXME: Remove this. Users should use MDLocation::get().
|
||||
/// FIXME: Remove this. Users should use DILocation::get().
|
||||
static DebugLoc get(unsigned Line, unsigned Col, const MDNode *Scope,
|
||||
const MDNode *InlinedAt = nullptr);
|
||||
|
||||
unsigned getLine() const;
|
||||
unsigned getCol() const;
|
||||
MDNode *getScope() const;
|
||||
MDLocation *getInlinedAt() const;
|
||||
DILocation *getInlinedAt() const;
|
||||
|
||||
/// \brief Get the fully inlined-at scope for a DebugLoc.
|
||||
///
|
||||
@ -105,8 +105,8 @@ namespace llvm {
|
||||
/// Walk up the scope chain of given debug loc and find line number info
|
||||
/// for the function.
|
||||
///
|
||||
/// FIXME: Remove this. Users should use MDLocation/MDLocalScope API to
|
||||
/// find the subprogram, and then MDLocation::get().
|
||||
/// FIXME: Remove this. Users should use DILocation/DILocalScope API to
|
||||
/// find the subprogram, and then DILocation::get().
|
||||
DebugLoc getFnDebugLoc() const;
|
||||
|
||||
/// \brief Return \c this as a bar \a MDNode.
|
||||
|
@ -82,11 +82,11 @@ namespace llvm {
|
||||
class DbgDeclareInst : public DbgInfoIntrinsic {
|
||||
public:
|
||||
Value *getAddress() const;
|
||||
MDLocalVariable *getVariable() const {
|
||||
return cast<MDLocalVariable>(getRawVariable());
|
||||
DILocalVariable *getVariable() const {
|
||||
return cast<DILocalVariable>(getRawVariable());
|
||||
}
|
||||
MDExpression *getExpression() const {
|
||||
return cast<MDExpression>(getRawExpression());
|
||||
DIExpression *getExpression() const {
|
||||
return cast<DIExpression>(getRawExpression());
|
||||
}
|
||||
|
||||
Metadata *getRawVariable() const {
|
||||
@ -115,11 +115,11 @@ namespace llvm {
|
||||
return cast<ConstantInt>(
|
||||
const_cast<Value*>(getArgOperand(1)))->getZExtValue();
|
||||
}
|
||||
MDLocalVariable *getVariable() const {
|
||||
return cast<MDLocalVariable>(getRawVariable());
|
||||
DILocalVariable *getVariable() const {
|
||||
return cast<DILocalVariable>(getRawVariable());
|
||||
}
|
||||
MDExpression *getExpression() const {
|
||||
return cast<MDExpression>(getRawExpression());
|
||||
DIExpression *getExpression() const {
|
||||
return cast<DIExpression>(getRawExpression());
|
||||
}
|
||||
|
||||
Metadata *getRawVariable() const {
|
||||
|
@ -60,36 +60,36 @@ HANDLE_METADATA_LEAF(ConstantAsMetadata)
|
||||
HANDLE_METADATA_LEAF(LocalAsMetadata)
|
||||
HANDLE_MDNODE_BRANCH(MDNode)
|
||||
HANDLE_MDNODE_LEAF(MDTuple)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDLocation)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDExpression)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DebugNode)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(GenericDebugNode)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDSubrange)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDEnumerator)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(MDScope)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(MDType)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDBasicType)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(MDDerivedTypeBase)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDDerivedType)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(MDCompositeTypeBase)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDCompositeType)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDSubroutineType)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDFile)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDCompileUnit)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(MDLocalScope)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDSubprogram)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(MDLexicalBlockBase)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDLexicalBlock)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDLexicalBlockFile)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDNamespace)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(MDTemplateParameter)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDTemplateTypeParameter)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDTemplateValueParameter)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(MDVariable)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDGlobalVariable)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDLocalVariable)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDObjCProperty)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(MDImportedEntity)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DILocation)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DIExpression)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DINode)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(GenericDINode)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DISubrange)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DIEnumerator)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DIScope)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DIType)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DIBasicType)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DIDerivedTypeBase)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DIDerivedType)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DICompositeTypeBase)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DICompositeType)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DISubroutineType)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DIFile)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DICompileUnit)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DILocalScope)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DISubprogram)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DILexicalBlockBase)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DILexicalBlock)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DILexicalBlockFile)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DINamespace)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DITemplateParameter)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DITemplateTypeParameter)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DITemplateValueParameter)
|
||||
HANDLE_SPECIALIZED_MDNODE_BRANCH(DIVariable)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DIGlobalVariable)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DILocalVariable)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DIObjCProperty)
|
||||
HANDLE_SPECIALIZED_MDNODE_LEAF(DIImportedEntity)
|
||||
|
||||
#undef HANDLE_METADATA
|
||||
#undef HANDLE_METADATA_LEAF
|
||||
|
@ -59,27 +59,27 @@ protected:
|
||||
public:
|
||||
enum MetadataKind {
|
||||
MDTupleKind,
|
||||
MDLocationKind,
|
||||
GenericDebugNodeKind,
|
||||
MDSubrangeKind,
|
||||
MDEnumeratorKind,
|
||||
MDBasicTypeKind,
|
||||
MDDerivedTypeKind,
|
||||
MDCompositeTypeKind,
|
||||
MDSubroutineTypeKind,
|
||||
MDFileKind,
|
||||
MDCompileUnitKind,
|
||||
MDSubprogramKind,
|
||||
MDLexicalBlockKind,
|
||||
MDLexicalBlockFileKind,
|
||||
MDNamespaceKind,
|
||||
MDTemplateTypeParameterKind,
|
||||
MDTemplateValueParameterKind,
|
||||
MDGlobalVariableKind,
|
||||
MDLocalVariableKind,
|
||||
MDExpressionKind,
|
||||
MDObjCPropertyKind,
|
||||
MDImportedEntityKind,
|
||||
DILocationKind,
|
||||
GenericDINodeKind,
|
||||
DISubrangeKind,
|
||||
DIEnumeratorKind,
|
||||
DIBasicTypeKind,
|
||||
DIDerivedTypeKind,
|
||||
DICompositeTypeKind,
|
||||
DISubroutineTypeKind,
|
||||
DIFileKind,
|
||||
DICompileUnitKind,
|
||||
DISubprogramKind,
|
||||
DILexicalBlockKind,
|
||||
DILexicalBlockFileKind,
|
||||
DINamespaceKind,
|
||||
DITemplateTypeParameterKind,
|
||||
DITemplateValueParameterKind,
|
||||
DIGlobalVariableKind,
|
||||
DILocalVariableKind,
|
||||
DIExpressionKind,
|
||||
DIObjCPropertyKind,
|
||||
DIImportedEntityKind,
|
||||
ConstantAsMetadataKind,
|
||||
LocalAsMetadataKind,
|
||||
MDStringKind
|
||||
|
@ -72,7 +72,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
|
||||
// Printing the nodes directly isn't particularly helpful (since they
|
||||
// reference other nodes that won't be printed, particularly for the
|
||||
// filenames), so just print a few useful things.
|
||||
for (MDCompileUnit *CU : Finder.compile_units()) {
|
||||
for (DICompileUnit *CU : Finder.compile_units()) {
|
||||
O << "Compile unit: ";
|
||||
if (const char *Lang = dwarf::LanguageString(CU->getSourceLanguage()))
|
||||
O << Lang;
|
||||
@ -82,7 +82,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
|
||||
O << '\n';
|
||||
}
|
||||
|
||||
for (MDSubprogram *S : Finder.subprograms()) {
|
||||
for (DISubprogram *S : Finder.subprograms()) {
|
||||
O << "Subprogram: " << S->getName();
|
||||
printFile(O, S->getFilename(), S->getDirectory(), S->getLine());
|
||||
if (!S->getLinkageName().empty())
|
||||
@ -90,7 +90,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
|
||||
O << '\n';
|
||||
}
|
||||
|
||||
for (const MDGlobalVariable *GV : Finder.global_variables()) {
|
||||
for (const DIGlobalVariable *GV : Finder.global_variables()) {
|
||||
O << "Global variable: " << GV->getName();
|
||||
printFile(O, GV->getFilename(), GV->getDirectory(), GV->getLine());
|
||||
if (!GV->getLinkageName().empty())
|
||||
@ -98,12 +98,12 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
|
||||
O << '\n';
|
||||
}
|
||||
|
||||
for (const MDType *T : Finder.types()) {
|
||||
for (const DIType *T : Finder.types()) {
|
||||
O << "Type:";
|
||||
if (!T->getName().empty())
|
||||
O << ' ' << T->getName();
|
||||
printFile(O, T->getFilename(), T->getDirectory(), T->getLine());
|
||||
if (auto *BT = dyn_cast<MDBasicType>(T)) {
|
||||
if (auto *BT = dyn_cast<DIBasicType>(T)) {
|
||||
O << " ";
|
||||
if (const char *Encoding =
|
||||
dwarf::AttributeEncodingString(BT->getEncoding()))
|
||||
@ -117,7 +117,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
|
||||
else
|
||||
O << "unknown-tag(" << T->getTag() << ")";
|
||||
}
|
||||
if (auto *CT = dyn_cast<MDCompositeType>(T)) {
|
||||
if (auto *CT = dyn_cast<DICompositeType>(T)) {
|
||||
if (auto *S = CT->getRawIdentifier())
|
||||
O << " (identifier: '" << S->getString() << "')";
|
||||
}
|
||||
|
@ -2994,7 +2994,7 @@ bool LLParser::ParseMDTuple(MDNode *&MD, bool IsDistinct) {
|
||||
/// MDNode:
|
||||
/// ::= !{ ... }
|
||||
/// ::= !7
|
||||
/// ::= !MDLocation(...)
|
||||
/// ::= !DILocation(...)
|
||||
bool LLParser::ParseMDNode(MDNode *&N) {
|
||||
if (Lex.getKind() == lltok::MetadataVar)
|
||||
return ParseSpecializedMDNode(N);
|
||||
@ -3209,7 +3209,7 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DIFlagField &Result) {
|
||||
if (Lex.getKind() != lltok::DIFlag)
|
||||
return TokError("expected debug info flag");
|
||||
|
||||
Val = DebugNode::getFlag(Lex.getStrVal());
|
||||
Val = DINode::getFlag(Lex.getStrVal());
|
||||
if (!Val)
|
||||
return TokError(Twine("invalid debug info flag flag '") +
|
||||
Lex.getStrVal() + "'");
|
||||
@ -3391,9 +3391,9 @@ bool LLParser::ParseSpecializedMDNode(MDNode *&N, bool IsDistinct) {
|
||||
#define GET_OR_DISTINCT(CLASS, ARGS) \
|
||||
(IsDistinct ? CLASS::getDistinct ARGS : CLASS::get ARGS)
|
||||
|
||||
/// ParseMDLocationFields:
|
||||
/// ::= !MDLocation(line: 43, column: 8, scope: !5, inlinedAt: !6)
|
||||
bool LLParser::ParseMDLocation(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseDILocationFields:
|
||||
/// ::= !DILocation(line: 43, column: 8, scope: !5, inlinedAt: !6)
|
||||
bool LLParser::ParseDILocation(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
OPTIONAL(line, LineField, ); \
|
||||
OPTIONAL(column, ColumnField, ); \
|
||||
@ -3403,13 +3403,13 @@ bool LLParser::ParseMDLocation(MDNode *&Result, bool IsDistinct) {
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(
|
||||
MDLocation, (Context, line.Val, column.Val, scope.Val, inlinedAt.Val));
|
||||
DILocation, (Context, line.Val, column.Val, scope.Val, inlinedAt.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseGenericDebugNode:
|
||||
/// ::= !GenericDebugNode(tag: 15, header: "...", operands: {...})
|
||||
bool LLParser::ParseGenericDebugNode(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseGenericDINode:
|
||||
/// ::= !GenericDINode(tag: 15, header: "...", operands: {...})
|
||||
bool LLParser::ParseGenericDINode(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(tag, DwarfTagField, ); \
|
||||
OPTIONAL(header, MDStringField, ); \
|
||||
@ -3417,40 +3417,40 @@ bool LLParser::ParseGenericDebugNode(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(GenericDebugNode,
|
||||
Result = GET_OR_DISTINCT(GenericDINode,
|
||||
(Context, tag.Val, header.Val, operands.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDSubrange:
|
||||
/// ::= !MDSubrange(count: 30, lowerBound: 2)
|
||||
bool LLParser::ParseMDSubrange(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseDISubrange:
|
||||
/// ::= !DISubrange(count: 30, lowerBound: 2)
|
||||
bool LLParser::ParseDISubrange(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(count, MDSignedField, (-1, -1, INT64_MAX)); \
|
||||
OPTIONAL(lowerBound, MDSignedField, );
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDSubrange, (Context, count.Val, lowerBound.Val));
|
||||
Result = GET_OR_DISTINCT(DISubrange, (Context, count.Val, lowerBound.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDEnumerator:
|
||||
/// ::= !MDEnumerator(value: 30, name: "SomeKind")
|
||||
bool LLParser::ParseMDEnumerator(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseDIEnumerator:
|
||||
/// ::= !DIEnumerator(value: 30, name: "SomeKind")
|
||||
bool LLParser::ParseDIEnumerator(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(name, MDStringField, ); \
|
||||
REQUIRED(value, MDSignedField, );
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDEnumerator, (Context, value.Val, name.Val));
|
||||
Result = GET_OR_DISTINCT(DIEnumerator, (Context, value.Val, name.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDBasicType:
|
||||
/// ::= !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32)
|
||||
bool LLParser::ParseMDBasicType(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseDIBasicType:
|
||||
/// ::= !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32)
|
||||
bool LLParser::ParseDIBasicType(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
OPTIONAL(tag, DwarfTagField, (dwarf::DW_TAG_base_type)); \
|
||||
OPTIONAL(name, MDStringField, ); \
|
||||
@ -3460,16 +3460,16 @@ bool LLParser::ParseMDBasicType(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDBasicType, (Context, tag.Val, name.Val, size.Val,
|
||||
Result = GET_OR_DISTINCT(DIBasicType, (Context, tag.Val, name.Val, size.Val,
|
||||
align.Val, encoding.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDDerivedType:
|
||||
/// ::= !MDDerivedType(tag: DW_TAG_pointer_type, name: "int", file: !0,
|
||||
/// ParseDIDerivedType:
|
||||
/// ::= !DIDerivedType(tag: DW_TAG_pointer_type, name: "int", file: !0,
|
||||
/// line: 7, scope: !1, baseType: !2, size: 32,
|
||||
/// align: 32, offset: 0, flags: 0, extraData: !3)
|
||||
bool LLParser::ParseMDDerivedType(MDNode *&Result, bool IsDistinct) {
|
||||
bool LLParser::ParseDIDerivedType(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(tag, DwarfTagField, ); \
|
||||
OPTIONAL(name, MDStringField, ); \
|
||||
@ -3485,14 +3485,14 @@ bool LLParser::ParseMDDerivedType(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDDerivedType,
|
||||
Result = GET_OR_DISTINCT(DIDerivedType,
|
||||
(Context, tag.Val, name.Val, file.Val, line.Val,
|
||||
scope.Val, baseType.Val, size.Val, align.Val,
|
||||
offset.Val, flags.Val, extraData.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LLParser::ParseMDCompositeType(MDNode *&Result, bool IsDistinct) {
|
||||
bool LLParser::ParseDICompositeType(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(tag, DwarfTagField, ); \
|
||||
OPTIONAL(name, MDStringField, ); \
|
||||
@ -3513,44 +3513,44 @@ bool LLParser::ParseMDCompositeType(MDNode *&Result, bool IsDistinct) {
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(
|
||||
MDCompositeType,
|
||||
DICompositeType,
|
||||
(Context, tag.Val, name.Val, file.Val, line.Val, scope.Val, baseType.Val,
|
||||
size.Val, align.Val, offset.Val, flags.Val, elements.Val,
|
||||
runtimeLang.Val, vtableHolder.Val, templateParams.Val, identifier.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LLParser::ParseMDSubroutineType(MDNode *&Result, bool IsDistinct) {
|
||||
bool LLParser::ParseDISubroutineType(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
OPTIONAL(flags, DIFlagField, ); \
|
||||
REQUIRED(types, MDField, );
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDSubroutineType, (Context, flags.Val, types.Val));
|
||||
Result = GET_OR_DISTINCT(DISubroutineType, (Context, flags.Val, types.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDFileType:
|
||||
/// ::= !MDFileType(filename: "path/to/file", directory: "/path/to/dir")
|
||||
bool LLParser::ParseMDFile(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseDIFileType:
|
||||
/// ::= !DIFileType(filename: "path/to/file", directory: "/path/to/dir")
|
||||
bool LLParser::ParseDIFile(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(filename, MDStringField, ); \
|
||||
REQUIRED(directory, MDStringField, );
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDFile, (Context, filename.Val, directory.Val));
|
||||
Result = GET_OR_DISTINCT(DIFile, (Context, filename.Val, directory.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDCompileUnit:
|
||||
/// ::= !MDCompileUnit(language: DW_LANG_C99, file: !0, producer: "clang",
|
||||
/// ParseDICompileUnit:
|
||||
/// ::= !DICompileUnit(language: DW_LANG_C99, file: !0, producer: "clang",
|
||||
/// isOptimized: true, flags: "-O2", runtimeVersion: 1,
|
||||
/// splitDebugFilename: "abc.debug", emissionKind: 1,
|
||||
/// enums: !1, retainedTypes: !2, subprograms: !3,
|
||||
/// globals: !4, imports: !5)
|
||||
bool LLParser::ParseMDCompileUnit(MDNode *&Result, bool IsDistinct) {
|
||||
bool LLParser::ParseDICompileUnit(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(language, DwarfLangField, ); \
|
||||
REQUIRED(file, MDField, (/* AllowNull */ false)); \
|
||||
@ -3568,7 +3568,7 @@ bool LLParser::ParseMDCompileUnit(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDCompileUnit,
|
||||
Result = GET_OR_DISTINCT(DICompileUnit,
|
||||
(Context, language.Val, file.Val, producer.Val,
|
||||
isOptimized.Val, flags.Val, runtimeVersion.Val,
|
||||
splitDebugFilename.Val, emissionKind.Val, enums.Val,
|
||||
@ -3577,15 +3577,15 @@ bool LLParser::ParseMDCompileUnit(MDNode *&Result, bool IsDistinct) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDSubprogram:
|
||||
/// ::= !MDSubprogram(scope: !0, name: "foo", linkageName: "_Zfoo",
|
||||
/// ParseDISubprogram:
|
||||
/// ::= !DISubprogram(scope: !0, name: "foo", linkageName: "_Zfoo",
|
||||
/// file: !1, line: 7, type: !2, isLocal: false,
|
||||
/// isDefinition: true, scopeLine: 8, containingType: !3,
|
||||
/// virtuality: DW_VIRTUALTIY_pure_virtual,
|
||||
/// virtualIndex: 10, flags: 11,
|
||||
/// isOptimized: false, function: void ()* @_Z3foov,
|
||||
/// templateParams: !4, declaration: !5, variables: !6)
|
||||
bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) {
|
||||
bool LLParser::ParseDISubprogram(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
OPTIONAL(scope, MDField, ); \
|
||||
OPTIONAL(name, MDStringField, ); \
|
||||
@ -3609,7 +3609,7 @@ bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) {
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(
|
||||
MDSubprogram, (Context, scope.Val, name.Val, linkageName.Val, file.Val,
|
||||
DISubprogram, (Context, scope.Val, name.Val, linkageName.Val, file.Val,
|
||||
line.Val, type.Val, isLocal.Val, isDefinition.Val,
|
||||
scopeLine.Val, containingType.Val, virtuality.Val,
|
||||
virtualIndex.Val, flags.Val, isOptimized.Val, function.Val,
|
||||
@ -3617,9 +3617,9 @@ bool LLParser::ParseMDSubprogram(MDNode *&Result, bool IsDistinct) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDLexicalBlock:
|
||||
/// ::= !MDLexicalBlock(scope: !0, file: !2, line: 7, column: 9)
|
||||
bool LLParser::ParseMDLexicalBlock(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseDILexicalBlock:
|
||||
/// ::= !DILexicalBlock(scope: !0, file: !2, line: 7, column: 9)
|
||||
bool LLParser::ParseDILexicalBlock(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(scope, MDField, (/* AllowNull */ false)); \
|
||||
OPTIONAL(file, MDField, ); \
|
||||
@ -3629,13 +3629,13 @@ bool LLParser::ParseMDLexicalBlock(MDNode *&Result, bool IsDistinct) {
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(
|
||||
MDLexicalBlock, (Context, scope.Val, file.Val, line.Val, column.Val));
|
||||
DILexicalBlock, (Context, scope.Val, file.Val, line.Val, column.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDLexicalBlockFile:
|
||||
/// ::= !MDLexicalBlockFile(scope: !0, file: !2, discriminator: 9)
|
||||
bool LLParser::ParseMDLexicalBlockFile(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseDILexicalBlockFile:
|
||||
/// ::= !DILexicalBlockFile(scope: !0, file: !2, discriminator: 9)
|
||||
bool LLParser::ParseDILexicalBlockFile(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(scope, MDField, (/* AllowNull */ false)); \
|
||||
OPTIONAL(file, MDField, ); \
|
||||
@ -3643,14 +3643,14 @@ bool LLParser::ParseMDLexicalBlockFile(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDLexicalBlockFile,
|
||||
Result = GET_OR_DISTINCT(DILexicalBlockFile,
|
||||
(Context, scope.Val, file.Val, discriminator.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDNamespace:
|
||||
/// ::= !MDNamespace(scope: !0, file: !2, name: "SomeNamespace", line: 9)
|
||||
bool LLParser::ParseMDNamespace(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseDINamespace:
|
||||
/// ::= !DINamespace(scope: !0, file: !2, name: "SomeNamespace", line: 9)
|
||||
bool LLParser::ParseDINamespace(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(scope, MDField, ); \
|
||||
OPTIONAL(file, MDField, ); \
|
||||
@ -3659,14 +3659,14 @@ bool LLParser::ParseMDNamespace(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDNamespace,
|
||||
Result = GET_OR_DISTINCT(DINamespace,
|
||||
(Context, scope.Val, file.Val, name.Val, line.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDTemplateTypeParameter:
|
||||
/// ::= !MDTemplateTypeParameter(name: "Ty", type: !1)
|
||||
bool LLParser::ParseMDTemplateTypeParameter(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseDITemplateTypeParameter:
|
||||
/// ::= !DITemplateTypeParameter(name: "Ty", type: !1)
|
||||
bool LLParser::ParseDITemplateTypeParameter(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
OPTIONAL(name, MDStringField, ); \
|
||||
REQUIRED(type, MDField, );
|
||||
@ -3674,14 +3674,14 @@ bool LLParser::ParseMDTemplateTypeParameter(MDNode *&Result, bool IsDistinct) {
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result =
|
||||
GET_OR_DISTINCT(MDTemplateTypeParameter, (Context, name.Val, type.Val));
|
||||
GET_OR_DISTINCT(DITemplateTypeParameter, (Context, name.Val, type.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDTemplateValueParameter:
|
||||
/// ::= !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter,
|
||||
/// ParseDITemplateValueParameter:
|
||||
/// ::= !DITemplateValueParameter(tag: DW_TAG_template_value_parameter,
|
||||
/// name: "V", type: !1, value: i32 7)
|
||||
bool LLParser::ParseMDTemplateValueParameter(MDNode *&Result, bool IsDistinct) {
|
||||
bool LLParser::ParseDITemplateValueParameter(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
OPTIONAL(tag, DwarfTagField, (dwarf::DW_TAG_template_value_parameter)); \
|
||||
OPTIONAL(name, MDStringField, ); \
|
||||
@ -3690,17 +3690,17 @@ bool LLParser::ParseMDTemplateValueParameter(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDTemplateValueParameter,
|
||||
Result = GET_OR_DISTINCT(DITemplateValueParameter,
|
||||
(Context, tag.Val, name.Val, type.Val, value.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDGlobalVariable:
|
||||
/// ::= !MDGlobalVariable(scope: !0, name: "foo", linkageName: "foo",
|
||||
/// ParseDIGlobalVariable:
|
||||
/// ::= !DIGlobalVariable(scope: !0, name: "foo", linkageName: "foo",
|
||||
/// file: !1, line: 7, type: !2, isLocal: false,
|
||||
/// isDefinition: true, variable: i32* @foo,
|
||||
/// declaration: !3)
|
||||
bool LLParser::ParseMDGlobalVariable(MDNode *&Result, bool IsDistinct) {
|
||||
bool LLParser::ParseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(name, MDStringField, (/* AllowEmpty */ false)); \
|
||||
OPTIONAL(scope, MDField, ); \
|
||||
@ -3715,17 +3715,17 @@ bool LLParser::ParseMDGlobalVariable(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDGlobalVariable,
|
||||
Result = GET_OR_DISTINCT(DIGlobalVariable,
|
||||
(Context, scope.Val, name.Val, linkageName.Val,
|
||||
file.Val, line.Val, type.Val, isLocal.Val,
|
||||
isDefinition.Val, variable.Val, declaration.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDLocalVariable:
|
||||
/// ::= !MDLocalVariable(tag: DW_TAG_arg_variable, scope: !0, name: "foo",
|
||||
/// ParseDILocalVariable:
|
||||
/// ::= !DILocalVariable(tag: DW_TAG_arg_variable, scope: !0, name: "foo",
|
||||
/// file: !1, line: 7, type: !2, arg: 2, flags: 7)
|
||||
bool LLParser::ParseMDLocalVariable(MDNode *&Result, bool IsDistinct) {
|
||||
bool LLParser::ParseDILocalVariable(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(tag, DwarfTagField, ); \
|
||||
REQUIRED(scope, MDField, (/* AllowNull */ false)); \
|
||||
@ -3738,15 +3738,15 @@ bool LLParser::ParseMDLocalVariable(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDLocalVariable,
|
||||
Result = GET_OR_DISTINCT(DILocalVariable,
|
||||
(Context, tag.Val, scope.Val, name.Val, file.Val,
|
||||
line.Val, type.Val, arg.Val, flags.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDExpression:
|
||||
/// ::= !MDExpression(0, 7, -1)
|
||||
bool LLParser::ParseMDExpression(MDNode *&Result, bool IsDistinct) {
|
||||
/// ParseDIExpression:
|
||||
/// ::= !DIExpression(0, 7, -1)
|
||||
bool LLParser::ParseDIExpression(MDNode *&Result, bool IsDistinct) {
|
||||
assert(Lex.getKind() == lltok::MetadataVar && "Expected metadata type name");
|
||||
Lex.Lex();
|
||||
|
||||
@ -3778,14 +3778,14 @@ bool LLParser::ParseMDExpression(MDNode *&Result, bool IsDistinct) {
|
||||
if (ParseToken(lltok::rparen, "expected ')' here"))
|
||||
return true;
|
||||
|
||||
Result = GET_OR_DISTINCT(MDExpression, (Context, Elements));
|
||||
Result = GET_OR_DISTINCT(DIExpression, (Context, Elements));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDObjCProperty:
|
||||
/// ::= !MDObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo",
|
||||
/// ParseDIObjCProperty:
|
||||
/// ::= !DIObjCProperty(name: "foo", file: !1, line: 7, setter: "setFoo",
|
||||
/// getter: "getFoo", attributes: 7, type: !2)
|
||||
bool LLParser::ParseMDObjCProperty(MDNode *&Result, bool IsDistinct) {
|
||||
bool LLParser::ParseDIObjCProperty(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
OPTIONAL(name, MDStringField, ); \
|
||||
OPTIONAL(file, MDField, ); \
|
||||
@ -3797,16 +3797,16 @@ bool LLParser::ParseMDObjCProperty(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDObjCProperty,
|
||||
Result = GET_OR_DISTINCT(DIObjCProperty,
|
||||
(Context, name.Val, file.Val, line.Val, setter.Val,
|
||||
getter.Val, attributes.Val, type.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDImportedEntity:
|
||||
/// ::= !MDImportedEntity(tag: DW_TAG_imported_module, scope: !0, entity: !1,
|
||||
/// ParseDIImportedEntity:
|
||||
/// ::= !DIImportedEntity(tag: DW_TAG_imported_module, scope: !0, entity: !1,
|
||||
/// line: 7, name: "foo")
|
||||
bool LLParser::ParseMDImportedEntity(MDNode *&Result, bool IsDistinct) {
|
||||
bool LLParser::ParseDIImportedEntity(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(tag, DwarfTagField, ); \
|
||||
REQUIRED(scope, MDField, ); \
|
||||
@ -3816,7 +3816,7 @@ bool LLParser::ParseMDImportedEntity(MDNode *&Result, bool IsDistinct) {
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDImportedEntity, (Context, tag.Val, scope.Val,
|
||||
Result = GET_OR_DISTINCT(DIImportedEntity, (Context, tag.Val, scope.Val,
|
||||
entity.Val, line.Val, name.Val));
|
||||
return false;
|
||||
}
|
||||
@ -3871,7 +3871,7 @@ bool LLParser::ParseValueAsMetadata(Metadata *&MD, const Twine &TypeMsg,
|
||||
/// ::= !42
|
||||
/// ::= !{...}
|
||||
/// ::= !"string"
|
||||
/// ::= !MDLocation(...)
|
||||
/// ::= !DILocation(...)
|
||||
bool LLParser::ParseMetadata(Metadata *&MD, PerFunctionState *PFS) {
|
||||
if (Lex.getKind() == lltok::MetadataVar) {
|
||||
MDNode *N;
|
||||
|
@ -1724,7 +1724,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
Metadata *InlinedAt =
|
||||
Record[4] ? MDValueList.getValueFwdRef(Record[4] - 1) : nullptr;
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDLocation, Record[0],
|
||||
GET_OR_DISTINCT(DILocation, Record[0],
|
||||
(Context, Line, Column, Scope, InlinedAt)),
|
||||
NextMDValueNo++);
|
||||
break;
|
||||
@ -1744,7 +1744,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
for (unsigned I = 4, E = Record.size(); I != E; ++I)
|
||||
DwarfOps.push_back(Record[I] ? MDValueList.getValueFwdRef(Record[I] - 1)
|
||||
: nullptr);
|
||||
MDValueList.AssignValue(GET_OR_DISTINCT(GenericDebugNode, Record[0],
|
||||
MDValueList.AssignValue(GET_OR_DISTINCT(GenericDINode, Record[0],
|
||||
(Context, Tag, Header, DwarfOps)),
|
||||
NextMDValueNo++);
|
||||
break;
|
||||
@ -1754,7 +1754,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDSubrange, Record[0],
|
||||
GET_OR_DISTINCT(DISubrange, Record[0],
|
||||
(Context, Record[1], unrotateSign(Record[2]))),
|
||||
NextMDValueNo++);
|
||||
break;
|
||||
@ -1763,7 +1763,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
if (Record.size() != 3)
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(GET_OR_DISTINCT(MDEnumerator, Record[0],
|
||||
MDValueList.AssignValue(GET_OR_DISTINCT(DIEnumerator, Record[0],
|
||||
(Context, unrotateSign(Record[1]),
|
||||
getMDString(Record[2]))),
|
||||
NextMDValueNo++);
|
||||
@ -1774,7 +1774,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDBasicType, Record[0],
|
||||
GET_OR_DISTINCT(DIBasicType, Record[0],
|
||||
(Context, Record[1], getMDString(Record[2]),
|
||||
Record[3], Record[4], Record[5])),
|
||||
NextMDValueNo++);
|
||||
@ -1785,7 +1785,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDDerivedType, Record[0],
|
||||
GET_OR_DISTINCT(DIDerivedType, Record[0],
|
||||
(Context, Record[1], getMDString(Record[2]),
|
||||
getMDOrNull(Record[3]), Record[4],
|
||||
getMDOrNull(Record[5]), getMDOrNull(Record[6]),
|
||||
@ -1799,7 +1799,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDCompositeType, Record[0],
|
||||
GET_OR_DISTINCT(DICompositeType, Record[0],
|
||||
(Context, Record[1], getMDString(Record[2]),
|
||||
getMDOrNull(Record[3]), Record[4],
|
||||
getMDOrNull(Record[5]), getMDOrNull(Record[6]),
|
||||
@ -1815,7 +1815,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDSubroutineType, Record[0],
|
||||
GET_OR_DISTINCT(DISubroutineType, Record[0],
|
||||
(Context, Record[1], getMDOrNull(Record[2]))),
|
||||
NextMDValueNo++);
|
||||
break;
|
||||
@ -1825,7 +1825,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDFile, Record[0], (Context, getMDString(Record[1]),
|
||||
GET_OR_DISTINCT(DIFile, Record[0], (Context, getMDString(Record[1]),
|
||||
getMDString(Record[2]))),
|
||||
NextMDValueNo++);
|
||||
break;
|
||||
@ -1835,7 +1835,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDCompileUnit, Record[0],
|
||||
GET_OR_DISTINCT(DICompileUnit, Record[0],
|
||||
(Context, Record[1], getMDOrNull(Record[2]),
|
||||
getMDString(Record[3]), Record[4],
|
||||
getMDString(Record[5]), Record[6],
|
||||
@ -1852,7 +1852,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(
|
||||
MDSubprogram, Record[0],
|
||||
DISubprogram, Record[0],
|
||||
(Context, getMDOrNull(Record[1]), getMDString(Record[2]),
|
||||
getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
|
||||
getMDOrNull(Record[6]), Record[7], Record[8], Record[9],
|
||||
@ -1867,7 +1867,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDLexicalBlock, Record[0],
|
||||
GET_OR_DISTINCT(DILexicalBlock, Record[0],
|
||||
(Context, getMDOrNull(Record[1]),
|
||||
getMDOrNull(Record[2]), Record[3], Record[4])),
|
||||
NextMDValueNo++);
|
||||
@ -1878,7 +1878,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDLexicalBlockFile, Record[0],
|
||||
GET_OR_DISTINCT(DILexicalBlockFile, Record[0],
|
||||
(Context, getMDOrNull(Record[1]),
|
||||
getMDOrNull(Record[2]), Record[3])),
|
||||
NextMDValueNo++);
|
||||
@ -1889,7 +1889,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDNamespace, Record[0],
|
||||
GET_OR_DISTINCT(DINamespace, Record[0],
|
||||
(Context, getMDOrNull(Record[1]),
|
||||
getMDOrNull(Record[2]), getMDString(Record[3]),
|
||||
Record[4])),
|
||||
@ -1900,7 +1900,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
if (Record.size() != 3)
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(GET_OR_DISTINCT(MDTemplateTypeParameter,
|
||||
MDValueList.AssignValue(GET_OR_DISTINCT(DITemplateTypeParameter,
|
||||
Record[0],
|
||||
(Context, getMDString(Record[1]),
|
||||
getMDOrNull(Record[2]))),
|
||||
@ -1912,7 +1912,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDTemplateValueParameter, Record[0],
|
||||
GET_OR_DISTINCT(DITemplateValueParameter, Record[0],
|
||||
(Context, Record[1], getMDString(Record[2]),
|
||||
getMDOrNull(Record[3]), getMDOrNull(Record[4]))),
|
||||
NextMDValueNo++);
|
||||
@ -1923,7 +1923,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDGlobalVariable, Record[0],
|
||||
GET_OR_DISTINCT(DIGlobalVariable, Record[0],
|
||||
(Context, getMDOrNull(Record[1]),
|
||||
getMDString(Record[2]), getMDString(Record[3]),
|
||||
getMDOrNull(Record[4]), Record[5],
|
||||
@ -1938,7 +1938,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDLocalVariable, Record[0],
|
||||
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],
|
||||
@ -1951,7 +1951,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDExpression, Record[0],
|
||||
GET_OR_DISTINCT(DIExpression, Record[0],
|
||||
(Context, makeArrayRef(Record).slice(1))),
|
||||
NextMDValueNo++);
|
||||
break;
|
||||
@ -1961,7 +1961,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDObjCProperty, Record[0],
|
||||
GET_OR_DISTINCT(DIObjCProperty, Record[0],
|
||||
(Context, getMDString(Record[1]),
|
||||
getMDOrNull(Record[2]), Record[3],
|
||||
getMDString(Record[4]), getMDString(Record[5]),
|
||||
@ -1974,7 +1974,7 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDImportedEntity, Record[0],
|
||||
GET_OR_DISTINCT(DIImportedEntity, Record[0],
|
||||
(Context, Record[1], getMDOrNull(Record[2]),
|
||||
getMDOrNull(Record[3]), Record[4],
|
||||
getMDString(Record[5]))),
|
||||
|
@ -784,7 +784,7 @@ static void WriteMDTuple(const MDTuple *N, const ValueEnumerator &VE,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDLocation(const MDLocation *N, const ValueEnumerator &VE,
|
||||
static void WriteDILocation(const DILocation *N, const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
@ -798,11 +798,11 @@ static void WriteMDLocation(const MDLocation *N, const ValueEnumerator &VE,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteGenericDebugNode(const GenericDebugNode *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
static void WriteGenericDINode(const GenericDINode *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
Record.push_back(N->isDistinct());
|
||||
Record.push_back(N->getTag());
|
||||
Record.push_back(0); // Per-tag version field; unused for now.
|
||||
@ -819,7 +819,7 @@ static uint64_t rotateSign(int64_t I) {
|
||||
return I < 0 ? ~(U << 1) : U << 1;
|
||||
}
|
||||
|
||||
static void WriteMDSubrange(const MDSubrange *N, const ValueEnumerator &,
|
||||
static void WriteDISubrange(const DISubrange *N, const ValueEnumerator &,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
@ -831,7 +831,7 @@ static void WriteMDSubrange(const MDSubrange *N, const ValueEnumerator &,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDEnumerator(const MDEnumerator *N, const ValueEnumerator &VE,
|
||||
static void WriteDIEnumerator(const DIEnumerator *N, const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
@ -843,7 +843,7 @@ static void WriteMDEnumerator(const MDEnumerator *N, const ValueEnumerator &VE,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDBasicType(const MDBasicType *N, const ValueEnumerator &VE,
|
||||
static void WriteDIBasicType(const DIBasicType *N, const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
@ -858,7 +858,7 @@ static void WriteMDBasicType(const MDBasicType *N, const ValueEnumerator &VE,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDDerivedType(const MDDerivedType *N,
|
||||
static void WriteDIDerivedType(const DIDerivedType *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
@ -880,7 +880,7 @@ static void WriteMDDerivedType(const MDDerivedType *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDCompositeType(const MDCompositeType *N,
|
||||
static void WriteDICompositeType(const DICompositeType *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
@ -906,7 +906,7 @@ static void WriteMDCompositeType(const MDCompositeType *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDSubroutineType(const MDSubroutineType *N,
|
||||
static void WriteDISubroutineType(const DISubroutineType *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
@ -919,7 +919,7 @@ static void WriteMDSubroutineType(const MDSubroutineType *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDFile(const MDFile *N, const ValueEnumerator &VE,
|
||||
static void WriteDIFile(const DIFile *N, const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
|
||||
Record.push_back(N->isDistinct());
|
||||
@ -930,7 +930,7 @@ static void WriteMDFile(const MDFile *N, const ValueEnumerator &VE,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDCompileUnit(const MDCompileUnit *N,
|
||||
static void WriteDICompileUnit(const DICompileUnit *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
@ -954,11 +954,10 @@ static void WriteMDCompileUnit(const MDCompileUnit *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDSubprogram(const MDSubprogram *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
static void WriteDISubprogram(const DISubprogram *N, const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
Record.push_back(N->isDistinct());
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getScope()));
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
|
||||
@ -983,11 +982,11 @@ static void WriteMDSubprogram(const MDSubprogram *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDLexicalBlock(const MDLexicalBlock *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
static void WriteDILexicalBlock(const DILexicalBlock *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
Record.push_back(N->isDistinct());
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getScope()));
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getFile()));
|
||||
@ -998,7 +997,7 @@ static void WriteMDLexicalBlock(const MDLexicalBlock *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDLexicalBlockFile(const MDLexicalBlockFile *N,
|
||||
static void WriteDILexicalBlockFile(const DILexicalBlockFile *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
@ -1012,7 +1011,7 @@ static void WriteMDLexicalBlockFile(const MDLexicalBlockFile *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDNamespace(const MDNamespace *N, const ValueEnumerator &VE,
|
||||
static void WriteDINamespace(const DINamespace *N, const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
@ -1026,7 +1025,7 @@ static void WriteMDNamespace(const MDNamespace *N, const ValueEnumerator &VE,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDTemplateTypeParameter(const MDTemplateTypeParameter *N,
|
||||
static void WriteDITemplateTypeParameter(const DITemplateTypeParameter *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
@ -1039,7 +1038,7 @@ static void WriteMDTemplateTypeParameter(const MDTemplateTypeParameter *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDTemplateValueParameter(const MDTemplateValueParameter *N,
|
||||
static void WriteDITemplateValueParameter(const DITemplateValueParameter *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
@ -1054,7 +1053,7 @@ static void WriteMDTemplateValueParameter(const MDTemplateValueParameter *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDGlobalVariable(const MDGlobalVariable *N,
|
||||
static void WriteDIGlobalVariable(const DIGlobalVariable *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
@ -1075,7 +1074,7 @@ static void WriteMDGlobalVariable(const MDGlobalVariable *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDLocalVariable(const MDLocalVariable *N,
|
||||
static void WriteDILocalVariable(const DILocalVariable *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
@ -1094,7 +1093,7 @@ static void WriteMDLocalVariable(const MDLocalVariable *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDExpression(const MDExpression *N, const ValueEnumerator &,
|
||||
static void WriteDIExpression(const DIExpression *N, const ValueEnumerator &,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
@ -1107,11 +1106,11 @@ static void WriteMDExpression(const MDExpression *N, const ValueEnumerator &,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDObjCProperty(const MDObjCProperty *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
static void WriteDIObjCProperty(const DIObjCProperty *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
Record.push_back(N->isDistinct());
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getFile()));
|
||||
@ -1125,7 +1124,7 @@ static void WriteMDObjCProperty(const MDObjCProperty *N,
|
||||
Record.clear();
|
||||
}
|
||||
|
||||
static void WriteMDImportedEntity(const MDImportedEntity *N,
|
||||
static void WriteDIImportedEntity(const DIImportedEntity *N,
|
||||
const ValueEnumerator &VE,
|
||||
BitstreamWriter &Stream,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
@ -1164,7 +1163,7 @@ static void WriteModuleMetadata(const Module *M,
|
||||
#define HANDLE_MDNODE_LEAF(CLASS) unsigned CLASS##Abbrev = 0;
|
||||
#include "llvm/IR/Metadata.def"
|
||||
|
||||
if (VE.hasMDLocation()) {
|
||||
if (VE.hasDILocation()) {
|
||||
// Abbrev for METADATA_LOCATION.
|
||||
//
|
||||
// Assume the column is usually under 128, and always output the inlined-at
|
||||
@ -1176,10 +1175,10 @@ static void WriteModuleMetadata(const Module *M,
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
|
||||
MDLocationAbbrev = Stream.EmitAbbrev(Abbv);
|
||||
DILocationAbbrev = Stream.EmitAbbrev(Abbv);
|
||||
}
|
||||
|
||||
if (VE.hasGenericDebugNode()) {
|
||||
if (VE.hasGenericDINode()) {
|
||||
// Abbrev for METADATA_GENERIC_DEBUG.
|
||||
//
|
||||
// Assume the column is usually under 128, and always output the inlined-at
|
||||
@ -1192,7 +1191,7 @@ static void WriteModuleMetadata(const Module *M,
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
|
||||
GenericDebugNodeAbbrev = Stream.EmitAbbrev(Abbv);
|
||||
GenericDINodeAbbrev = Stream.EmitAbbrev(Abbv);
|
||||
}
|
||||
|
||||
unsigned NameAbbrev = 0;
|
||||
@ -2105,7 +2104,7 @@ static void WriteFunction(const Function &F, ValueEnumerator &VE,
|
||||
|
||||
bool NeedsMetadataAttachment = F.hasMetadata();
|
||||
|
||||
MDLocation *LastDL = nullptr;
|
||||
DILocation *LastDL = nullptr;
|
||||
|
||||
// Finally, emit all the instructions, in order.
|
||||
for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
||||
@ -2120,7 +2119,7 @@ static void WriteFunction(const Function &F, ValueEnumerator &VE,
|
||||
NeedsMetadataAttachment |= I->hasMetadataOtherThanDebugLoc();
|
||||
|
||||
// If the instruction has a debug location, emit it.
|
||||
MDLocation *DL = I->getDebugLoc();
|
||||
DILocation *DL = I->getDebugLoc();
|
||||
if (!DL)
|
||||
continue;
|
||||
|
||||
|
@ -285,7 +285,7 @@ static bool isIntOrIntVectorValue(const std::pair<const Value*, unsigned> &V) {
|
||||
|
||||
ValueEnumerator::ValueEnumerator(const Module &M,
|
||||
bool ShouldPreserveUseListOrder)
|
||||
: HasMDString(false), HasMDLocation(false), HasGenericDebugNode(false),
|
||||
: HasMDString(false), HasDILocation(false), HasGenericDINode(false),
|
||||
ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {
|
||||
if (ShouldPreserveUseListOrder)
|
||||
UseListOrders = predictUseListOrder(M);
|
||||
@ -382,7 +382,7 @@ ValueEnumerator::ValueEnumerator(const Module &M,
|
||||
|
||||
// Don't enumerate the location directly -- it has a special record
|
||||
// type -- but enumerate its operands.
|
||||
if (MDLocation *L = I.getDebugLoc())
|
||||
if (DILocation *L = I.getDebugLoc())
|
||||
EnumerateMDNodeOperands(L);
|
||||
}
|
||||
}
|
||||
@ -548,8 +548,8 @@ void ValueEnumerator::EnumerateMetadata(const Metadata *MD) {
|
||||
EnumerateValue(C->getValue());
|
||||
|
||||
HasMDString |= isa<MDString>(MD);
|
||||
HasMDLocation |= isa<MDLocation>(MD);
|
||||
HasGenericDebugNode |= isa<GenericDebugNode>(MD);
|
||||
HasDILocation |= isa<DILocation>(MD);
|
||||
HasGenericDINode |= isa<GenericDINode>(MD);
|
||||
|
||||
// Replace the dummy ID inserted above with the correct one. MDValueMap may
|
||||
// have changed by inserting operands, so we need a fresh lookup here.
|
||||
|
@ -65,8 +65,8 @@ private:
|
||||
typedef DenseMap<const Metadata *, unsigned> MetadataMapType;
|
||||
MetadataMapType MDValueMap;
|
||||
bool HasMDString;
|
||||
bool HasMDLocation;
|
||||
bool HasGenericDebugNode;
|
||||
bool HasDILocation;
|
||||
bool HasGenericDINode;
|
||||
bool ShouldPreserveUseListOrder;
|
||||
|
||||
typedef DenseMap<AttributeSet, unsigned> AttributeGroupMapType;
|
||||
@ -121,8 +121,8 @@ public:
|
||||
}
|
||||
|
||||
bool hasMDString() const { return HasMDString; }
|
||||
bool hasMDLocation() const { return HasMDLocation; }
|
||||
bool hasGenericDebugNode() const { return HasGenericDebugNode; }
|
||||
bool hasDILocation() const { return HasDILocation; }
|
||||
bool hasGenericDINode() const { return HasGenericDINode; }
|
||||
|
||||
bool shouldPreserveUseListOrder() const { return ShouldPreserveUseListOrder; }
|
||||
|
||||
|
@ -668,15 +668,15 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
|
||||
raw_svector_ostream OS(Str);
|
||||
OS << "DEBUG_VALUE: ";
|
||||
|
||||
const MDLocalVariable *V = MI->getDebugVariable();
|
||||
if (auto *SP = dyn_cast<MDSubprogram>(V->getScope())) {
|
||||
const DILocalVariable *V = MI->getDebugVariable();
|
||||
if (auto *SP = dyn_cast<DISubprogram>(V->getScope())) {
|
||||
StringRef Name = SP->getDisplayName();
|
||||
if (!Name.empty())
|
||||
OS << Name << ":";
|
||||
}
|
||||
OS << V->getName();
|
||||
|
||||
const MDExpression *Expr = MI->getDebugExpression();
|
||||
const DIExpression *Expr = MI->getDebugExpression();
|
||||
if (Expr->isBitPiece())
|
||||
OS << " [bit_piece offset=" << Expr->getBitPieceOffset()
|
||||
<< " size=" << Expr->getBitPieceSize() << "]";
|
||||
|
@ -204,7 +204,7 @@ void llvm::calculateDbgValueHistory(const MachineFunction *MF,
|
||||
// Use the base variable (without any DW_OP_piece expressions)
|
||||
// as index into History. The full variables including the
|
||||
// piece expressions are attached to the MI.
|
||||
const MDLocalVariable *RawVar = MI.getDebugVariable();
|
||||
const DILocalVariable *RawVar = MI.getDebugVariable();
|
||||
assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
InlinedVariable Var(RawVar, MI.getDebugLoc()->getInlinedAt());
|
||||
|
@ -17,8 +17,8 @@ namespace llvm {
|
||||
|
||||
class MachineFunction;
|
||||
class MachineInstr;
|
||||
class MDLocalVariable;
|
||||
class MDLocation;
|
||||
class DILocalVariable;
|
||||
class DILocation;
|
||||
class TargetRegisterInfo;
|
||||
|
||||
// For each user variable, keep a list of instruction ranges where this variable
|
||||
@ -32,7 +32,7 @@ class DbgValueHistoryMap {
|
||||
public:
|
||||
typedef std::pair<const MachineInstr *, const MachineInstr *> InstrRange;
|
||||
typedef SmallVector<InstrRange, 4> InstrRanges;
|
||||
typedef std::pair<const MDLocalVariable *, const MDLocation *>
|
||||
typedef std::pair<const DILocalVariable *, const DILocation *>
|
||||
InlinedVariable;
|
||||
typedef MapVector<InlinedVariable, InstrRanges> InstrRangesMap;
|
||||
|
||||
|
@ -29,25 +29,25 @@ class DebugLocEntry {
|
||||
public:
|
||||
/// \brief A single location or constant.
|
||||
struct Value {
|
||||
Value(const MDExpression *Expr, int64_t i)
|
||||
Value(const DIExpression *Expr, int64_t i)
|
||||
: Expression(Expr), EntryKind(E_Integer) {
|
||||
Constant.Int = i;
|
||||
}
|
||||
Value(const MDExpression *Expr, const ConstantFP *CFP)
|
||||
Value(const DIExpression *Expr, const ConstantFP *CFP)
|
||||
: Expression(Expr), EntryKind(E_ConstantFP) {
|
||||
Constant.CFP = CFP;
|
||||
}
|
||||
Value(const MDExpression *Expr, const ConstantInt *CIP)
|
||||
Value(const DIExpression *Expr, const ConstantInt *CIP)
|
||||
: Expression(Expr), EntryKind(E_ConstantInt) {
|
||||
Constant.CIP = CIP;
|
||||
}
|
||||
Value(const MDExpression *Expr, MachineLocation Loc)
|
||||
Value(const DIExpression *Expr, MachineLocation Loc)
|
||||
: Expression(Expr), EntryKind(E_Location), Loc(Loc) {
|
||||
assert(cast<MDExpression>(Expr)->isValid());
|
||||
assert(cast<DIExpression>(Expr)->isValid());
|
||||
}
|
||||
|
||||
/// Any complex address location expression for this Value.
|
||||
const MDExpression *Expression;
|
||||
const DIExpression *Expression;
|
||||
|
||||
/// Type of entry that this represents.
|
||||
enum EntryType { E_Location, E_Integer, E_ConstantFP, E_ConstantInt };
|
||||
@ -72,7 +72,7 @@ public:
|
||||
const ConstantInt *getConstantInt() const { return Constant.CIP; }
|
||||
MachineLocation getLoc() const { return Loc; }
|
||||
bool isBitPiece() const { return getExpression()->isBitPiece(); }
|
||||
const MDExpression *getExpression() const { return Expression; }
|
||||
const DIExpression *getExpression() const { return Expression; }
|
||||
friend bool operator==(const Value &, const Value &);
|
||||
friend bool operator<(const Value &, const Value &);
|
||||
};
|
||||
@ -94,8 +94,8 @@ public:
|
||||
/// Return true if the merge was successful.
|
||||
bool MergeValues(const DebugLocEntry &Next) {
|
||||
if (Begin == Next.Begin) {
|
||||
auto *Expr = cast_or_null<MDExpression>(Values[0].Expression);
|
||||
auto *NextExpr = cast_or_null<MDExpression>(Next.Values[0].Expression);
|
||||
auto *Expr = cast_or_null<DIExpression>(Values[0].Expression);
|
||||
auto *NextExpr = cast_or_null<DIExpression>(Next.Values[0].Expression);
|
||||
if (Expr->isBitPiece() && NextExpr->isBitPiece()) {
|
||||
addValues(Next.Values);
|
||||
End = Next.End;
|
||||
@ -143,7 +143,7 @@ public:
|
||||
|
||||
/// \brief Lower this entry into a DWARF expression.
|
||||
void finalize(const AsmPrinter &AP, DebugLocStream &Locs,
|
||||
const MDBasicType *BT);
|
||||
const DIBasicType *BT);
|
||||
};
|
||||
|
||||
/// \brief Compare two Values for equality.
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
DwarfCompileUnit::DwarfCompileUnit(unsigned UID, const MDCompileUnit *Node,
|
||||
DwarfCompileUnit::DwarfCompileUnit(unsigned UID, const DICompileUnit *Node,
|
||||
AsmPrinter *A, DwarfDebug *DW,
|
||||
DwarfFile *DWU)
|
||||
: DwarfUnit(UID, dwarf::DW_TAG_compile_unit, Node, A, DW, DWU),
|
||||
@ -98,7 +98,7 @@ static const ConstantExpr *getMergedGlobalExpr(const Value *V) {
|
||||
|
||||
/// getOrCreateGlobalVariableDIE - get or create global variable DIE.
|
||||
DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
|
||||
const MDGlobalVariable *GV) {
|
||||
const DIGlobalVariable *GV) {
|
||||
// Check for pre-existence.
|
||||
if (DIE *Die = getDIE(GV))
|
||||
return Die;
|
||||
@ -114,7 +114,7 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
|
||||
|
||||
// Add to map.
|
||||
DIE *VariableDIE = &createAndAddDIE(GV->getTag(), *ContextDIE, GV);
|
||||
MDScope *DeclContext;
|
||||
DIScope *DeclContext;
|
||||
if (auto *SDMDecl = GV->getStaticDataMemberDeclaration()) {
|
||||
DeclContext = resolve(SDMDecl->getScope());
|
||||
assert(SDMDecl->isStaticMember() && "Expected static member decl");
|
||||
@ -277,7 +277,7 @@ void DwarfCompileUnit::attachLowHighPC(DIE &D, const MCSymbol *Begin,
|
||||
// Find DIE for the given subprogram and attach appropriate DW_AT_low_pc
|
||||
// and DW_AT_high_pc attributes. If there are global variables in this
|
||||
// scope then create and insert DIEs for these variables.
|
||||
DIE &DwarfCompileUnit::updateSubprogramScopeDIE(const MDSubprogram *SP) {
|
||||
DIE &DwarfCompileUnit::updateSubprogramScopeDIE(const DISubprogram *SP) {
|
||||
DIE *SPDie = getOrCreateSubprogramDIE(SP, includeMinimalInlineScopes());
|
||||
|
||||
attachLowHighPC(*SPDie, Asm->getFunctionBegin(), Asm->getFunctionEnd());
|
||||
@ -308,7 +308,7 @@ void DwarfCompileUnit::constructScopeDIE(
|
||||
|
||||
auto *DS = Scope->getScopeNode();
|
||||
|
||||
assert((Scope->getInlinedAt() || !isa<MDSubprogram>(DS)) &&
|
||||
assert((Scope->getInlinedAt() || !isa<DISubprogram>(DS)) &&
|
||||
"Only handle inlined subprograms here, use "
|
||||
"constructSubprogramScopeDIE for non-inlined "
|
||||
"subprograms");
|
||||
@ -319,7 +319,7 @@ void DwarfCompileUnit::constructScopeDIE(
|
||||
// avoid creating un-used children then removing them later when we find out
|
||||
// the scope DIE is null.
|
||||
std::unique_ptr<DIE> ScopeDIE;
|
||||
if (Scope->getParent() && isa<MDSubprogram>(DS)) {
|
||||
if (Scope->getParent() && isa<DISubprogram>(DS)) {
|
||||
ScopeDIE = constructInlinedScopeDIE(Scope);
|
||||
if (!ScopeDIE)
|
||||
return;
|
||||
@ -341,7 +341,7 @@ void DwarfCompileUnit::constructScopeDIE(
|
||||
// There is no need to emit empty lexical block DIE.
|
||||
for (const auto &E : DD->findImportedEntitiesForScope(DS))
|
||||
Children.push_back(
|
||||
constructImportedEntityDIE(cast<MDImportedEntity>(E.second)));
|
||||
constructImportedEntityDIE(cast<DIImportedEntity>(E.second)));
|
||||
}
|
||||
|
||||
// If there are only other scopes as children, put them directly in the
|
||||
@ -432,7 +432,7 @@ DwarfCompileUnit::constructInlinedScopeDIE(LexicalScope *Scope) {
|
||||
attachRangesOrLowHighPC(*ScopeDIE, Scope->getRanges());
|
||||
|
||||
// Add the call site information to the DIE.
|
||||
const MDLocation *IA = Scope->getInlinedAt();
|
||||
const DILocation *IA = Scope->getInlinedAt();
|
||||
addUInt(*ScopeDIE, dwarf::DW_AT_call_file, None,
|
||||
getOrCreateSourceID(IA->getFilename(), IA->getDirectory()));
|
||||
addUInt(*ScopeDIE, dwarf::DW_AT_call_line, None, IA->getLine());
|
||||
@ -563,14 +563,14 @@ void DwarfCompileUnit::constructSubprogramScopeDIE(LexicalScope *Scope) {
|
||||
assert(Scope && Scope->getScopeNode());
|
||||
assert(!Scope->getInlinedAt());
|
||||
assert(!Scope->isAbstractScope());
|
||||
auto *Sub = cast<MDSubprogram>(Scope->getScopeNode());
|
||||
auto *Sub = cast<DISubprogram>(Scope->getScopeNode());
|
||||
|
||||
DD->getProcessedSPNodes().insert(Sub);
|
||||
|
||||
DIE &ScopeDIE = updateSubprogramScopeDIE(Sub);
|
||||
|
||||
// If this is a variadic function, add an unspecified parameter.
|
||||
MDTypeRefArray FnArgs = Sub->getType()->getTypeArray();
|
||||
DITypeRefArray FnArgs = Sub->getType()->getTypeArray();
|
||||
|
||||
// Collect lexical scope children first.
|
||||
// ObjectPointer might be a local (non-argument) local variable if it's a
|
||||
@ -605,7 +605,7 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
|
||||
if (AbsDef)
|
||||
return;
|
||||
|
||||
auto *SP = cast<MDSubprogram>(Scope->getScopeNode());
|
||||
auto *SP = cast<DISubprogram>(Scope->getScopeNode());
|
||||
|
||||
DIE *ContextDIE;
|
||||
|
||||
@ -633,18 +633,18 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
|
||||
}
|
||||
|
||||
std::unique_ptr<DIE>
|
||||
DwarfCompileUnit::constructImportedEntityDIE(const MDImportedEntity *Module) {
|
||||
DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity *Module) {
|
||||
std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module->getTag());
|
||||
insertDIE(Module, IMDie.get());
|
||||
DIE *EntityDie;
|
||||
auto *Entity = resolve(Module->getEntity());
|
||||
if (auto *NS = dyn_cast<MDNamespace>(Entity))
|
||||
if (auto *NS = dyn_cast<DINamespace>(Entity))
|
||||
EntityDie = getOrCreateNameSpace(NS);
|
||||
else if (auto *SP = dyn_cast<MDSubprogram>(Entity))
|
||||
else if (auto *SP = dyn_cast<DISubprogram>(Entity))
|
||||
EntityDie = getOrCreateSubprogramDIE(SP);
|
||||
else if (auto *T = dyn_cast<MDType>(Entity))
|
||||
else if (auto *T = dyn_cast<DIType>(Entity))
|
||||
EntityDie = getOrCreateTypeDIE(T);
|
||||
else if (auto *GV = dyn_cast<MDGlobalVariable>(Entity))
|
||||
else if (auto *GV = dyn_cast<DIGlobalVariable>(Entity))
|
||||
EntityDie = getOrCreateGlobalVariableDIE(GV);
|
||||
else
|
||||
EntityDie = getDIE(Entity);
|
||||
@ -659,7 +659,7 @@ DwarfCompileUnit::constructImportedEntityDIE(const MDImportedEntity *Module) {
|
||||
return IMDie;
|
||||
}
|
||||
|
||||
void DwarfCompileUnit::finishSubprogramDefinition(const MDSubprogram *SP) {
|
||||
void DwarfCompileUnit::finishSubprogramDefinition(const DISubprogram *SP) {
|
||||
DIE *D = getDIE(SP);
|
||||
if (DIE *AbsSPDIE = DU->getAbstractSPDies().lookup(SP)) {
|
||||
if (D)
|
||||
@ -676,7 +676,7 @@ void DwarfCompileUnit::finishSubprogramDefinition(const MDSubprogram *SP) {
|
||||
applySubprogramAttributesToDefinition(SP, *D);
|
||||
}
|
||||
}
|
||||
void DwarfCompileUnit::collectDeadVariables(const MDSubprogram *SP) {
|
||||
void DwarfCompileUnit::collectDeadVariables(const DISubprogram *SP) {
|
||||
assert(SP && "CU's subprogram list contains a non-subprogram");
|
||||
assert(SP->isDefinition() &&
|
||||
"CU's subprogram list contains a subprogram declaration");
|
||||
@ -688,7 +688,7 @@ void DwarfCompileUnit::collectDeadVariables(const MDSubprogram *SP) {
|
||||
if (!SPDIE)
|
||||
SPDIE = getDIE(SP);
|
||||
assert(SPDIE);
|
||||
for (const MDLocalVariable *DV : Variables) {
|
||||
for (const DILocalVariable *DV : Variables) {
|
||||
DbgVariable NewVar(DV, /* IA */ nullptr, /* Expr */ nullptr, DD);
|
||||
auto VariableDie = constructVariableDIE(NewVar);
|
||||
applyVariableAttributes(NewVar, *VariableDie);
|
||||
@ -708,7 +708,7 @@ void DwarfCompileUnit::emitHeader(bool UseOffsets) {
|
||||
|
||||
/// addGlobalName - Add a new global name to the compile unit.
|
||||
void DwarfCompileUnit::addGlobalName(StringRef Name, DIE &Die,
|
||||
const MDScope *Context) {
|
||||
const DIScope *Context) {
|
||||
if (includeMinimalInlineScopes())
|
||||
return;
|
||||
std::string FullName = getParentContextString(Context) + Name.str();
|
||||
@ -716,8 +716,8 @@ void DwarfCompileUnit::addGlobalName(StringRef Name, DIE &Die,
|
||||
}
|
||||
|
||||
/// Add a new global type to the unit.
|
||||
void DwarfCompileUnit::addGlobalType(const MDType *Ty, const DIE &Die,
|
||||
const MDScope *Context) {
|
||||
void DwarfCompileUnit::addGlobalType(const DIType *Ty, const DIE &Die,
|
||||
const DIScope *Context) {
|
||||
if (includeMinimalInlineScopes())
|
||||
return;
|
||||
std::string FullName = getParentContextString(Context) + Ty->getName().str();
|
||||
@ -764,7 +764,7 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die,
|
||||
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
|
||||
DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
|
||||
assert(DV.getExpression().size() == 1);
|
||||
const MDExpression *Expr = DV.getExpression().back();
|
||||
const DIExpression *Expr = DV.getExpression().back();
|
||||
bool ValidReg;
|
||||
if (Location.getOffset()) {
|
||||
ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(),
|
||||
@ -807,7 +807,7 @@ void DwarfCompileUnit::addExpr(DIELoc &Die, dwarf::Form Form,
|
||||
}
|
||||
|
||||
void DwarfCompileUnit::applySubprogramAttributesToDefinition(
|
||||
const MDSubprogram *SP, DIE &SPDie) {
|
||||
const DISubprogram *SP, DIE &SPDie) {
|
||||
auto *SPDecl = SP->getDeclaration();
|
||||
auto *Context = resolve(SPDecl ? SPDecl->getScope() : SP->getScope());
|
||||
applySubprogramAttributes(SP, SPDie, includeMinimalInlineScopes());
|
||||
|
@ -66,7 +66,7 @@ class DwarfCompileUnit : public DwarfUnit {
|
||||
bool includeMinimalInlineScopes() const;
|
||||
|
||||
public:
|
||||
DwarfCompileUnit(unsigned UID, const MDCompileUnit *Node, AsmPrinter *A,
|
||||
DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A,
|
||||
DwarfDebug *DW, DwarfFile *DWU);
|
||||
|
||||
DwarfCompileUnit *getSkeleton() const {
|
||||
@ -79,7 +79,7 @@ public:
|
||||
void applyStmtList(DIE &D);
|
||||
|
||||
/// getOrCreateGlobalVariableDIE - get or create global variable DIE.
|
||||
DIE *getOrCreateGlobalVariableDIE(const MDGlobalVariable *GV);
|
||||
DIE *getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV);
|
||||
|
||||
/// addLabelAddress - Add a dwarf label attribute data and value using
|
||||
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
|
||||
@ -113,7 +113,7 @@ public:
|
||||
/// DW_AT_low_pc and DW_AT_high_pc attributes. If there are global
|
||||
/// variables in this scope then create and insert DIEs for these
|
||||
/// variables.
|
||||
DIE &updateSubprogramScopeDIE(const MDSubprogram *SP);
|
||||
DIE &updateSubprogramScopeDIE(const DISubprogram *SP);
|
||||
|
||||
void constructScopeDIE(LexicalScope *Scope,
|
||||
SmallVectorImpl<std::unique_ptr<DIE>> &FinalChildren);
|
||||
@ -156,11 +156,11 @@ public:
|
||||
|
||||
/// \brief Construct import_module DIE.
|
||||
std::unique_ptr<DIE>
|
||||
constructImportedEntityDIE(const MDImportedEntity *Module);
|
||||
constructImportedEntityDIE(const DIImportedEntity *Module);
|
||||
|
||||
void finishSubprogramDefinition(const MDSubprogram *SP);
|
||||
void finishSubprogramDefinition(const DISubprogram *SP);
|
||||
|
||||
void collectDeadVariables(const MDSubprogram *SP);
|
||||
void collectDeadVariables(const DISubprogram *SP);
|
||||
|
||||
/// Set the skeleton unit associated with this unit.
|
||||
void setSkeleton(DwarfCompileUnit &Skel) { Skeleton = &Skel; }
|
||||
@ -183,11 +183,11 @@ public:
|
||||
}
|
||||
|
||||
/// Add a new global name to the compile unit.
|
||||
void addGlobalName(StringRef Name, DIE &Die, const MDScope *Context) override;
|
||||
void addGlobalName(StringRef Name, DIE &Die, const DIScope *Context) override;
|
||||
|
||||
/// Add a new global type to the compile unit.
|
||||
void addGlobalType(const MDType *Ty, const DIE &Die,
|
||||
const MDScope *Context) override;
|
||||
void addGlobalType(const DIType *Ty, const DIE &Die,
|
||||
const DIScope *Context) override;
|
||||
|
||||
const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
|
||||
const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
|
||||
@ -215,7 +215,7 @@ public:
|
||||
/// Add a Dwarf expression attribute data and value.
|
||||
void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr);
|
||||
|
||||
void applySubprogramAttributesToDefinition(const MDSubprogram *SP,
|
||||
void applySubprogramAttributesToDefinition(const DISubprogram *SP,
|
||||
DIE &SPDie);
|
||||
|
||||
/// getRangeLists - Get the vector of range lists.
|
||||
|
@ -130,7 +130,7 @@ bool DebugLocDwarfExpression::isFrameRegister(unsigned MachineReg) {
|
||||
|
||||
/// resolve - Look in the DwarfDebug map for the MDNode that
|
||||
/// corresponds to the reference.
|
||||
template <typename T> T *DbgVariable::resolve(TypedDebugNodeRef<T> Ref) const {
|
||||
template <typename T> T *DbgVariable::resolve(TypedDINodeRef<T> Ref) const {
|
||||
return DD->resolve(Ref);
|
||||
}
|
||||
|
||||
@ -141,8 +141,8 @@ bool DbgVariable::isBlockByrefVariable() const {
|
||||
->isBlockByrefStruct();
|
||||
}
|
||||
|
||||
const MDType *DbgVariable::getType() const {
|
||||
MDType *Ty = Var->getType().resolve(DD->getTypeIdentifierMap());
|
||||
const DIType *DbgVariable::getType() const {
|
||||
DIType *Ty = Var->getType().resolve(DD->getTypeIdentifierMap());
|
||||
// FIXME: isBlockByrefVariable should be reformulated in terms of complex
|
||||
// addresses instead.
|
||||
if (Ty->isBlockByrefStruct()) {
|
||||
@ -170,15 +170,15 @@ const MDType *DbgVariable::getType() const {
|
||||
have a DW_AT_location that tells the debugger how to unwind through
|
||||
the pointers and __Block_byref_x_VarName struct to find the actual
|
||||
value of the variable. The function addBlockByrefType does this. */
|
||||
MDType *subType = Ty;
|
||||
DIType *subType = Ty;
|
||||
uint16_t tag = Ty->getTag();
|
||||
|
||||
if (tag == dwarf::DW_TAG_pointer_type)
|
||||
subType = resolve(cast<MDDerivedType>(Ty)->getBaseType());
|
||||
subType = resolve(cast<DIDerivedType>(Ty)->getBaseType());
|
||||
|
||||
auto Elements = cast<MDCompositeTypeBase>(subType)->getElements();
|
||||
auto Elements = cast<DICompositeTypeBase>(subType)->getElements();
|
||||
for (unsigned i = 0, N = Elements.size(); i < N; ++i) {
|
||||
auto *DT = cast<MDDerivedTypeBase>(Elements[i]);
|
||||
auto *DT = cast<DIDerivedTypeBase>(Elements[i]);
|
||||
if (getName() == DT->getName())
|
||||
return resolve(DT->getBaseType());
|
||||
}
|
||||
@ -277,7 +277,7 @@ static StringRef getObjCMethodName(StringRef In) {
|
||||
// TODO: Determine whether or not we should add names for programs
|
||||
// that do not have a DW_AT_name or DW_AT_linkage_name field - this
|
||||
// is only slightly different than the lookup of non-standard ObjC names.
|
||||
void DwarfDebug::addSubprogramNames(const MDSubprogram *SP, DIE &Die) {
|
||||
void DwarfDebug::addSubprogramNames(const DISubprogram *SP, DIE &Die) {
|
||||
if (!SP->isDefinition())
|
||||
return;
|
||||
addAccelName(SP->getName(), Die);
|
||||
@ -305,9 +305,9 @@ void DwarfDebug::addSubprogramNames(const MDSubprogram *SP, DIE &Die) {
|
||||
bool DwarfDebug::isSubprogramContext(const MDNode *Context) {
|
||||
if (!Context)
|
||||
return false;
|
||||
if (isa<MDSubprogram>(Context))
|
||||
if (isa<DISubprogram>(Context))
|
||||
return true;
|
||||
if (auto *T = dyn_cast<MDType>(Context))
|
||||
if (auto *T = dyn_cast<DIType>(Context))
|
||||
return isSubprogramContext(resolve(T->getScope()));
|
||||
return false;
|
||||
}
|
||||
@ -364,7 +364,7 @@ void DwarfDebug::addGnuPubAttributes(DwarfUnit &U, DIE &D) const {
|
||||
// Create new DwarfCompileUnit for the given metadata node with tag
|
||||
// DW_TAG_compile_unit.
|
||||
DwarfCompileUnit &
|
||||
DwarfDebug::constructDwarfCompileUnit(const MDCompileUnit *DIUnit) {
|
||||
DwarfDebug::constructDwarfCompileUnit(const DICompileUnit *DIUnit) {
|
||||
StringRef FN = DIUnit->getFilename();
|
||||
CompilationDir = DIUnit->getDirectory();
|
||||
|
||||
@ -422,7 +422,7 @@ DwarfDebug::constructDwarfCompileUnit(const MDCompileUnit *DIUnit) {
|
||||
}
|
||||
|
||||
void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
|
||||
const MDImportedEntity *N) {
|
||||
const DIImportedEntity *N) {
|
||||
if (DIE *D = TheCU.getOrCreateContextDIE(N->getScope()))
|
||||
D->addChild(TheCU.constructImportedEntityDIE(N));
|
||||
}
|
||||
@ -446,7 +446,7 @@ void DwarfDebug::beginModule() {
|
||||
SingleCU = CU_Nodes->getNumOperands() == 1;
|
||||
|
||||
for (MDNode *N : CU_Nodes->operands()) {
|
||||
auto *CUNode = cast<MDCompileUnit>(N);
|
||||
auto *CUNode = cast<DICompileUnit>(N);
|
||||
DwarfCompileUnit &CU = constructDwarfCompileUnit(CUNode);
|
||||
for (auto *IE : CUNode->getImportedEntities())
|
||||
ScopesWithImportedEntities.push_back(std::make_pair(IE->getScope(), IE));
|
||||
@ -462,12 +462,12 @@ void DwarfDebug::beginModule() {
|
||||
for (auto *Ty : CUNode->getEnumTypes()) {
|
||||
// The enum types array by design contains pointers to
|
||||
// MDNodes rather than DIRefs. Unique them here.
|
||||
CU.getOrCreateTypeDIE(cast<MDType>(resolve(Ty->getRef())));
|
||||
CU.getOrCreateTypeDIE(cast<DIType>(resolve(Ty->getRef())));
|
||||
}
|
||||
for (auto *Ty : CUNode->getRetainedTypes()) {
|
||||
// The retained types array by design contains pointers to
|
||||
// MDNodes rather than DIRefs. Unique them here.
|
||||
CU.getOrCreateTypeDIE(cast<MDType>(resolve(Ty->getRef())));
|
||||
CU.getOrCreateTypeDIE(cast<DIType>(resolve(Ty->getRef())));
|
||||
}
|
||||
// Emit imported_modules last so that the relevant context is already
|
||||
// available.
|
||||
@ -501,7 +501,7 @@ void DwarfDebug::finishVariableDefinitions() {
|
||||
void DwarfDebug::finishSubprogramDefinitions() {
|
||||
for (const auto &P : SPMap)
|
||||
forBothCUs(*P.second, [&](DwarfCompileUnit &CU) {
|
||||
CU.finishSubprogramDefinition(cast<MDSubprogram>(P.first));
|
||||
CU.finishSubprogramDefinition(cast<DISubprogram>(P.first));
|
||||
});
|
||||
}
|
||||
|
||||
@ -512,7 +512,7 @@ void DwarfDebug::collectDeadVariables() {
|
||||
|
||||
if (NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu")) {
|
||||
for (MDNode *N : CU_Nodes->operands()) {
|
||||
auto *TheCU = cast<MDCompileUnit>(N);
|
||||
auto *TheCU = cast<DICompileUnit>(N);
|
||||
// Construct subprogram DIE and add variables DIEs.
|
||||
DwarfCompileUnit *SPCU =
|
||||
static_cast<DwarfCompileUnit *>(CUMap.lookup(TheCU));
|
||||
@ -662,7 +662,7 @@ void DwarfDebug::endModule() {
|
||||
// Find abstract variable, if any, associated with Var.
|
||||
DbgVariable *
|
||||
DwarfDebug::getExistingAbstractVariable(InlinedVariable IV,
|
||||
const MDLocalVariable *&Cleansed) {
|
||||
const DILocalVariable *&Cleansed) {
|
||||
// More then one inlined variable corresponds to one abstract variable.
|
||||
Cleansed = IV.first;
|
||||
auto I = AbstractVariables.find(Cleansed);
|
||||
@ -672,11 +672,11 @@ DwarfDebug::getExistingAbstractVariable(InlinedVariable IV,
|
||||
}
|
||||
|
||||
DbgVariable *DwarfDebug::getExistingAbstractVariable(InlinedVariable IV) {
|
||||
const MDLocalVariable *Cleansed;
|
||||
const DILocalVariable *Cleansed;
|
||||
return getExistingAbstractVariable(IV, Cleansed);
|
||||
}
|
||||
|
||||
void DwarfDebug::createAbstractVariable(const MDLocalVariable *Var,
|
||||
void DwarfDebug::createAbstractVariable(const DILocalVariable *Var,
|
||||
LexicalScope *Scope) {
|
||||
auto AbsDbgVariable =
|
||||
make_unique<DbgVariable>(Var, /* IA */ nullptr, /* Expr */ nullptr, this);
|
||||
@ -686,22 +686,22 @@ void DwarfDebug::createAbstractVariable(const MDLocalVariable *Var,
|
||||
|
||||
void DwarfDebug::ensureAbstractVariableIsCreated(InlinedVariable IV,
|
||||
const MDNode *ScopeNode) {
|
||||
const MDLocalVariable *Cleansed = nullptr;
|
||||
const DILocalVariable *Cleansed = nullptr;
|
||||
if (getExistingAbstractVariable(IV, Cleansed))
|
||||
return;
|
||||
|
||||
createAbstractVariable(Cleansed, LScopes.getOrCreateAbstractScope(
|
||||
cast<MDLocalScope>(ScopeNode)));
|
||||
cast<DILocalScope>(ScopeNode)));
|
||||
}
|
||||
|
||||
void DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(
|
||||
InlinedVariable IV, const MDNode *ScopeNode) {
|
||||
const MDLocalVariable *Cleansed = nullptr;
|
||||
const DILocalVariable *Cleansed = nullptr;
|
||||
if (getExistingAbstractVariable(IV, Cleansed))
|
||||
return;
|
||||
|
||||
if (LexicalScope *Scope =
|
||||
LScopes.findAbstractScope(cast_or_null<MDLocalScope>(ScopeNode)))
|
||||
LScopes.findAbstractScope(cast_or_null<DILocalScope>(ScopeNode)))
|
||||
createAbstractVariable(Cleansed, Scope);
|
||||
}
|
||||
|
||||
@ -722,7 +722,7 @@ void DwarfDebug::collectVariableInfoFromMMITable(
|
||||
if (!Scope)
|
||||
continue;
|
||||
|
||||
const MDExpression *Expr = cast_or_null<MDExpression>(VI.Expr);
|
||||
const DIExpression *Expr = cast_or_null<DIExpression>(VI.Expr);
|
||||
ensureAbstractVariableIsCreatedIfScoped(Var, Scope->getScopeNode());
|
||||
auto RegVar =
|
||||
make_unique<DbgVariable>(Var.first, Var.second, Expr, this, VI.Slot);
|
||||
@ -733,7 +733,7 @@ void DwarfDebug::collectVariableInfoFromMMITable(
|
||||
|
||||
// Get .debug_loc entry for the instruction range starting at MI.
|
||||
static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) {
|
||||
const MDExpression *Expr = MI->getDebugExpression();
|
||||
const DIExpression *Expr = MI->getDebugExpression();
|
||||
|
||||
assert(MI->getNumOperands() == 4);
|
||||
if (MI->getOperand(0).isReg()) {
|
||||
@ -757,7 +757,7 @@ static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) {
|
||||
}
|
||||
|
||||
/// Determine whether two variable pieces overlap.
|
||||
static bool piecesOverlap(const MDExpression *P1, const MDExpression *P2) {
|
||||
static bool piecesOverlap(const DIExpression *P1, const DIExpression *P2) {
|
||||
if (!P1->isBitPiece() || !P2->isBitPiece())
|
||||
return true;
|
||||
unsigned l1 = P1->getBitPieceOffset();
|
||||
@ -809,7 +809,7 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
|
||||
}
|
||||
|
||||
// If this piece overlaps with any open ranges, truncate them.
|
||||
const MDExpression *DIExpr = Begin->getDebugExpression();
|
||||
const DIExpression *DIExpr = Begin->getDebugExpression();
|
||||
auto Last = std::remove_if(OpenRanges.begin(), OpenRanges.end(),
|
||||
[&](DebugLocEntry::Value R) {
|
||||
return piecesOverlap(DIExpr, R.getExpression());
|
||||
@ -874,7 +874,7 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
|
||||
|
||||
// Find variables for each lexical scope.
|
||||
void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU,
|
||||
const MDSubprogram *SP,
|
||||
const DISubprogram *SP,
|
||||
DenseSet<InlinedVariable> &Processed) {
|
||||
// Grab the variable info that was squirreled away in the MMI side-table.
|
||||
collectVariableInfoFromMMITable(Processed);
|
||||
@ -890,7 +890,7 @@ void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU,
|
||||
continue;
|
||||
|
||||
LexicalScope *Scope = nullptr;
|
||||
if (const MDLocation *IA = IV.second)
|
||||
if (const DILocation *IA = IV.second)
|
||||
Scope = LScopes.findInlinedScope(IV.first->getScope(), IA);
|
||||
else
|
||||
Scope = LScopes.findLexicalScope(IV.first->getScope());
|
||||
@ -918,10 +918,10 @@ void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU,
|
||||
SmallVector<DebugLocEntry, 8> Entries;
|
||||
buildLocationList(Entries, Ranges);
|
||||
|
||||
// If the variable has an MDBasicType, extract it. Basic types cannot have
|
||||
// If the variable has an DIBasicType, extract it. Basic types cannot have
|
||||
// unique identifiers, so don't bother resolving the type with the
|
||||
// identifier map.
|
||||
const MDBasicType *BT = dyn_cast<MDBasicType>(
|
||||
const DIBasicType *BT = dyn_cast<DIBasicType>(
|
||||
static_cast<const Metadata *>(IV.first->getType()));
|
||||
|
||||
// Finalize the entry by lowering it into a DWARF bytestream.
|
||||
@ -930,7 +930,7 @@ void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU,
|
||||
}
|
||||
|
||||
// Collect info for variables that were optimized out.
|
||||
for (const MDLocalVariable *DV : SP->getVariables()) {
|
||||
for (const DILocalVariable *DV : SP->getVariables()) {
|
||||
if (!Processed.insert(InlinedVariable(DV, nullptr)).second)
|
||||
continue;
|
||||
if (LexicalScope *Scope = LScopes.findLexicalScope(DV->getScope())) {
|
||||
@ -1128,14 +1128,14 @@ 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 MDLocalVariable *DIVar = Ranges.front().first->getDebugVariable();
|
||||
const DILocalVariable *DIVar = Ranges.front().first->getDebugVariable();
|
||||
if (DIVar->getTag() == dwarf::DW_TAG_arg_variable &&
|
||||
getDISubprogram(DIVar->getScope())->describes(MF->getFunction())) {
|
||||
LabelsBeforeInsn[Ranges.front().first] = Asm->getFunctionBegin();
|
||||
if (Ranges.front().first->getDebugExpression()->isBitPiece()) {
|
||||
// Mark all non-overlapping initial pieces.
|
||||
for (auto I = Ranges.begin(); I != Ranges.end(); ++I) {
|
||||
const MDExpression *Piece = I->first->getDebugExpression();
|
||||
const DIExpression *Piece = I->first->getDebugExpression();
|
||||
if (std::all_of(Ranges.begin(), I,
|
||||
[&](DbgValueHistoryMap::InstrRange Pred) {
|
||||
return !piecesOverlap(Piece, Pred.first->getDebugExpression());
|
||||
@ -1159,7 +1159,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
|
||||
|
||||
// Record beginning of function.
|
||||
PrologEndLoc = findPrologueEndLoc(MF);
|
||||
if (MDLocation *L = PrologEndLoc) {
|
||||
if (DILocation *L = PrologEndLoc) {
|
||||
// We'd like to list the prologue as "not statements" but GDB behaves
|
||||
// poorly if we do that. Revisit this with caution/GDB (7.5+) testing.
|
||||
auto *SP = L->getInlinedAtScope()->getSubprogram();
|
||||
@ -1186,7 +1186,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
|
||||
Asm->OutStreamer->getContext().setDwarfCompileUnitID(0);
|
||||
|
||||
LexicalScope *FnScope = LScopes.getCurrentFunctionScope();
|
||||
auto *SP = cast<MDSubprogram>(FnScope->getScopeNode());
|
||||
auto *SP = cast<DISubprogram>(FnScope->getScopeNode());
|
||||
DwarfCompileUnit &TheCU = *SPMap.lookup(SP);
|
||||
|
||||
DenseSet<InlinedVariable> ProcessedVars;
|
||||
@ -1216,9 +1216,9 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
|
||||
#endif
|
||||
// Construct abstract scopes.
|
||||
for (LexicalScope *AScope : LScopes.getAbstractScopesList()) {
|
||||
auto *SP = cast<MDSubprogram>(AScope->getScopeNode());
|
||||
auto *SP = cast<DISubprogram>(AScope->getScopeNode());
|
||||
// Collect info for variables that were optimized out.
|
||||
for (const MDLocalVariable *DV : SP->getVariables()) {
|
||||
for (const DILocalVariable *DV : SP->getVariables()) {
|
||||
if (!ProcessedVars.insert(InlinedVariable(DV, nullptr)).second)
|
||||
continue;
|
||||
ensureAbstractVariableIsCreated(InlinedVariable(DV, nullptr),
|
||||
@ -1254,10 +1254,10 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S,
|
||||
StringRef Dir;
|
||||
unsigned Src = 1;
|
||||
unsigned Discriminator = 0;
|
||||
if (auto *Scope = cast_or_null<MDScope>(S)) {
|
||||
if (auto *Scope = cast_or_null<DIScope>(S)) {
|
||||
Fn = Scope->getFilename();
|
||||
Dir = Scope->getDirectory();
|
||||
if (auto *LBF = dyn_cast<MDLexicalBlockFile>(Scope))
|
||||
if (auto *LBF = dyn_cast<DILexicalBlockFile>(Scope))
|
||||
Discriminator = LBF->getDiscriminator();
|
||||
|
||||
unsigned CUID = Asm->OutStreamer->getContext().getDwarfCompileUnitID();
|
||||
@ -1471,7 +1471,7 @@ void DwarfDebug::emitDebugLocEntry(ByteStreamer &Streamer,
|
||||
Streamer.EmitInt8(Byte, Comment != End ? *(Comment++) : "");
|
||||
}
|
||||
|
||||
static void emitDebugLocValue(const AsmPrinter &AP, const MDBasicType *BT,
|
||||
static void emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT,
|
||||
ByteStreamer &Streamer,
|
||||
const DebugLocEntry::Value &Value,
|
||||
unsigned PieceOffsetInBits) {
|
||||
@ -1487,7 +1487,7 @@ static void emitDebugLocValue(const AsmPrinter &AP, const MDBasicType *BT,
|
||||
DwarfExpr.AddUnsignedConstant(Value.getInt());
|
||||
} else if (Value.isLocation()) {
|
||||
MachineLocation Loc = Value.getLoc();
|
||||
const MDExpression *Expr = Value.getExpression();
|
||||
const DIExpression *Expr = Value.getExpression();
|
||||
if (!Expr || !Expr->getNumElements())
|
||||
// Regular entry.
|
||||
AP.EmitDwarfRegOp(Streamer, Loc);
|
||||
@ -1508,7 +1508,7 @@ static void emitDebugLocValue(const AsmPrinter &AP, const MDBasicType *BT,
|
||||
}
|
||||
|
||||
void DebugLocEntry::finalize(const AsmPrinter &AP, DebugLocStream &Locs,
|
||||
const MDBasicType *BT) {
|
||||
const DIBasicType *BT) {
|
||||
Locs.startEntry(Begin, End);
|
||||
BufferByteStreamer Streamer = Locs.getStreamer();
|
||||
const DebugLocEntry::Value &Value = Values[0];
|
||||
@ -1522,7 +1522,7 @@ void DebugLocEntry::finalize(const AsmPrinter &AP, DebugLocStream &Locs,
|
||||
|
||||
unsigned Offset = 0;
|
||||
for (auto Piece : Values) {
|
||||
const MDExpression *Expr = Piece.getExpression();
|
||||
const DIExpression *Expr = Piece.getExpression();
|
||||
unsigned PieceOffset = Expr->getBitPieceOffset();
|
||||
unsigned PieceSize = Expr->getBitPieceSize();
|
||||
assert(Offset <= PieceOffset && "overlapping or duplicate pieces");
|
||||
@ -1903,7 +1903,7 @@ static uint64_t makeTypeSignature(StringRef Identifier) {
|
||||
|
||||
void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
|
||||
StringRef Identifier, DIE &RefDie,
|
||||
const MDCompositeType *CTy) {
|
||||
const DICompositeType *CTy) {
|
||||
// Fast path if we're building some type units and one has already used the
|
||||
// address pool we know we're going to throw away all this work anyway, so
|
||||
// don't bother building dependent types.
|
||||
@ -1962,7 +1962,7 @@ void DwarfDebug::addDwarfTypeUnitType(DwarfCompileUnit &CU,
|
||||
// This is inefficient because all the dependent types will be rebuilt
|
||||
// from scratch, including building them in type units, discovering that
|
||||
// they depend on addresses, throwing them out and rebuilding them.
|
||||
CU.constructTypeDIE(RefDie, cast<MDCompositeType>(CTy));
|
||||
CU.constructTypeDIE(RefDie, cast<DICompositeType>(CTy));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -75,9 +75,9 @@ public:
|
||||
/// - Variables that are described by multiple MMI table entries have multiple
|
||||
/// expressions and frame indices.
|
||||
class DbgVariable {
|
||||
const MDLocalVariable *Var; /// Variable Descriptor.
|
||||
const MDLocation *IA; /// Inlined at location.
|
||||
SmallVector<const MDExpression *, 1>
|
||||
const DILocalVariable *Var; /// Variable Descriptor.
|
||||
const DILocation *IA; /// Inlined at location.
|
||||
SmallVector<const DIExpression *, 1>
|
||||
Expr; /// Complex address location expression.
|
||||
DIE *TheDIE; /// Variable DIE.
|
||||
unsigned DebugLocListIndex; /// Offset in DebugLocs.
|
||||
@ -87,8 +87,8 @@ class DbgVariable {
|
||||
|
||||
public:
|
||||
/// Construct a DbgVariable from a variable.
|
||||
DbgVariable(const MDLocalVariable *V, const MDLocation *IA,
|
||||
const MDExpression *E, DwarfDebug *DD, int FI = ~0)
|
||||
DbgVariable(const DILocalVariable *V, const DILocation *IA,
|
||||
const DIExpression *E, DwarfDebug *DD, int FI = ~0)
|
||||
: Var(V), IA(IA), Expr(1, E), TheDIE(nullptr), DebugLocListIndex(~0U),
|
||||
MInsn(nullptr), DD(DD) {
|
||||
FrameIndex.push_back(FI);
|
||||
@ -106,9 +106,9 @@ public:
|
||||
}
|
||||
|
||||
// Accessors.
|
||||
const MDLocalVariable *getVariable() const { return Var; }
|
||||
const MDLocation *getInlinedAt() const { return IA; }
|
||||
const ArrayRef<const MDExpression *> getExpression() const { return Expr; }
|
||||
const DILocalVariable *getVariable() const { return Var; }
|
||||
const DILocation *getInlinedAt() const { return IA; }
|
||||
const ArrayRef<const DIExpression *> getExpression() const { return Expr; }
|
||||
void setDIE(DIE &D) { TheDIE = &D; }
|
||||
DIE *getDIE() const { return TheDIE; }
|
||||
void setDebugLocListIndex(unsigned O) { DebugLocListIndex = O; }
|
||||
@ -130,7 +130,7 @@ public:
|
||||
FrameIndex.append(FI.begin(), FI.end());
|
||||
}
|
||||
assert(Expr.size() > 1 ? std::all_of(Expr.begin(), Expr.end(),
|
||||
[](const MDExpression *E) {
|
||||
[](const DIExpression *E) {
|
||||
return E->isBitPiece();
|
||||
})
|
||||
: (true && "conflicting locations for variable"));
|
||||
@ -167,12 +167,12 @@ public:
|
||||
return Expr.back()->getNumElements() > 0;
|
||||
}
|
||||
bool isBlockByrefVariable() const;
|
||||
const MDType *getType() const;
|
||||
const DIType *getType() const;
|
||||
|
||||
private:
|
||||
/// resolve - Look in the DwarfDebug map for the MDNode that
|
||||
/// corresponds to the reference.
|
||||
template <typename T> T *resolve(TypedDebugNodeRef<T> Ref) const;
|
||||
template <typename T> T *resolve(TypedDINodeRef<T> Ref) const;
|
||||
};
|
||||
|
||||
|
||||
@ -271,7 +271,7 @@ class DwarfDebug : public AsmPrinterHandler {
|
||||
DenseMap<const MDNode *, const DwarfTypeUnit *> DwarfTypeUnits;
|
||||
|
||||
SmallVector<
|
||||
std::pair<std::unique_ptr<DwarfTypeUnit>, const MDCompositeType *>, 1>
|
||||
std::pair<std::unique_ptr<DwarfTypeUnit>, const DICompositeType *>, 1>
|
||||
TypeUnitsUnderConstruction;
|
||||
|
||||
// Whether to emit the pubnames/pubtypes sections.
|
||||
@ -324,7 +324,7 @@ class DwarfDebug : public AsmPrinterHandler {
|
||||
DwarfAccelTable AccelNamespace;
|
||||
DwarfAccelTable AccelTypes;
|
||||
|
||||
DenseMap<const Function *, MDSubprogram *> FunctionDIs;
|
||||
DenseMap<const Function *, DISubprogram *> FunctionDIs;
|
||||
|
||||
MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
|
||||
|
||||
@ -336,9 +336,9 @@ class DwarfDebug : public AsmPrinterHandler {
|
||||
|
||||
/// \brief Find abstract variable associated with Var.
|
||||
DbgVariable *getExistingAbstractVariable(InlinedVariable IV,
|
||||
const MDLocalVariable *&Cleansed);
|
||||
const DILocalVariable *&Cleansed);
|
||||
DbgVariable *getExistingAbstractVariable(InlinedVariable IV);
|
||||
void createAbstractVariable(const MDLocalVariable *DV, LexicalScope *Scope);
|
||||
void createAbstractVariable(const DILocalVariable *DV, LexicalScope *Scope);
|
||||
void ensureAbstractVariableIsCreated(InlinedVariable Var,
|
||||
const MDNode *Scope);
|
||||
void ensureAbstractVariableIsCreatedIfScoped(InlinedVariable Var,
|
||||
@ -453,11 +453,11 @@ class DwarfDebug : public AsmPrinterHandler {
|
||||
|
||||
/// \brief Create new DwarfCompileUnit for the given metadata node with tag
|
||||
/// DW_TAG_compile_unit.
|
||||
DwarfCompileUnit &constructDwarfCompileUnit(const MDCompileUnit *DIUnit);
|
||||
DwarfCompileUnit &constructDwarfCompileUnit(const DICompileUnit *DIUnit);
|
||||
|
||||
/// \brief Construct imported_module or imported_declaration DIE.
|
||||
void constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
|
||||
const MDImportedEntity *N);
|
||||
const DIImportedEntity *N);
|
||||
|
||||
/// \brief Register a source line with debug info. Returns the unique
|
||||
/// label that was emitted and which provides correspondence to the
|
||||
@ -470,7 +470,7 @@ class DwarfDebug : public AsmPrinterHandler {
|
||||
void identifyScopeMarkers();
|
||||
|
||||
/// \brief Populate LexicalScope entries with variables' info.
|
||||
void collectVariableInfo(DwarfCompileUnit &TheCU, const MDSubprogram *SP,
|
||||
void collectVariableInfo(DwarfCompileUnit &TheCU, const DISubprogram *SP,
|
||||
DenseSet<InlinedVariable> &ProcessedVars);
|
||||
|
||||
/// \brief Build the location list for all DBG_VALUEs in the
|
||||
@ -522,7 +522,7 @@ public:
|
||||
/// \brief Add a DIE to the set of types that we're going to pull into
|
||||
/// type units.
|
||||
void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,
|
||||
DIE &Die, const MDCompositeType *CTy);
|
||||
DIE &Die, const DICompositeType *CTy);
|
||||
|
||||
/// \brief Add a label so that arange data can be generated for it.
|
||||
void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); }
|
||||
@ -566,7 +566,7 @@ public:
|
||||
void emitDebugLocEntryLocation(const DebugLocStream::Entry &Entry);
|
||||
|
||||
/// Find the MDNode for the given reference.
|
||||
template <typename T> T *resolve(TypedDebugNodeRef<T> Ref) const {
|
||||
template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
|
||||
return Ref.resolve(TypeIdentifierMap);
|
||||
}
|
||||
|
||||
@ -583,7 +583,7 @@ public:
|
||||
/// or another context nested inside a subprogram.
|
||||
bool isSubprogramContext(const MDNode *Context);
|
||||
|
||||
void addSubprogramNames(const MDSubprogram *SP, DIE &Die);
|
||||
void addSubprogramNames(const DISubprogram *SP, DIE &Die);
|
||||
|
||||
AddressPool &getAddressPool() { return AddrPool; }
|
||||
|
||||
|
@ -192,7 +192,7 @@ static unsigned getOffsetOrZero(unsigned OffsetInBits,
|
||||
return OffsetInBits;
|
||||
}
|
||||
|
||||
bool DwarfExpression::AddMachineRegExpression(const MDExpression *Expr,
|
||||
bool DwarfExpression::AddMachineRegExpression(const DIExpression *Expr,
|
||||
unsigned MachineReg,
|
||||
unsigned PieceOffsetInBits) {
|
||||
auto I = Expr->expr_op_begin();
|
||||
@ -240,8 +240,8 @@ bool DwarfExpression::AddMachineRegExpression(const MDExpression *Expr,
|
||||
return true;
|
||||
}
|
||||
|
||||
void DwarfExpression::AddExpression(MDExpression::expr_op_iterator I,
|
||||
MDExpression::expr_op_iterator E,
|
||||
void DwarfExpression::AddExpression(DIExpression::expr_op_iterator I,
|
||||
DIExpression::expr_op_iterator E,
|
||||
unsigned PieceOffsetInBits) {
|
||||
for (; I != E; ++I) {
|
||||
switch (I->getOp()) {
|
||||
|
@ -93,13 +93,13 @@ public:
|
||||
/// \param PieceOffsetInBits If this is one piece out of a fragmented
|
||||
/// location, this is the offset of the piece inside the entire variable.
|
||||
/// \return false if no DWARF register exists for MachineReg.
|
||||
bool AddMachineRegExpression(const MDExpression *Expr, unsigned MachineReg,
|
||||
bool AddMachineRegExpression(const DIExpression *Expr, unsigned MachineReg,
|
||||
unsigned PieceOffsetInBits = 0);
|
||||
/// Emit a the operations remaining the DIExpressionIterator I.
|
||||
/// \param PieceOffsetInBits If this is one piece out of a fragmented
|
||||
/// location, this is the offset of the piece inside the entire variable.
|
||||
void AddExpression(MDExpression::expr_op_iterator I,
|
||||
MDExpression::expr_op_iterator E,
|
||||
void AddExpression(DIExpression::expr_op_iterator I,
|
||||
DIExpression::expr_op_iterator E,
|
||||
unsigned PieceOffsetInBits = 0);
|
||||
};
|
||||
|
||||
|
@ -137,7 +137,7 @@ void DwarfFile::emitStrings(const MCSection *StrSection,
|
||||
|
||||
bool DwarfFile::addScopeVariable(LexicalScope *LS, DbgVariable *Var) {
|
||||
SmallVectorImpl<DbgVariable *> &Vars = ScopeVariables[LS];
|
||||
const MDLocalVariable *DV = Var->getVariable();
|
||||
const DILocalVariable *DV = Var->getVariable();
|
||||
// Variables with positive arg numbers are parameters.
|
||||
if (unsigned ArgNum = DV->getArg()) {
|
||||
// Keep all parameters in order at the start of the variable list to ensure
|
||||
|
@ -56,7 +56,7 @@ class DwarfFile {
|
||||
/// Maps MDNodes for type system with the corresponding DIEs. These DIEs can
|
||||
/// be shared across CUs, that is why we keep the map here instead
|
||||
/// of in DwarfCompileUnit.
|
||||
DenseMap<const MDNode *, DIE *> MDTypeNodeToDieMap;
|
||||
DenseMap<const MDNode *, DIE *> DITypeNodeToDieMap;
|
||||
|
||||
public:
|
||||
DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator &DA);
|
||||
@ -103,10 +103,10 @@ public:
|
||||
}
|
||||
|
||||
void insertDIE(const MDNode *TypeMD, DIE *Die) {
|
||||
MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
|
||||
DITypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
|
||||
}
|
||||
DIE *getDIE(const MDNode *TypeMD) {
|
||||
return MDTypeNodeToDieMap.lookup(TypeMD);
|
||||
return DITypeNodeToDieMap.lookup(TypeMD);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ bool DIEDwarfExpression::isFrameRegister(unsigned MachineReg) {
|
||||
}
|
||||
|
||||
DwarfUnit::DwarfUnit(unsigned UID, dwarf::Tag UnitTag,
|
||||
const MDCompileUnit *Node, AsmPrinter *A, DwarfDebug *DW,
|
||||
const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW,
|
||||
DwarfFile *DWU)
|
||||
: UniqueID(UID), CUNode(Node), UnitDie(UnitTag), DebugInfoOffset(0), Asm(A),
|
||||
DD(DW), DU(DWU), IndexTyDie(nullptr), Section(nullptr) {
|
||||
@ -161,7 +161,7 @@ int64_t DwarfUnit::getDefaultLowerBound() const {
|
||||
}
|
||||
|
||||
/// Check whether the DIE for this MDNode can be shared across CUs.
|
||||
static bool isShareableAcrossCUs(const DebugNode *D) {
|
||||
static bool isShareableAcrossCUs(const DINode *D) {
|
||||
// When the MDNode can be part of the type system, the DIE can be shared
|
||||
// across CUs.
|
||||
// Combining type units and cross-CU DIE sharing is lower value (since
|
||||
@ -169,18 +169,18 @@ static bool isShareableAcrossCUs(const DebugNode *D) {
|
||||
// level already) but may be implementable for some value in projects
|
||||
// building multiple independent libraries with LTO and then linking those
|
||||
// together.
|
||||
return (isa<MDType>(D) ||
|
||||
(isa<MDSubprogram>(D) && !cast<MDSubprogram>(D)->isDefinition())) &&
|
||||
return (isa<DIType>(D) ||
|
||||
(isa<DISubprogram>(D) && !cast<DISubprogram>(D)->isDefinition())) &&
|
||||
!GenerateDwarfTypeUnits;
|
||||
}
|
||||
|
||||
DIE *DwarfUnit::getDIE(const DebugNode *D) const {
|
||||
DIE *DwarfUnit::getDIE(const DINode *D) const {
|
||||
if (isShareableAcrossCUs(D))
|
||||
return DU->getDIE(D);
|
||||
return MDNodeToDieMap.lookup(D);
|
||||
}
|
||||
|
||||
void DwarfUnit::insertDIE(const DebugNode *Desc, DIE *D) {
|
||||
void DwarfUnit::insertDIE(const DINode *Desc, DIE *D) {
|
||||
if (isShareableAcrossCUs(Desc)) {
|
||||
DU->insertDIE(Desc, D);
|
||||
return;
|
||||
@ -320,7 +320,7 @@ void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,
|
||||
Entry);
|
||||
}
|
||||
|
||||
DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DebugNode *N) {
|
||||
DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N) {
|
||||
assert(Tag != dwarf::DW_TAG_auto_variable &&
|
||||
Tag != dwarf::DW_TAG_arg_variable);
|
||||
Parent.addChild(make_unique<DIE>((dwarf::Tag)Tag));
|
||||
@ -354,38 +354,38 @@ void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, StringRef File,
|
||||
addUInt(Die, dwarf::DW_AT_decl_line, None, Line);
|
||||
}
|
||||
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const MDLocalVariable *V) {
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const DILocalVariable *V) {
|
||||
assert(V);
|
||||
|
||||
addSourceLine(Die, V->getLine(), V->getScope()->getFilename(),
|
||||
V->getScope()->getDirectory());
|
||||
}
|
||||
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const MDGlobalVariable *G) {
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const DIGlobalVariable *G) {
|
||||
assert(G);
|
||||
|
||||
addSourceLine(Die, G->getLine(), G->getFilename(), G->getDirectory());
|
||||
}
|
||||
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const MDSubprogram *SP) {
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const DISubprogram *SP) {
|
||||
assert(SP);
|
||||
|
||||
addSourceLine(Die, SP->getLine(), SP->getFilename(), SP->getDirectory());
|
||||
}
|
||||
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const MDType *Ty) {
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const DIType *Ty) {
|
||||
assert(Ty);
|
||||
|
||||
addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory());
|
||||
}
|
||||
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const MDObjCProperty *Ty) {
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const DIObjCProperty *Ty) {
|
||||
assert(Ty);
|
||||
|
||||
addSourceLine(Die, Ty->getLine(), Ty->getFilename(), Ty->getDirectory());
|
||||
}
|
||||
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const MDNamespace *NS) {
|
||||
void DwarfUnit::addSourceLine(DIE &Die, const DINamespace *NS) {
|
||||
addSourceLine(Die, NS->getLine(), NS->getFilename(), NS->getDirectory());
|
||||
}
|
||||
|
||||
@ -459,27 +459,27 @@ bool DwarfUnit::addRegisterOffset(DIELoc &TheDie, unsigned Reg,
|
||||
void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE &Die,
|
||||
dwarf::Attribute Attribute,
|
||||
const MachineLocation &Location) {
|
||||
const MDType *Ty = DV.getType();
|
||||
const MDType *TmpTy = Ty;
|
||||
const DIType *Ty = DV.getType();
|
||||
const DIType *TmpTy = Ty;
|
||||
uint16_t Tag = Ty->getTag();
|
||||
bool isPointer = false;
|
||||
|
||||
StringRef varName = DV.getName();
|
||||
|
||||
if (Tag == dwarf::DW_TAG_pointer_type) {
|
||||
auto *DTy = cast<MDDerivedType>(Ty);
|
||||
auto *DTy = cast<DIDerivedType>(Ty);
|
||||
TmpTy = resolve(DTy->getBaseType());
|
||||
isPointer = true;
|
||||
}
|
||||
|
||||
// Find the __forwarding field and the variable field in the __Block_byref
|
||||
// struct.
|
||||
DebugNodeArray Fields = cast<MDCompositeTypeBase>(TmpTy)->getElements();
|
||||
const MDDerivedType *varField = nullptr;
|
||||
const MDDerivedType *forwardingField = nullptr;
|
||||
DINodeArray Fields = cast<DICompositeTypeBase>(TmpTy)->getElements();
|
||||
const DIDerivedType *varField = nullptr;
|
||||
const DIDerivedType *forwardingField = nullptr;
|
||||
|
||||
for (unsigned i = 0, N = Fields.size(); i < N; ++i) {
|
||||
auto *DT = cast<MDDerivedType>(Fields[i]);
|
||||
auto *DT = cast<DIDerivedType>(Fields[i]);
|
||||
StringRef fieldName = DT->getName();
|
||||
if (fieldName == "__forwarding")
|
||||
forwardingField = DT;
|
||||
@ -534,8 +534,8 @@ void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE &Die,
|
||||
}
|
||||
|
||||
/// Return true if type encoding is unsigned.
|
||||
static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) {
|
||||
if (auto *DTy = dyn_cast<MDDerivedTypeBase>(Ty)) {
|
||||
static bool isUnsignedDIType(DwarfDebug *DD, const DIType *Ty) {
|
||||
if (auto *DTy = dyn_cast<DIDerivedTypeBase>(Ty)) {
|
||||
dwarf::Tag T = (dwarf::Tag)Ty->getTag();
|
||||
// Encode pointer constants as unsigned bytes. This is used at least for
|
||||
// null pointer constant emission.
|
||||
@ -557,7 +557,7 @@ static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) {
|
||||
T == dwarf::DW_TAG_volatile_type ||
|
||||
T == dwarf::DW_TAG_restrict_type ||
|
||||
T == dwarf::DW_TAG_enumeration_type);
|
||||
if (MDTypeRef Deriv = DTy->getBaseType())
|
||||
if (DITypeRef Deriv = DTy->getBaseType())
|
||||
return isUnsignedDIType(DD, DD->resolve(Deriv));
|
||||
// FIXME: Enums without a fixed underlying type have unknown signedness
|
||||
// here, leading to incorrectly emitted constants.
|
||||
@ -565,7 +565,7 @@ static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto *BTy = cast<MDBasicType>(Ty);
|
||||
auto *BTy = cast<DIBasicType>(Ty);
|
||||
unsigned Encoding = BTy->getEncoding();
|
||||
assert((Encoding == dwarf::DW_ATE_unsigned ||
|
||||
Encoding == dwarf::DW_ATE_unsigned_char ||
|
||||
@ -583,7 +583,7 @@ static bool isUnsignedDIType(DwarfDebug *DD, const MDType *Ty) {
|
||||
}
|
||||
|
||||
/// If this type is derived from a base type then return base type size.
|
||||
static uint64_t getBaseTypeSize(DwarfDebug *DD, const MDDerivedType *Ty) {
|
||||
static uint64_t getBaseTypeSize(DwarfDebug *DD, const DIDerivedType *Ty) {
|
||||
unsigned Tag = Ty->getTag();
|
||||
|
||||
if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
|
||||
@ -602,7 +602,7 @@ static uint64_t getBaseTypeSize(DwarfDebug *DD, const MDDerivedType *Ty) {
|
||||
BaseType->getTag() == dwarf::DW_TAG_rvalue_reference_type)
|
||||
return Ty->getSizeInBits();
|
||||
|
||||
if (auto *DT = dyn_cast<MDDerivedType>(BaseType))
|
||||
if (auto *DT = dyn_cast<DIDerivedType>(BaseType))
|
||||
return getBaseTypeSize(DD, DT);
|
||||
|
||||
return BaseType->getSizeInBits();
|
||||
@ -636,12 +636,12 @@ void DwarfUnit::addConstantFPValue(DIE &Die, const ConstantFP *CFP) {
|
||||
}
|
||||
|
||||
void DwarfUnit::addConstantValue(DIE &Die, const ConstantInt *CI,
|
||||
const MDType *Ty) {
|
||||
const DIType *Ty) {
|
||||
addConstantValue(Die, CI->getValue(), Ty);
|
||||
}
|
||||
|
||||
void DwarfUnit::addConstantValue(DIE &Die, const MachineOperand &MO,
|
||||
const MDType *Ty) {
|
||||
const DIType *Ty) {
|
||||
assert(MO.isImm() && "Invalid machine operand!");
|
||||
|
||||
addConstantValue(Die, isUnsignedDIType(DD, Ty), MO.getImm());
|
||||
@ -654,7 +654,7 @@ void DwarfUnit::addConstantValue(DIE &Die, bool Unsigned, uint64_t Val) {
|
||||
Unsigned ? dwarf::DW_FORM_udata : dwarf::DW_FORM_sdata, Val);
|
||||
}
|
||||
|
||||
void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, const MDType *Ty) {
|
||||
void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty) {
|
||||
addConstantValue(Die, Val, isUnsignedDIType(DD, Ty));
|
||||
}
|
||||
|
||||
@ -695,29 +695,29 @@ void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) {
|
||||
GlobalValue::getRealLinkageName(LinkageName));
|
||||
}
|
||||
|
||||
void DwarfUnit::addTemplateParams(DIE &Buffer, DebugNodeArray TParams) {
|
||||
void DwarfUnit::addTemplateParams(DIE &Buffer, DINodeArray TParams) {
|
||||
// Add template parameters.
|
||||
for (const auto *Element : TParams) {
|
||||
if (auto *TTP = dyn_cast<MDTemplateTypeParameter>(Element))
|
||||
if (auto *TTP = dyn_cast<DITemplateTypeParameter>(Element))
|
||||
constructTemplateTypeParameterDIE(Buffer, TTP);
|
||||
else if (auto *TVP = dyn_cast<MDTemplateValueParameter>(Element))
|
||||
else if (auto *TVP = dyn_cast<DITemplateValueParameter>(Element))
|
||||
constructTemplateValueParameterDIE(Buffer, TVP);
|
||||
}
|
||||
}
|
||||
|
||||
DIE *DwarfUnit::getOrCreateContextDIE(const MDScope *Context) {
|
||||
if (!Context || isa<MDFile>(Context))
|
||||
DIE *DwarfUnit::getOrCreateContextDIE(const DIScope *Context) {
|
||||
if (!Context || isa<DIFile>(Context))
|
||||
return &getUnitDie();
|
||||
if (auto *T = dyn_cast<MDType>(Context))
|
||||
if (auto *T = dyn_cast<DIType>(Context))
|
||||
return getOrCreateTypeDIE(T);
|
||||
if (auto *NS = dyn_cast<MDNamespace>(Context))
|
||||
if (auto *NS = dyn_cast<DINamespace>(Context))
|
||||
return getOrCreateNameSpace(NS);
|
||||
if (auto *SP = dyn_cast<MDSubprogram>(Context))
|
||||
if (auto *SP = dyn_cast<DISubprogram>(Context))
|
||||
return getOrCreateSubprogramDIE(SP);
|
||||
return getDIE(Context);
|
||||
}
|
||||
|
||||
DIE *DwarfUnit::createTypeDIE(const MDCompositeType *Ty) {
|
||||
DIE *DwarfUnit::createTypeDIE(const DICompositeType *Ty) {
|
||||
auto *Context = resolve(Ty->getScope());
|
||||
DIE *ContextDIE = getOrCreateContextDIE(Context);
|
||||
|
||||
@ -727,7 +727,7 @@ DIE *DwarfUnit::createTypeDIE(const MDCompositeType *Ty) {
|
||||
// Create new type.
|
||||
DIE &TyDIE = createAndAddDIE(Ty->getTag(), *ContextDIE, Ty);
|
||||
|
||||
constructTypeDIE(TyDIE, cast<MDCompositeType>(Ty));
|
||||
constructTypeDIE(TyDIE, cast<DICompositeType>(Ty));
|
||||
|
||||
updateAcceleratorTables(Context, Ty, TyDIE);
|
||||
return &TyDIE;
|
||||
@ -737,14 +737,13 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
|
||||
if (!TyNode)
|
||||
return nullptr;
|
||||
|
||||
auto *Ty = cast<MDType>(TyNode);
|
||||
auto *Ty = cast<DIType>(TyNode);
|
||||
assert(Ty == resolve(Ty->getRef()) &&
|
||||
"type was not uniqued, possible ODR violation.");
|
||||
|
||||
// DW_TAG_restrict_type is not supported in DWARF2
|
||||
if (Ty->getTag() == dwarf::DW_TAG_restrict_type && DD->getDwarfVersion() <= 2)
|
||||
return getOrCreateTypeDIE(
|
||||
resolve(cast<MDDerivedType>(Ty)->getBaseType()));
|
||||
return getOrCreateTypeDIE(resolve(cast<DIDerivedType>(Ty)->getBaseType()));
|
||||
|
||||
// Construct the context before querying for the existence of the DIE in case
|
||||
// such construction creates the DIE.
|
||||
@ -760,11 +759,11 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
|
||||
|
||||
updateAcceleratorTables(Context, Ty, TyDIE);
|
||||
|
||||
if (auto *BT = dyn_cast<MDBasicType>(Ty))
|
||||
if (auto *BT = dyn_cast<DIBasicType>(Ty))
|
||||
constructTypeDIE(TyDIE, BT);
|
||||
else if (auto *STy = dyn_cast<MDSubroutineType>(Ty))
|
||||
else if (auto *STy = dyn_cast<DISubroutineType>(Ty))
|
||||
constructTypeDIE(TyDIE, STy);
|
||||
else if (auto *CTy = dyn_cast<MDCompositeType>(Ty)) {
|
||||
else if (auto *CTy = dyn_cast<DICompositeType>(Ty)) {
|
||||
if (GenerateDwarfTypeUnits && !Ty->isForwardDecl())
|
||||
if (MDString *TypeId = CTy->getRawIdentifier()) {
|
||||
DD->addDwarfTypeUnitType(getCU(), TypeId->getString(), TyDIE, CTy);
|
||||
@ -773,17 +772,17 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
|
||||
}
|
||||
constructTypeDIE(TyDIE, CTy);
|
||||
} else {
|
||||
constructTypeDIE(TyDIE, cast<MDDerivedType>(Ty));
|
||||
constructTypeDIE(TyDIE, cast<DIDerivedType>(Ty));
|
||||
}
|
||||
|
||||
return &TyDIE;
|
||||
}
|
||||
|
||||
void DwarfUnit::updateAcceleratorTables(const MDScope *Context,
|
||||
const MDType *Ty, const DIE &TyDIE) {
|
||||
void DwarfUnit::updateAcceleratorTables(const DIScope *Context,
|
||||
const DIType *Ty, const DIE &TyDIE) {
|
||||
if (!Ty->getName().empty() && !Ty->isForwardDecl()) {
|
||||
bool IsImplementation = 0;
|
||||
if (auto *CT = dyn_cast<MDCompositeTypeBase>(Ty)) {
|
||||
if (auto *CT = dyn_cast<DICompositeTypeBase>(Ty)) {
|
||||
// A runtime language of 0 actually means C/C++ and that any
|
||||
// non-negative value is some version of Objective-C/C++.
|
||||
IsImplementation = CT->getRuntimeLang() == 0 || CT->isObjcClassComplete();
|
||||
@ -791,13 +790,13 @@ void DwarfUnit::updateAcceleratorTables(const MDScope *Context,
|
||||
unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0;
|
||||
DD->addAccelType(Ty->getName(), TyDIE, Flags);
|
||||
|
||||
if (!Context || isa<MDCompileUnit>(Context) || isa<MDFile>(Context) ||
|
||||
isa<MDNamespace>(Context))
|
||||
if (!Context || isa<DICompileUnit>(Context) || isa<DIFile>(Context) ||
|
||||
isa<DINamespace>(Context))
|
||||
addGlobalType(Ty, TyDIE, Context);
|
||||
}
|
||||
}
|
||||
|
||||
void DwarfUnit::addType(DIE &Entity, const MDType *Ty,
|
||||
void DwarfUnit::addType(DIE &Entity, const DIType *Ty,
|
||||
dwarf::Attribute Attribute) {
|
||||
assert(Ty && "Trying to add a type that doesn't exist?");
|
||||
|
||||
@ -818,7 +817,7 @@ void DwarfUnit::addType(DIE &Entity, const MDType *Ty,
|
||||
addDIEEntry(Entity, Attribute, Entry);
|
||||
}
|
||||
|
||||
std::string DwarfUnit::getParentContextString(const MDScope *Context) const {
|
||||
std::string DwarfUnit::getParentContextString(const DIScope *Context) const {
|
||||
if (!Context)
|
||||
return "";
|
||||
|
||||
@ -827,8 +826,8 @@ std::string DwarfUnit::getParentContextString(const MDScope *Context) const {
|
||||
return "";
|
||||
|
||||
std::string CS;
|
||||
SmallVector<const MDScope *, 1> Parents;
|
||||
while (!isa<MDCompileUnit>(Context)) {
|
||||
SmallVector<const DIScope *, 1> Parents;
|
||||
while (!isa<DICompileUnit>(Context)) {
|
||||
Parents.push_back(Context);
|
||||
if (Context->getScope())
|
||||
Context = resolve(Context->getScope());
|
||||
@ -841,9 +840,9 @@ std::string DwarfUnit::getParentContextString(const MDScope *Context) const {
|
||||
// Reverse iterate over our list to go from the outermost construct to the
|
||||
// innermost.
|
||||
for (auto I = Parents.rbegin(), E = Parents.rend(); I != E; ++I) {
|
||||
const MDScope *Ctx = *I;
|
||||
const DIScope *Ctx = *I;
|
||||
StringRef Name = Ctx->getName();
|
||||
if (Name.empty() && isa<MDNamespace>(Ctx))
|
||||
if (Name.empty() && isa<DINamespace>(Ctx))
|
||||
Name = "(anonymous namespace)";
|
||||
if (!Name.empty()) {
|
||||
CS += Name;
|
||||
@ -853,7 +852,7 @@ std::string DwarfUnit::getParentContextString(const MDScope *Context) const {
|
||||
return CS;
|
||||
}
|
||||
|
||||
void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDBasicType *BTy) {
|
||||
void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIBasicType *BTy) {
|
||||
// Get core information.
|
||||
StringRef Name = BTy->getName();
|
||||
// Add name if not anonymous or intermediate type.
|
||||
@ -871,14 +870,14 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDBasicType *BTy) {
|
||||
addUInt(Buffer, dwarf::DW_AT_byte_size, None, Size);
|
||||
}
|
||||
|
||||
void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy) {
|
||||
void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy) {
|
||||
// Get core information.
|
||||
StringRef Name = DTy->getName();
|
||||
uint64_t Size = DTy->getSizeInBits() >> 3;
|
||||
uint16_t Tag = Buffer.getTag();
|
||||
|
||||
// Map to main type, void will not have a type.
|
||||
const MDType *FromTy = resolve(DTy->getBaseType());
|
||||
const DIType *FromTy = resolve(DTy->getBaseType());
|
||||
if (FromTy)
|
||||
addType(Buffer, FromTy);
|
||||
|
||||
@ -894,15 +893,15 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy) {
|
||||
if (Tag == dwarf::DW_TAG_ptr_to_member_type)
|
||||
addDIEEntry(
|
||||
Buffer, dwarf::DW_AT_containing_type,
|
||||
*getOrCreateTypeDIE(resolve(cast<MDDerivedType>(DTy)->getClassType())));
|
||||
*getOrCreateTypeDIE(resolve(cast<DIDerivedType>(DTy)->getClassType())));
|
||||
// Add source line info if available and TyDesc is not a forward declaration.
|
||||
if (!DTy->isForwardDecl())
|
||||
addSourceLine(Buffer, DTy);
|
||||
}
|
||||
|
||||
void DwarfUnit::constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args) {
|
||||
void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args) {
|
||||
for (unsigned i = 1, N = Args.size(); i < N; ++i) {
|
||||
const MDType *Ty = resolve(Args[i]);
|
||||
const DIType *Ty = resolve(Args[i]);
|
||||
if (!Ty) {
|
||||
assert(i == N-1 && "Unspecified parameter must be the last argument");
|
||||
createAndAddDIE(dwarf::DW_TAG_unspecified_parameters, Buffer);
|
||||
@ -915,9 +914,9 @@ void DwarfUnit::constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args) {
|
||||
}
|
||||
}
|
||||
|
||||
void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDSubroutineType *CTy) {
|
||||
void DwarfUnit::constructTypeDIE(DIE &Buffer, const DISubroutineType *CTy) {
|
||||
// Add return type. A void return won't have a type.
|
||||
auto Elements = cast<MDSubroutineType>(CTy)->getTypeArray();
|
||||
auto Elements = cast<DISubroutineType>(CTy)->getTypeArray();
|
||||
if (Elements.size())
|
||||
if (auto RTy = resolve(Elements[0]))
|
||||
addType(Buffer, RTy);
|
||||
@ -943,7 +942,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDSubroutineType *CTy) {
|
||||
addFlag(Buffer, dwarf::DW_AT_rvalue_reference);
|
||||
}
|
||||
|
||||
void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
|
||||
void DwarfUnit::constructTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
|
||||
// Add name if not anonymous or intermediate type.
|
||||
StringRef Name = CTy->getName();
|
||||
|
||||
@ -961,13 +960,13 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
|
||||
case dwarf::DW_TAG_union_type:
|
||||
case dwarf::DW_TAG_class_type: {
|
||||
// Add elements to structure type.
|
||||
DebugNodeArray Elements = CTy->getElements();
|
||||
DINodeArray Elements = CTy->getElements();
|
||||
for (const auto *Element : Elements) {
|
||||
if (!Element)
|
||||
continue;
|
||||
if (auto *SP = dyn_cast<MDSubprogram>(Element))
|
||||
if (auto *SP = dyn_cast<DISubprogram>(Element))
|
||||
getOrCreateSubprogramDIE(SP);
|
||||
else if (auto *DDTy = dyn_cast<MDDerivedType>(Element)) {
|
||||
else if (auto *DDTy = dyn_cast<DIDerivedType>(Element)) {
|
||||
if (DDTy->getTag() == dwarf::DW_TAG_friend) {
|
||||
DIE &ElemDie = createAndAddDIE(dwarf::DW_TAG_friend, Buffer);
|
||||
addType(ElemDie, resolve(DDTy->getBaseType()), dwarf::DW_AT_friend);
|
||||
@ -976,7 +975,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
|
||||
} else {
|
||||
constructMemberDIE(Buffer, DDTy);
|
||||
}
|
||||
} else if (auto *Property = dyn_cast<MDObjCProperty>(Element)) {
|
||||
} else if (auto *Property = dyn_cast<DIObjCProperty>(Element)) {
|
||||
DIE &ElemDie = createAndAddDIE(Property->getTag(), Buffer);
|
||||
StringRef PropertyName = Property->getName();
|
||||
addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
|
||||
@ -1007,7 +1006,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
|
||||
// This is outside the DWARF spec, but GDB expects a DW_AT_containing_type
|
||||
// inside C++ composite types to point to the base class with the vtable.
|
||||
if (auto *ContainingType =
|
||||
dyn_cast_or_null<MDCompositeType>(resolve(CTy->getVTableHolder())))
|
||||
dyn_cast_or_null<DICompositeType>(resolve(CTy->getVTableHolder())))
|
||||
addDIEEntry(Buffer, dwarf::DW_AT_containing_type,
|
||||
*getOrCreateTypeDIE(ContainingType));
|
||||
|
||||
@ -1058,7 +1057,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
|
||||
}
|
||||
|
||||
void DwarfUnit::constructTemplateTypeParameterDIE(
|
||||
DIE &Buffer, const MDTemplateTypeParameter *TP) {
|
||||
DIE &Buffer, const DITemplateTypeParameter *TP) {
|
||||
DIE &ParamDIE =
|
||||
createAndAddDIE(dwarf::DW_TAG_template_type_parameter, Buffer);
|
||||
// Add the type if it exists, it could be void and therefore no type.
|
||||
@ -1069,7 +1068,7 @@ void DwarfUnit::constructTemplateTypeParameterDIE(
|
||||
}
|
||||
|
||||
void DwarfUnit::constructTemplateValueParameterDIE(
|
||||
DIE &Buffer, const MDTemplateValueParameter *VP) {
|
||||
DIE &Buffer, const DITemplateValueParameter *VP) {
|
||||
DIE &ParamDIE = createAndAddDIE(VP->getTag(), Buffer);
|
||||
|
||||
// Add the type if there is one, template template and template parameter
|
||||
@ -1100,7 +1099,7 @@ void DwarfUnit::constructTemplateValueParameterDIE(
|
||||
}
|
||||
}
|
||||
|
||||
DIE *DwarfUnit::getOrCreateNameSpace(const MDNamespace *NS) {
|
||||
DIE *DwarfUnit::getOrCreateNameSpace(const DINamespace *NS) {
|
||||
// Construct the context before querying for the existence of the DIE in case
|
||||
// such construction creates the DIE.
|
||||
DIE *ContextDIE = getOrCreateContextDIE(NS->getScope());
|
||||
@ -1120,7 +1119,7 @@ DIE *DwarfUnit::getOrCreateNameSpace(const MDNamespace *NS) {
|
||||
return &NDie;
|
||||
}
|
||||
|
||||
DIE *DwarfUnit::getOrCreateSubprogramDIE(const MDSubprogram *SP, bool Minimal) {
|
||||
DIE *DwarfUnit::getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal) {
|
||||
// Construct the context before querying for the existence of the DIE in case
|
||||
// such construction creates the DIE (as is the case for member function
|
||||
// declarations).
|
||||
@ -1151,7 +1150,7 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(const MDSubprogram *SP, bool Minimal) {
|
||||
return &SPDie;
|
||||
}
|
||||
|
||||
bool DwarfUnit::applySubprogramDefinitionAttributes(const MDSubprogram *SP,
|
||||
bool DwarfUnit::applySubprogramDefinitionAttributes(const DISubprogram *SP,
|
||||
DIE &SPDie) {
|
||||
DIE *DeclDie = nullptr;
|
||||
StringRef DeclLinkageName;
|
||||
@ -1183,7 +1182,7 @@ bool DwarfUnit::applySubprogramDefinitionAttributes(const MDSubprogram *SP,
|
||||
return true;
|
||||
}
|
||||
|
||||
void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie,
|
||||
void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
|
||||
bool Minimal) {
|
||||
if (!Minimal)
|
||||
if (applySubprogramDefinitionAttributes(SP, SPDie))
|
||||
@ -1207,7 +1206,7 @@ void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie,
|
||||
Language == dwarf::DW_LANG_ObjC))
|
||||
addFlag(SPDie, dwarf::DW_AT_prototyped);
|
||||
|
||||
const MDSubroutineType *SPTy = SP->getType();
|
||||
const DISubroutineType *SPTy = SP->getType();
|
||||
assert(SPTy->getTag() == dwarf::DW_TAG_subroutine_type &&
|
||||
"the type of a subprogram should be a subroutine");
|
||||
|
||||
@ -1269,7 +1268,7 @@ void DwarfUnit::applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie,
|
||||
addFlag(SPDie, dwarf::DW_AT_explicit);
|
||||
}
|
||||
|
||||
void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const MDSubrange *SR,
|
||||
void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const DISubrange *SR,
|
||||
DIE *IndexTy) {
|
||||
DIE &DW_Subrange = createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer);
|
||||
addDIEEntry(DW_Subrange, dwarf::DW_AT_type, *IndexTy);
|
||||
@ -1303,7 +1302,7 @@ DIE *DwarfUnit::getIndexTyDie() {
|
||||
return IndexTyDie;
|
||||
}
|
||||
|
||||
void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
|
||||
void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
|
||||
if (CTy->isVector())
|
||||
addFlag(Buffer, dwarf::DW_AT_GNU_vector);
|
||||
|
||||
@ -1316,21 +1315,21 @@ void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
|
||||
DIE *IdxTy = getIndexTyDie();
|
||||
|
||||
// Add subranges to array type.
|
||||
DebugNodeArray Elements = CTy->getElements();
|
||||
DINodeArray Elements = CTy->getElements();
|
||||
for (unsigned i = 0, N = Elements.size(); i < N; ++i) {
|
||||
// FIXME: Should this really be such a loose cast?
|
||||
if (auto *Element = dyn_cast_or_null<DebugNode>(Elements[i]))
|
||||
if (auto *Element = dyn_cast_or_null<DINode>(Elements[i]))
|
||||
if (Element->getTag() == dwarf::DW_TAG_subrange_type)
|
||||
constructSubrangeDIE(Buffer, cast<MDSubrange>(Element), IdxTy);
|
||||
constructSubrangeDIE(Buffer, cast<DISubrange>(Element), IdxTy);
|
||||
}
|
||||
}
|
||||
|
||||
void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
|
||||
DebugNodeArray Elements = CTy->getElements();
|
||||
void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
|
||||
DINodeArray Elements = CTy->getElements();
|
||||
|
||||
// Add enumerators to enumeration type.
|
||||
for (unsigned i = 0, N = Elements.size(); i < N; ++i) {
|
||||
auto *Enum = dyn_cast_or_null<MDEnumerator>(Elements[i]);
|
||||
auto *Enum = dyn_cast_or_null<DIEnumerator>(Elements[i]);
|
||||
if (Enum) {
|
||||
DIE &Enumerator = createAndAddDIE(dwarf::DW_TAG_enumerator, Buffer);
|
||||
StringRef Name = Enum->getName();
|
||||
@ -1340,7 +1339,7 @@ void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy) {
|
||||
Value);
|
||||
}
|
||||
}
|
||||
const MDType *DTy = resolve(CTy->getBaseType());
|
||||
const DIType *DTy = resolve(CTy->getBaseType());
|
||||
if (DTy) {
|
||||
addType(Buffer, DTy);
|
||||
addFlag(Buffer, dwarf::DW_AT_enum_class);
|
||||
@ -1351,7 +1350,7 @@ void DwarfUnit::constructContainingTypeDIEs() {
|
||||
for (auto CI = ContainingTypeMap.begin(), CE = ContainingTypeMap.end();
|
||||
CI != CE; ++CI) {
|
||||
DIE &SPDie = *CI->first;
|
||||
const DebugNode *D = CI->second;
|
||||
const DINode *D = CI->second;
|
||||
if (!D)
|
||||
continue;
|
||||
DIE *NDie = getDIE(D);
|
||||
@ -1361,7 +1360,7 @@ void DwarfUnit::constructContainingTypeDIEs() {
|
||||
}
|
||||
}
|
||||
|
||||
void DwarfUnit::constructMemberDIE(DIE &Buffer, const MDDerivedType *DT) {
|
||||
void DwarfUnit::constructMemberDIE(DIE &Buffer, const DIDerivedType *DT) {
|
||||
DIE &MemberDie = createAndAddDIE(DT->getTag(), Buffer);
|
||||
StringRef Name = DT->getName();
|
||||
if (!Name.empty())
|
||||
@ -1449,7 +1448,7 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, const MDDerivedType *DT) {
|
||||
addFlag(MemberDie, dwarf::DW_AT_artificial);
|
||||
}
|
||||
|
||||
DIE *DwarfUnit::getOrCreateStaticMemberDIE(const MDDerivedType *DT) {
|
||||
DIE *DwarfUnit::getOrCreateStaticMemberDIE(const DIDerivedType *DT) {
|
||||
if (!DT)
|
||||
return nullptr;
|
||||
|
||||
@ -1464,7 +1463,7 @@ DIE *DwarfUnit::getOrCreateStaticMemberDIE(const MDDerivedType *DT) {
|
||||
|
||||
DIE &StaticMemberDIE = createAndAddDIE(DT->getTag(), *ContextDIE, DT);
|
||||
|
||||
const MDType *Ty = resolve(DT->getBaseType());
|
||||
const DIType *Ty = resolve(DT->getBaseType());
|
||||
|
||||
addString(StaticMemberDIE, dwarf::DW_AT_name, DT->getName());
|
||||
addType(StaticMemberDIE, Ty);
|
||||
|
@ -71,7 +71,7 @@ protected:
|
||||
unsigned UniqueID;
|
||||
|
||||
/// MDNode for the compile unit.
|
||||
const MDCompileUnit *CUNode;
|
||||
const DICompileUnit *CUNode;
|
||||
|
||||
/// Unit debug information entry.
|
||||
DIE UnitDie;
|
||||
@ -106,7 +106,7 @@ protected:
|
||||
/// This map is used to keep track of subprogram DIEs that need
|
||||
/// DW_AT_containing_type attribute. This attribute points to a DIE that
|
||||
/// corresponds to the MDNode mapped with the subprogram DIE.
|
||||
DenseMap<DIE *, const DebugNode *> ContainingTypeMap;
|
||||
DenseMap<DIE *, const DINode *> ContainingTypeMap;
|
||||
|
||||
// All DIEValues are allocated through this allocator.
|
||||
BumpPtrAllocator DIEValueAllocator;
|
||||
@ -117,7 +117,7 @@ protected:
|
||||
/// The section this unit will be emitted in.
|
||||
const MCSection *Section;
|
||||
|
||||
DwarfUnit(unsigned UID, dwarf::Tag, const MDCompileUnit *CU, AsmPrinter *A,
|
||||
DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A,
|
||||
DwarfDebug *DW, DwarfFile *DWU);
|
||||
|
||||
/// \brief Add a string attribute data and value.
|
||||
@ -127,7 +127,7 @@ protected:
|
||||
|
||||
void addIndexedString(DIE &Die, dwarf::Attribute Attribute, StringRef Str);
|
||||
|
||||
bool applySubprogramDefinitionAttributes(const MDSubprogram *SP, DIE &SPDie);
|
||||
bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie);
|
||||
|
||||
public:
|
||||
virtual ~DwarfUnit();
|
||||
@ -143,7 +143,7 @@ public:
|
||||
AsmPrinter* getAsmPrinter() const { return Asm; }
|
||||
unsigned getUniqueID() const { return UniqueID; }
|
||||
uint16_t getLanguage() const { return CUNode->getSourceLanguage(); }
|
||||
const MDCompileUnit *getCUNode() const { return CUNode; }
|
||||
const DICompileUnit *getCUNode() const { return CUNode; }
|
||||
DIE &getUnitDie() { return UnitDie; }
|
||||
|
||||
unsigned getDebugInfoOffset() const { return DebugInfoOffset; }
|
||||
@ -159,15 +159,15 @@ public:
|
||||
/// metadata level because DIEs may not currently have been added to the
|
||||
/// parent context and walking the DIEs looking for names is more expensive
|
||||
/// than walking the metadata.
|
||||
std::string getParentContextString(const MDScope *Context) const;
|
||||
std::string getParentContextString(const DIScope *Context) const;
|
||||
|
||||
/// Add a new global name to the compile unit.
|
||||
virtual void addGlobalName(StringRef Name, DIE &Die, const MDScope *Context) {
|
||||
virtual void addGlobalName(StringRef Name, DIE &Die, const DIScope *Context) {
|
||||
}
|
||||
|
||||
/// Add a new global type to the compile unit.
|
||||
virtual void addGlobalType(const MDType *Ty, const DIE &Die,
|
||||
const MDScope *Context) {}
|
||||
virtual void addGlobalType(const DIType *Ty, const DIE &Die,
|
||||
const DIScope *Context) {}
|
||||
|
||||
/// \brief Add a new name to the namespace accelerator table.
|
||||
void addAccelNamespace(StringRef Name, const DIE &Die);
|
||||
@ -177,7 +177,7 @@ public:
|
||||
/// We delegate the request to DwarfDebug when the MDNode can be part of the
|
||||
/// type system, since DIEs for the type system can be shared across CUs and
|
||||
/// the mappings are kept in DwarfDebug.
|
||||
DIE *getDIE(const DebugNode *D) const;
|
||||
DIE *getDIE(const DINode *D) const;
|
||||
|
||||
/// \brief Returns a fresh newly allocated DIELoc.
|
||||
DIELoc *getDIELoc() { return new (DIEValueAllocator) DIELoc(); }
|
||||
@ -187,7 +187,7 @@ public:
|
||||
/// We delegate the request to DwarfDebug when the MDNode can be part of the
|
||||
/// type system, since DIEs for the type system can be shared across CUs and
|
||||
/// the mappings are kept in DwarfDebug.
|
||||
void insertDIE(const DebugNode *Desc, DIE *D);
|
||||
void insertDIE(const DINode *Desc, DIE *D);
|
||||
|
||||
/// \brief Add a flag that is true to the DIE.
|
||||
void addFlag(DIE &Die, dwarf::Attribute Attribute);
|
||||
@ -246,17 +246,17 @@ public:
|
||||
/// \brief Add location information to specified debug information entry.
|
||||
void addSourceLine(DIE &Die, unsigned Line, StringRef File,
|
||||
StringRef Directory);
|
||||
void addSourceLine(DIE &Die, const MDLocalVariable *V);
|
||||
void addSourceLine(DIE &Die, const MDGlobalVariable *G);
|
||||
void addSourceLine(DIE &Die, const MDSubprogram *SP);
|
||||
void addSourceLine(DIE &Die, const MDType *Ty);
|
||||
void addSourceLine(DIE &Die, const MDNamespace *NS);
|
||||
void addSourceLine(DIE &Die, const MDObjCProperty *Ty);
|
||||
void addSourceLine(DIE &Die, const DILocalVariable *V);
|
||||
void addSourceLine(DIE &Die, const DIGlobalVariable *G);
|
||||
void addSourceLine(DIE &Die, const DISubprogram *SP);
|
||||
void addSourceLine(DIE &Die, const DIType *Ty);
|
||||
void addSourceLine(DIE &Die, const DINamespace *NS);
|
||||
void addSourceLine(DIE &Die, const DIObjCProperty *Ty);
|
||||
|
||||
/// \brief Add constant value entry in variable DIE.
|
||||
void addConstantValue(DIE &Die, const MachineOperand &MO, const MDType *Ty);
|
||||
void addConstantValue(DIE &Die, const ConstantInt *CI, const MDType *Ty);
|
||||
void addConstantValue(DIE &Die, const APInt &Val, const MDType *Ty);
|
||||
void addConstantValue(DIE &Die, const MachineOperand &MO, const DIType *Ty);
|
||||
void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty);
|
||||
void addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty);
|
||||
void addConstantValue(DIE &Die, const APInt &Val, bool Unsigned);
|
||||
void addConstantValue(DIE &Die, bool Unsigned, uint64_t Val);
|
||||
|
||||
@ -268,7 +268,7 @@ public:
|
||||
void addLinkageName(DIE &Die, StringRef LinkageName);
|
||||
|
||||
/// \brief Add template parameters in buffer.
|
||||
void addTemplateParams(DIE &Buffer, DebugNodeArray TParams);
|
||||
void addTemplateParams(DIE &Buffer, DINodeArray TParams);
|
||||
|
||||
/// \brief Add register operand.
|
||||
/// \returns false if the register does not exist, e.g., because it was never
|
||||
@ -294,33 +294,33 @@ public:
|
||||
///
|
||||
/// This takes and attribute parameter because DW_AT_friend attributes are
|
||||
/// also type references.
|
||||
void addType(DIE &Entity, const MDType *Ty,
|
||||
void addType(DIE &Entity, const DIType *Ty,
|
||||
dwarf::Attribute Attribute = dwarf::DW_AT_type);
|
||||
|
||||
DIE *getOrCreateNameSpace(const MDNamespace *NS);
|
||||
DIE *getOrCreateSubprogramDIE(const MDSubprogram *SP, bool Minimal = false);
|
||||
DIE *getOrCreateNameSpace(const DINamespace *NS);
|
||||
DIE *getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal = false);
|
||||
|
||||
void applySubprogramAttributes(const MDSubprogram *SP, DIE &SPDie,
|
||||
void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
|
||||
bool Minimal = false);
|
||||
|
||||
/// \brief Find existing DIE or create new DIE for the given type.
|
||||
DIE *getOrCreateTypeDIE(const MDNode *N);
|
||||
|
||||
/// \brief Get context owner's DIE.
|
||||
DIE *createTypeDIE(const MDCompositeType *Ty);
|
||||
DIE *createTypeDIE(const DICompositeType *Ty);
|
||||
|
||||
/// \brief Get context owner's DIE.
|
||||
DIE *getOrCreateContextDIE(const MDScope *Context);
|
||||
DIE *getOrCreateContextDIE(const DIScope *Context);
|
||||
|
||||
/// \brief Construct DIEs for types that contain vtables.
|
||||
void constructContainingTypeDIEs();
|
||||
|
||||
/// \brief Construct function argument DIEs.
|
||||
void constructSubprogramArguments(DIE &Buffer, MDTypeRefArray Args);
|
||||
void constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args);
|
||||
|
||||
/// Create a DIE with the given Tag, add the DIE to its parent, and
|
||||
/// call insertDIE if MD is not null.
|
||||
DIE &createAndAddDIE(unsigned Tag, DIE &Parent, const DebugNode *N = nullptr);
|
||||
DIE &createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N = nullptr);
|
||||
|
||||
/// Compute the size of a header for this unit, not including the initial
|
||||
/// length field.
|
||||
@ -335,11 +335,11 @@ public:
|
||||
|
||||
virtual DwarfCompileUnit &getCU() = 0;
|
||||
|
||||
void constructTypeDIE(DIE &Buffer, const MDCompositeType *CTy);
|
||||
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy);
|
||||
|
||||
protected:
|
||||
/// \brief Create new static data member DIE.
|
||||
DIE *getOrCreateStaticMemberDIE(const MDDerivedType *DT);
|
||||
DIE *getOrCreateStaticMemberDIE(const DIDerivedType *DT);
|
||||
|
||||
/// Look up the source ID with the given directory and source file names. If
|
||||
/// none currently exists, create a new ID and insert it in the line table.
|
||||
@ -347,22 +347,22 @@ protected:
|
||||
|
||||
/// \brief Look in the DwarfDebug map for the MDNode that corresponds to the
|
||||
/// reference.
|
||||
template <typename T> T *resolve(TypedDebugNodeRef<T> Ref) const {
|
||||
template <typename T> T *resolve(TypedDINodeRef<T> Ref) const {
|
||||
return DD->resolve(Ref);
|
||||
}
|
||||
|
||||
private:
|
||||
void constructTypeDIE(DIE &Buffer, const MDBasicType *BTy);
|
||||
void constructTypeDIE(DIE &Buffer, const MDDerivedType *DTy);
|
||||
void constructTypeDIE(DIE &Buffer, const MDSubroutineType *DTy);
|
||||
void constructSubrangeDIE(DIE &Buffer, const MDSubrange *SR, DIE *IndexTy);
|
||||
void constructArrayTypeDIE(DIE &Buffer, const MDCompositeType *CTy);
|
||||
void constructEnumTypeDIE(DIE &Buffer, const MDCompositeType *CTy);
|
||||
void constructMemberDIE(DIE &Buffer, const MDDerivedType *DT);
|
||||
void constructTypeDIE(DIE &Buffer, const DIBasicType *BTy);
|
||||
void constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy);
|
||||
void constructTypeDIE(DIE &Buffer, const DISubroutineType *DTy);
|
||||
void constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, DIE *IndexTy);
|
||||
void constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy);
|
||||
void constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy);
|
||||
void constructMemberDIE(DIE &Buffer, const DIDerivedType *DT);
|
||||
void constructTemplateTypeParameterDIE(DIE &Buffer,
|
||||
const MDTemplateTypeParameter *TP);
|
||||
const DITemplateTypeParameter *TP);
|
||||
void constructTemplateValueParameterDIE(DIE &Buffer,
|
||||
const MDTemplateValueParameter *TVP);
|
||||
const DITemplateValueParameter *TVP);
|
||||
|
||||
/// \brief Return the default lower bound for an array.
|
||||
///
|
||||
@ -391,7 +391,7 @@ private:
|
||||
|
||||
/// If this is a named finished type then include it in the list of types for
|
||||
/// the accelerator tables.
|
||||
void updateAcceleratorTables(const MDScope *Context, const MDType *Ty,
|
||||
void updateAcceleratorTables(const DIScope *Context, const DIType *Ty,
|
||||
const DIE &TyDIE);
|
||||
|
||||
virtual bool isDwoUnit() const = 0;
|
||||
|
@ -20,11 +20,11 @@ namespace llvm {
|
||||
|
||||
StringRef WinCodeViewLineTables::getFullFilepath(const MDNode *S) {
|
||||
assert(S);
|
||||
assert((isa<MDCompileUnit>(S) || isa<MDFile>(S) || isa<MDSubprogram>(S) ||
|
||||
isa<MDLexicalBlockBase>(S)) &&
|
||||
assert((isa<DICompileUnit>(S) || isa<DIFile>(S) || isa<DISubprogram>(S) ||
|
||||
isa<DILexicalBlockBase>(S)) &&
|
||||
"Unexpected scope info");
|
||||
|
||||
auto *Scope = cast<MDScope>(S);
|
||||
auto *Scope = cast<DIScope>(S);
|
||||
StringRef Dir = Scope->getDirectory(),
|
||||
Filename = Scope->getFilename();
|
||||
char *&Result = DirAndFilenameToFilepathMap[std::make_pair(Dir, Filename)];
|
||||
|
@ -1232,7 +1232,7 @@ void InlineSpiller::spillAroundUses(unsigned Reg) {
|
||||
DebugLoc DL = MI->getDebugLoc();
|
||||
DEBUG(dbgs() << "Modifying debug info due to spill:" << "\t" << *MI);
|
||||
MachineBasicBlock *MBB = MI->getParent();
|
||||
assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
BuildMI(*MBB, MBB->erase(MI), DL, TII.get(TargetOpcode::DBG_VALUE))
|
||||
.addFrameIndex(StackSlot)
|
||||
|
@ -59,10 +59,10 @@ void LexicalScopes::extractLexicalScopes(
|
||||
for (const auto &MBB : *MF) {
|
||||
const MachineInstr *RangeBeginMI = nullptr;
|
||||
const MachineInstr *PrevMI = nullptr;
|
||||
const MDLocation *PrevDL = nullptr;
|
||||
const DILocation *PrevDL = nullptr;
|
||||
for (const auto &MInsn : MBB) {
|
||||
// Check if instruction has valid location information.
|
||||
const MDLocation *MIDL = MInsn.getDebugLoc();
|
||||
const DILocation *MIDL = MInsn.getDebugLoc();
|
||||
if (!MIDL) {
|
||||
PrevMI = &MInsn;
|
||||
continue;
|
||||
@ -106,14 +106,14 @@ void LexicalScopes::extractLexicalScopes(
|
||||
|
||||
/// findLexicalScope - Find lexical scope, either regular or inlined, for the
|
||||
/// given DebugLoc. Return NULL if not found.
|
||||
LexicalScope *LexicalScopes::findLexicalScope(const MDLocation *DL) {
|
||||
MDLocalScope *Scope = DL->getScope();
|
||||
LexicalScope *LexicalScopes::findLexicalScope(const DILocation *DL) {
|
||||
DILocalScope *Scope = DL->getScope();
|
||||
if (!Scope)
|
||||
return nullptr;
|
||||
|
||||
// The scope that we were created with could have an extra file - which
|
||||
// isn't what we care about in this case.
|
||||
if (auto *File = dyn_cast<MDLexicalBlockFile>(Scope))
|
||||
if (auto *File = dyn_cast<DILexicalBlockFile>(Scope))
|
||||
Scope = File->getScope();
|
||||
|
||||
if (auto *IA = DL->getInlinedAt()) {
|
||||
@ -125,8 +125,8 @@ LexicalScope *LexicalScopes::findLexicalScope(const MDLocation *DL) {
|
||||
|
||||
/// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
|
||||
/// not available then create new lexical scope.
|
||||
LexicalScope *LexicalScopes::getOrCreateLexicalScope(const MDLocalScope *Scope,
|
||||
const MDLocation *IA) {
|
||||
LexicalScope *LexicalScopes::getOrCreateLexicalScope(const DILocalScope *Scope,
|
||||
const DILocation *IA) {
|
||||
if (IA) {
|
||||
// Create an abstract scope for inlined function.
|
||||
getOrCreateAbstractScope(Scope);
|
||||
@ -139,17 +139,17 @@ LexicalScope *LexicalScopes::getOrCreateLexicalScope(const MDLocalScope *Scope,
|
||||
|
||||
/// getOrCreateRegularScope - Find or create a regular lexical scope.
|
||||
LexicalScope *
|
||||
LexicalScopes::getOrCreateRegularScope(const MDLocalScope *Scope) {
|
||||
if (auto *File = dyn_cast<MDLexicalBlockFile>(Scope))
|
||||
LexicalScopes::getOrCreateRegularScope(const DILocalScope *Scope) {
|
||||
if (auto *File = dyn_cast<DILexicalBlockFile>(Scope))
|
||||
Scope = File->getScope();
|
||||
|
||||
auto I = LexicalScopeMap.find(Scope);
|
||||
if (I != LexicalScopeMap.end())
|
||||
return &I->second;
|
||||
|
||||
// FIXME: Should the following dyn_cast be MDLexicalBlock?
|
||||
// FIXME: Should the following dyn_cast be DILexicalBlock?
|
||||
LexicalScope *Parent = nullptr;
|
||||
if (auto *Block = dyn_cast<MDLexicalBlockBase>(Scope))
|
||||
if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope))
|
||||
Parent = getOrCreateLexicalScope(Block->getScope());
|
||||
I = LexicalScopeMap.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(Scope),
|
||||
@ -157,7 +157,7 @@ LexicalScopes::getOrCreateRegularScope(const MDLocalScope *Scope) {
|
||||
false)).first;
|
||||
|
||||
if (!Parent) {
|
||||
assert(cast<MDSubprogram>(Scope)->describes(MF->getFunction()));
|
||||
assert(cast<DISubprogram>(Scope)->describes(MF->getFunction()));
|
||||
assert(!CurrentFnLexicalScope);
|
||||
CurrentFnLexicalScope = &I->second;
|
||||
}
|
||||
@ -167,15 +167,15 @@ LexicalScopes::getOrCreateRegularScope(const MDLocalScope *Scope) {
|
||||
|
||||
/// getOrCreateInlinedScope - Find or create an inlined lexical scope.
|
||||
LexicalScope *
|
||||
LexicalScopes::getOrCreateInlinedScope(const MDLocalScope *Scope,
|
||||
const MDLocation *InlinedAt) {
|
||||
std::pair<const MDLocalScope *, const MDLocation *> P(Scope, InlinedAt);
|
||||
LexicalScopes::getOrCreateInlinedScope(const DILocalScope *Scope,
|
||||
const DILocation *InlinedAt) {
|
||||
std::pair<const DILocalScope *, const DILocation *> P(Scope, InlinedAt);
|
||||
auto I = InlinedLexicalScopeMap.find(P);
|
||||
if (I != InlinedLexicalScopeMap.end())
|
||||
return &I->second;
|
||||
|
||||
LexicalScope *Parent;
|
||||
if (auto *Block = dyn_cast<MDLexicalBlockBase>(Scope))
|
||||
if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope))
|
||||
Parent = getOrCreateInlinedScope(Block->getScope(), InlinedAt);
|
||||
else
|
||||
Parent = getOrCreateLexicalScope(InlinedAt);
|
||||
@ -190,25 +190,25 @@ LexicalScopes::getOrCreateInlinedScope(const MDLocalScope *Scope,
|
||||
|
||||
/// getOrCreateAbstractScope - Find or create an abstract lexical scope.
|
||||
LexicalScope *
|
||||
LexicalScopes::getOrCreateAbstractScope(const MDLocalScope *Scope) {
|
||||
LexicalScopes::getOrCreateAbstractScope(const DILocalScope *Scope) {
|
||||
assert(Scope && "Invalid Scope encoding!");
|
||||
|
||||
if (auto *File = dyn_cast<MDLexicalBlockFile>(Scope))
|
||||
if (auto *File = dyn_cast<DILexicalBlockFile>(Scope))
|
||||
Scope = File->getScope();
|
||||
auto I = AbstractScopeMap.find(Scope);
|
||||
if (I != AbstractScopeMap.end())
|
||||
return &I->second;
|
||||
|
||||
// FIXME: Should the following isa be MDLexicalBlock?
|
||||
// FIXME: Should the following isa be DILexicalBlock?
|
||||
LexicalScope *Parent = nullptr;
|
||||
if (auto *Block = dyn_cast<MDLexicalBlockBase>(Scope))
|
||||
if (auto *Block = dyn_cast<DILexicalBlockBase>(Scope))
|
||||
Parent = getOrCreateAbstractScope(Block->getScope());
|
||||
|
||||
I = AbstractScopeMap.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(Scope),
|
||||
std::forward_as_tuple(Parent, Scope,
|
||||
nullptr, true)).first;
|
||||
if (isa<MDSubprogram>(Scope))
|
||||
if (isa<DISubprogram>(Scope))
|
||||
AbstractScopesList.push_back(&I->second);
|
||||
return &I->second;
|
||||
}
|
||||
@ -269,7 +269,7 @@ void LexicalScopes::assignInstructionRanges(
|
||||
/// have machine instructions that belong to lexical scope identified by
|
||||
/// DebugLoc.
|
||||
void LexicalScopes::getMachineBasicBlocks(
|
||||
const MDLocation *DL, SmallPtrSetImpl<const MachineBasicBlock *> &MBBs) {
|
||||
const DILocation *DL, SmallPtrSetImpl<const MachineBasicBlock *> &MBBs) {
|
||||
MBBs.clear();
|
||||
LexicalScope *Scope = getOrCreateLexicalScope(DL);
|
||||
if (!Scope)
|
||||
@ -292,7 +292,7 @@ void LexicalScopes::getMachineBasicBlocks(
|
||||
|
||||
/// dominates - Return true if DebugLoc's lexical scope dominates at least one
|
||||
/// machine instruction's lexical scope in a given machine basic block.
|
||||
bool LexicalScopes::dominates(const MDLocation *DL, MachineBasicBlock *MBB) {
|
||||
bool LexicalScopes::dominates(const DILocation *DL, MachineBasicBlock *MBB) {
|
||||
LexicalScope *Scope = getOrCreateLexicalScope(DL);
|
||||
if (!Scope)
|
||||
return false;
|
||||
@ -304,7 +304,7 @@ bool LexicalScopes::dominates(const MDLocation *DL, MachineBasicBlock *MBB) {
|
||||
bool Result = false;
|
||||
for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E;
|
||||
++I) {
|
||||
if (const MDLocation *IDL = I->getDebugLoc())
|
||||
if (const DILocation *IDL = I->getDebugLoc())
|
||||
if (LexicalScope *IScope = getOrCreateLexicalScope(IDL))
|
||||
if (Scope->dominates(IScope))
|
||||
return true;
|
||||
|
@ -158,7 +158,7 @@ public:
|
||||
UserValue *getNext() const { return next; }
|
||||
|
||||
/// match - Does this UserValue match the parameters?
|
||||
bool match(const MDNode *Var, const MDNode *Expr, const MDLocation *IA,
|
||||
bool match(const MDNode *Var, const MDNode *Expr, const DILocation *IA,
|
||||
unsigned Offset, bool indirect) const {
|
||||
return Var == Variable && Expr == Expression && dl->getInlinedAt() == IA &&
|
||||
Offset == offset && indirect == IsIndirect;
|
||||
@ -362,7 +362,7 @@ static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS,
|
||||
if (!DL)
|
||||
return;
|
||||
|
||||
auto *Scope = cast<MDScope>(DL.getScope());
|
||||
auto *Scope = cast<DIScope>(DL.getScope());
|
||||
// Omit the directory, because it's likely to be long and uninteresting.
|
||||
CommentOS << Scope->getFilename();
|
||||
CommentOS << ':' << DL.getLine();
|
||||
@ -378,8 +378,8 @@ static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS,
|
||||
CommentOS << " ]";
|
||||
}
|
||||
|
||||
static void printExtendedName(raw_ostream &OS, const MDLocalVariable *V,
|
||||
const MDLocation *DL) {
|
||||
static void printExtendedName(raw_ostream &OS, const DILocalVariable *V,
|
||||
const DILocation *DL) {
|
||||
const LLVMContext &Ctx = V->getContext();
|
||||
StringRef Res = V->getName();
|
||||
if (!Res.empty())
|
||||
@ -394,7 +394,7 @@ static void printExtendedName(raw_ostream &OS, const MDLocalVariable *V,
|
||||
}
|
||||
|
||||
void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) {
|
||||
auto *DV = cast<MDLocalVariable>(Variable);
|
||||
auto *DV = cast<DILocalVariable>(Variable);
|
||||
OS << "!\"";
|
||||
printExtendedName(OS, DV, dl);
|
||||
|
||||
@ -981,7 +981,7 @@ void UserValue::insertDebugValue(MachineBasicBlock *MBB, SlotIndex Idx,
|
||||
MachineOperand &Loc = locations[LocNo];
|
||||
++NumInsertedDebugValues;
|
||||
|
||||
assert(cast<MDLocalVariable>(Variable)
|
||||
assert(cast<DILocalVariable>(Variable)
|
||||
->isValidLocationForIntrinsic(getDebugLoc()) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
if (Loc.isReg())
|
||||
|
@ -33,7 +33,7 @@ class VirtRegMap;
|
||||
|
||||
class LiveDebugVariables : public MachineFunctionPass {
|
||||
void *pImpl;
|
||||
DenseMap<const Function *, MDSubprogram *> FunctionDIs;
|
||||
DenseMap<const Function *, DISubprogram *> FunctionDIs;
|
||||
|
||||
public:
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
|
@ -1619,7 +1619,7 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const {
|
||||
}
|
||||
if (isDebugValue() && MO.isMetadata()) {
|
||||
// Pretty print DBG_VALUE instructions.
|
||||
auto *DIV = dyn_cast<MDLocalVariable>(MO.getMetadata());
|
||||
auto *DIV = dyn_cast<DILocalVariable>(MO.getMetadata());
|
||||
if (DIV && !DIV->getName().empty())
|
||||
OS << "!\"" << DIV->getName() << '\"';
|
||||
else
|
||||
@ -1710,7 +1710,7 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const {
|
||||
// Print debug location information.
|
||||
if (isDebugValue() && getOperand(e - 2).isMetadata()) {
|
||||
if (!HaveSemi) OS << ";";
|
||||
auto *DV = cast<MDLocalVariable>(getOperand(e - 2).getMetadata());
|
||||
auto *DV = cast<DILocalVariable>(getOperand(e - 2).getMetadata());
|
||||
OS << " line no:" << DV->getLine();
|
||||
if (auto *InlinedAt = debugLoc->getInlinedAt()) {
|
||||
DebugLoc InlinedAtDL(InlinedAt);
|
||||
|
@ -302,7 +302,7 @@ void RAFast::spillVirtReg(MachineBasicBlock::iterator MI,
|
||||
bool IsIndirect = DBG->isIndirectDebugValue();
|
||||
uint64_t Offset = IsIndirect ? DBG->getOperand(1).getImm() : 0;
|
||||
DebugLoc DL = DBG->getDebugLoc();
|
||||
assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
MachineInstr *NewDV =
|
||||
BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::DBG_VALUE))
|
||||
@ -874,7 +874,7 @@ void RAFast::AllocateBasicBlock() {
|
||||
DebugLoc DL = MI->getDebugLoc();
|
||||
MachineBasicBlock *MBB = MI->getParent();
|
||||
assert(
|
||||
cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
MachineInstr *NewDV = BuildMI(*MBB, MBB->erase(MI), DL,
|
||||
TII->get(TargetOpcode::DBG_VALUE))
|
||||
|
@ -650,7 +650,7 @@ InstrEmitter::EmitDbgValue(SDDbgValue *SD,
|
||||
MDNode *Var = SD->getVariable();
|
||||
MDNode *Expr = SD->getExpression();
|
||||
DebugLoc DL = SD->getDebugLoc();
|
||||
assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
|
||||
if (SD->getKind() == SDDbgValue::FRAMEIX) {
|
||||
|
@ -5978,7 +5978,7 @@ SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList,
|
||||
SDDbgValue *SelectionDAG::getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N,
|
||||
unsigned R, bool IsIndirect, uint64_t Off,
|
||||
DebugLoc DL, unsigned O) {
|
||||
assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
return new (Allocator) SDDbgValue(Var, Expr, N, R, IsIndirect, Off, DL, O);
|
||||
}
|
||||
@ -5987,7 +5987,7 @@ SDDbgValue *SelectionDAG::getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N,
|
||||
SDDbgValue *SelectionDAG::getConstantDbgValue(MDNode *Var, MDNode *Expr,
|
||||
const Value *C, uint64_t Off,
|
||||
DebugLoc DL, unsigned O) {
|
||||
assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
return new (Allocator) SDDbgValue(Var, Expr, C, Off, DL, O);
|
||||
}
|
||||
@ -5996,7 +5996,7 @@ SDDbgValue *SelectionDAG::getConstantDbgValue(MDNode *Var, MDNode *Expr,
|
||||
SDDbgValue *SelectionDAG::getFrameIndexDbgValue(MDNode *Var, MDNode *Expr,
|
||||
unsigned FI, uint64_t Off,
|
||||
DebugLoc DL, unsigned O) {
|
||||
assert(cast<MDLocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
return new (Allocator) SDDbgValue(Var, Expr, FI, Off, DL, O);
|
||||
}
|
||||
|
@ -999,8 +999,8 @@ void SelectionDAGBuilder::resolveDanglingDebugInfo(const Value *V,
|
||||
const DbgValueInst *DI = DDI.getDI();
|
||||
DebugLoc dl = DDI.getdl();
|
||||
unsigned DbgSDNodeOrder = DDI.getSDNodeOrder();
|
||||
MDLocalVariable *Variable = DI->getVariable();
|
||||
MDExpression *Expr = DI->getExpression();
|
||||
DILocalVariable *Variable = DI->getVariable();
|
||||
DIExpression *Expr = DI->getExpression();
|
||||
assert(Variable->isValidLocationForIntrinsic(dl) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
uint64_t Offset = DI->getOffset();
|
||||
@ -3980,8 +3980,8 @@ static unsigned getTruncatedArgReg(const SDValue &N) {
|
||||
/// argument, create the corresponding DBG_VALUE machine instruction for it now.
|
||||
/// At the end of instruction selection, they will be inserted to the entry BB.
|
||||
bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
|
||||
const Value *V, MDLocalVariable *Variable, MDExpression *Expr,
|
||||
MDLocation *DL, int64_t Offset, bool IsIndirect, const SDValue &N) {
|
||||
const Value *V, DILocalVariable *Variable, DIExpression *Expr,
|
||||
DILocation *DL, int64_t Offset, bool IsIndirect, const SDValue &N) {
|
||||
const Argument *Arg = dyn_cast<Argument>(V);
|
||||
if (!Arg)
|
||||
return false;
|
||||
@ -4175,8 +4175,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
}
|
||||
case Intrinsic::dbg_declare: {
|
||||
const DbgDeclareInst &DI = cast<DbgDeclareInst>(I);
|
||||
MDLocalVariable *Variable = DI.getVariable();
|
||||
MDExpression *Expression = DI.getExpression();
|
||||
DILocalVariable *Variable = DI.getVariable();
|
||||
DIExpression *Expression = DI.getExpression();
|
||||
const Value *Address = DI.getAddress();
|
||||
assert(Variable && "Missing variable");
|
||||
if (!Address) {
|
||||
@ -4257,8 +4257,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
const DbgValueInst &DI = cast<DbgValueInst>(I);
|
||||
assert(DI.getVariable() && "Missing variable");
|
||||
|
||||
MDLocalVariable *Variable = DI.getVariable();
|
||||
MDExpression *Expression = DI.getExpression();
|
||||
DILocalVariable *Variable = DI.getVariable();
|
||||
DIExpression *Expression = DI.getExpression();
|
||||
uint64_t Offset = DI.getOffset();
|
||||
const Value *V = DI.getValue();
|
||||
if (!V)
|
||||
|
@ -866,8 +866,8 @@ private:
|
||||
/// EmitFuncArgumentDbgValue - If V is an function argument then create
|
||||
/// corresponding DBG_VALUE machine instruction for it now. At the end of
|
||||
/// instruction selection, they will be inserted to the entry BB.
|
||||
bool EmitFuncArgumentDbgValue(const Value *V, MDLocalVariable *Variable,
|
||||
MDExpression *Expr, MDLocation *DL,
|
||||
bool EmitFuncArgumentDbgValue(const Value *V, DILocalVariable *Variable,
|
||||
DIExpression *Expr, DILocation *DL,
|
||||
int64_t Offset, bool IsIndirect,
|
||||
const SDValue &N);
|
||||
|
||||
|
@ -523,7 +523,7 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const {
|
||||
if (!G)
|
||||
return;
|
||||
|
||||
MDLocation *L = getDebugLoc();
|
||||
DILocation *L = getDebugLoc();
|
||||
if (!L)
|
||||
return;
|
||||
|
||||
|
@ -504,7 +504,7 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
|
||||
DebugLoc DL = MI->getDebugLoc();
|
||||
bool IsIndirect = MI->isIndirectDebugValue();
|
||||
unsigned Offset = IsIndirect ? MI->getOperand(1).getImm() : 0;
|
||||
assert(cast<MDLocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
|
||||
assert(cast<DILocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
|
||||
"Expected inlined-at fields to agree");
|
||||
// Def is never a terminator here, so it is ok to increment InsertPos.
|
||||
BuildMI(*EntryMBB, ++InsertPos, DL, TII->get(TargetOpcode::DBG_VALUE),
|
||||
|
@ -464,7 +464,7 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
|
||||
continue;
|
||||
if (SlotRemap.count(VI.Slot)) {
|
||||
DEBUG(dbgs() << "Remapping debug info for ["
|
||||
<< cast<MDLocalVariable>(VI.Var)->getName() << "].\n");
|
||||
<< cast<DILocalVariable>(VI.Var)->getName() << "].\n");
|
||||
VI.Slot = SlotRemap[VI.Slot];
|
||||
FixedDbg++;
|
||||
}
|
||||
|
@ -1375,7 +1375,7 @@ struct MDFieldPrinter {
|
||||
SlotTracker *Machine, const Module *Context)
|
||||
: Out(Out), TypePrinter(TypePrinter), Machine(Machine), Context(Context) {
|
||||
}
|
||||
void printTag(const DebugNode *N);
|
||||
void printTag(const DINode *N);
|
||||
void printString(StringRef Name, StringRef Value,
|
||||
bool ShouldSkipEmpty = true);
|
||||
void printMetadata(StringRef Name, const Metadata *MD,
|
||||
@ -1390,7 +1390,7 @@ struct MDFieldPrinter {
|
||||
};
|
||||
} // end namespace
|
||||
|
||||
void MDFieldPrinter::printTag(const DebugNode *N) {
|
||||
void MDFieldPrinter::printTag(const DINode *N) {
|
||||
Out << FS << "tag: ";
|
||||
if (const char *Tag = dwarf::TagString(N->getTag()))
|
||||
Out << Tag;
|
||||
@ -1447,11 +1447,11 @@ void MDFieldPrinter::printDIFlags(StringRef Name, unsigned Flags) {
|
||||
Out << FS << Name << ": ";
|
||||
|
||||
SmallVector<unsigned, 8> SplitFlags;
|
||||
unsigned Extra = DebugNode::splitFlags(Flags, SplitFlags);
|
||||
unsigned Extra = DINode::splitFlags(Flags, SplitFlags);
|
||||
|
||||
FieldSeparator FlagsFS(" | ");
|
||||
for (unsigned F : SplitFlags) {
|
||||
const char *StringF = DebugNode::getFlagString(F);
|
||||
const char *StringF = DINode::getFlagString(F);
|
||||
assert(StringF && "Expected valid flag");
|
||||
Out << FlagsFS << StringF;
|
||||
}
|
||||
@ -1472,10 +1472,10 @@ void MDFieldPrinter::printDwarfEnum(StringRef Name, IntTy Value,
|
||||
Out << Value;
|
||||
}
|
||||
|
||||
static void writeGenericDebugNode(raw_ostream &Out, const GenericDebugNode *N,
|
||||
TypePrinting *TypePrinter,
|
||||
SlotTracker *Machine, const Module *Context) {
|
||||
Out << "!GenericDebugNode(";
|
||||
static void writeGenericDINode(raw_ostream &Out, const GenericDINode *N,
|
||||
TypePrinting *TypePrinter, SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!GenericDINode(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printTag(N);
|
||||
Printer.printString("header", N->getHeader());
|
||||
@ -1491,10 +1491,10 @@ static void writeGenericDebugNode(raw_ostream &Out, const GenericDebugNode *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDLocation(raw_ostream &Out, const MDLocation *DL,
|
||||
static void writeDILocation(raw_ostream &Out, const DILocation *DL,
|
||||
TypePrinting *TypePrinter, SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDLocation(";
|
||||
Out << "!DILocation(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
// Always output the line, since 0 is a relevant and important value for it.
|
||||
Printer.printInt("line", DL->getLine(), /* ShouldSkipZero */ false);
|
||||
@ -1504,27 +1504,27 @@ static void writeMDLocation(raw_ostream &Out, const MDLocation *DL,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDSubrange(raw_ostream &Out, const MDSubrange *N,
|
||||
static void writeDISubrange(raw_ostream &Out, const DISubrange *N,
|
||||
TypePrinting *, SlotTracker *, const Module *) {
|
||||
Out << "!MDSubrange(";
|
||||
Out << "!DISubrange(";
|
||||
MDFieldPrinter Printer(Out);
|
||||
Printer.printInt("count", N->getCount(), /* ShouldSkipZero */ false);
|
||||
Printer.printInt("lowerBound", N->getLowerBound());
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDEnumerator(raw_ostream &Out, const MDEnumerator *N,
|
||||
static void writeDIEnumerator(raw_ostream &Out, const DIEnumerator *N,
|
||||
TypePrinting *, SlotTracker *, const Module *) {
|
||||
Out << "!MDEnumerator(";
|
||||
Out << "!DIEnumerator(";
|
||||
MDFieldPrinter Printer(Out);
|
||||
Printer.printString("name", N->getName(), /* ShouldSkipEmpty */ false);
|
||||
Printer.printInt("value", N->getValue(), /* ShouldSkipZero */ false);
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDBasicType(raw_ostream &Out, const MDBasicType *N,
|
||||
static void writeDIBasicType(raw_ostream &Out, const DIBasicType *N,
|
||||
TypePrinting *, SlotTracker *, const Module *) {
|
||||
Out << "!MDBasicType(";
|
||||
Out << "!DIBasicType(";
|
||||
MDFieldPrinter Printer(Out);
|
||||
if (N->getTag() != dwarf::DW_TAG_base_type)
|
||||
Printer.printTag(N);
|
||||
@ -1536,10 +1536,10 @@ static void writeMDBasicType(raw_ostream &Out, const MDBasicType *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDDerivedType(raw_ostream &Out, const MDDerivedType *N,
|
||||
static void writeDIDerivedType(raw_ostream &Out, const DIDerivedType *N,
|
||||
TypePrinting *TypePrinter, SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDDerivedType(";
|
||||
Out << "!DIDerivedType(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printTag(N);
|
||||
Printer.printString("name", N->getName());
|
||||
@ -1556,10 +1556,10 @@ static void writeMDDerivedType(raw_ostream &Out, const MDDerivedType *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDCompositeType(raw_ostream &Out, const MDCompositeType *N,
|
||||
static void writeDICompositeType(raw_ostream &Out, const DICompositeType *N,
|
||||
TypePrinting *TypePrinter,
|
||||
SlotTracker *Machine, const Module *Context) {
|
||||
Out << "!MDCompositeType(";
|
||||
Out << "!DICompositeType(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printTag(N);
|
||||
Printer.printString("name", N->getName());
|
||||
@ -1580,10 +1580,10 @@ static void writeMDCompositeType(raw_ostream &Out, const MDCompositeType *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDSubroutineType(raw_ostream &Out, const MDSubroutineType *N,
|
||||
static void writeDISubroutineType(raw_ostream &Out, const DISubroutineType *N,
|
||||
TypePrinting *TypePrinter,
|
||||
SlotTracker *Machine, const Module *Context) {
|
||||
Out << "!MDSubroutineType(";
|
||||
Out << "!DISubroutineType(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printDIFlags("flags", N->getFlags());
|
||||
Printer.printMetadata("types", N->getRawTypeArray(),
|
||||
@ -1591,9 +1591,9 @@ static void writeMDSubroutineType(raw_ostream &Out, const MDSubroutineType *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDFile(raw_ostream &Out, const MDFile *N, TypePrinting *,
|
||||
static void writeDIFile(raw_ostream &Out, const DIFile *N, TypePrinting *,
|
||||
SlotTracker *, const Module *) {
|
||||
Out << "!MDFile(";
|
||||
Out << "!DIFile(";
|
||||
MDFieldPrinter Printer(Out);
|
||||
Printer.printString("filename", N->getFilename(),
|
||||
/* ShouldSkipEmpty */ false);
|
||||
@ -1602,10 +1602,10 @@ static void writeMDFile(raw_ostream &Out, const MDFile *N, TypePrinting *,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDCompileUnit(raw_ostream &Out, const MDCompileUnit *N,
|
||||
static void writeDICompileUnit(raw_ostream &Out, const DICompileUnit *N,
|
||||
TypePrinting *TypePrinter, SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDCompileUnit(";
|
||||
Out << "!DICompileUnit(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printDwarfEnum("language", N->getSourceLanguage(),
|
||||
dwarf::LanguageString, /* ShouldSkipZero */ false);
|
||||
@ -1626,10 +1626,10 @@ static void writeMDCompileUnit(raw_ostream &Out, const MDCompileUnit *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDSubprogram(raw_ostream &Out, const MDSubprogram *N,
|
||||
static void writeDISubprogram(raw_ostream &Out, const DISubprogram *N,
|
||||
TypePrinting *TypePrinter, SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDSubprogram(";
|
||||
Out << "!DISubprogram(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printString("name", N->getName());
|
||||
Printer.printString("linkageName", N->getLinkageName());
|
||||
@ -1653,10 +1653,10 @@ static void writeMDSubprogram(raw_ostream &Out, const MDSubprogram *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDLexicalBlock(raw_ostream &Out, const MDLexicalBlock *N,
|
||||
TypePrinting *TypePrinter, SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDLexicalBlock(";
|
||||
static void writeDILexicalBlock(raw_ostream &Out, const DILexicalBlock *N,
|
||||
TypePrinting *TypePrinter, SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!DILexicalBlock(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false);
|
||||
Printer.printMetadata("file", N->getRawFile());
|
||||
@ -1665,12 +1665,12 @@ static void writeMDLexicalBlock(raw_ostream &Out, const MDLexicalBlock *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDLexicalBlockFile(raw_ostream &Out,
|
||||
const MDLexicalBlockFile *N,
|
||||
static void writeDILexicalBlockFile(raw_ostream &Out,
|
||||
const DILexicalBlockFile *N,
|
||||
TypePrinting *TypePrinter,
|
||||
SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDLexicalBlockFile(";
|
||||
Out << "!DILexicalBlockFile(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false);
|
||||
Printer.printMetadata("file", N->getRawFile());
|
||||
@ -1679,10 +1679,10 @@ static void writeMDLexicalBlockFile(raw_ostream &Out,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDNamespace(raw_ostream &Out, const MDNamespace *N,
|
||||
static void writeDINamespace(raw_ostream &Out, const DINamespace *N,
|
||||
TypePrinting *TypePrinter, SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDNamespace(";
|
||||
Out << "!DINamespace(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printString("name", N->getName());
|
||||
Printer.printMetadata("scope", N->getRawScope(), /* ShouldSkipNull */ false);
|
||||
@ -1691,24 +1691,24 @@ static void writeMDNamespace(raw_ostream &Out, const MDNamespace *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDTemplateTypeParameter(raw_ostream &Out,
|
||||
const MDTemplateTypeParameter *N,
|
||||
static void writeDITemplateTypeParameter(raw_ostream &Out,
|
||||
const DITemplateTypeParameter *N,
|
||||
TypePrinting *TypePrinter,
|
||||
SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDTemplateTypeParameter(";
|
||||
Out << "!DITemplateTypeParameter(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printString("name", N->getName());
|
||||
Printer.printMetadata("type", N->getRawType(), /* ShouldSkipNull */ false);
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDTemplateValueParameter(raw_ostream &Out,
|
||||
const MDTemplateValueParameter *N,
|
||||
static void writeDITemplateValueParameter(raw_ostream &Out,
|
||||
const DITemplateValueParameter *N,
|
||||
TypePrinting *TypePrinter,
|
||||
SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDTemplateValueParameter(";
|
||||
Out << "!DITemplateValueParameter(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
if (N->getTag() != dwarf::DW_TAG_template_value_parameter)
|
||||
Printer.printTag(N);
|
||||
@ -1718,10 +1718,10 @@ static void writeMDTemplateValueParameter(raw_ostream &Out,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDGlobalVariable(raw_ostream &Out, const MDGlobalVariable *N,
|
||||
static void writeDIGlobalVariable(raw_ostream &Out, const DIGlobalVariable *N,
|
||||
TypePrinting *TypePrinter,
|
||||
SlotTracker *Machine, const Module *Context) {
|
||||
Out << "!MDGlobalVariable(";
|
||||
Out << "!DIGlobalVariable(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printString("name", N->getName());
|
||||
Printer.printString("linkageName", N->getLinkageName());
|
||||
@ -1736,10 +1736,10 @@ static void writeMDGlobalVariable(raw_ostream &Out, const MDGlobalVariable *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDLocalVariable(raw_ostream &Out, const MDLocalVariable *N,
|
||||
static void writeDILocalVariable(raw_ostream &Out, const DILocalVariable *N,
|
||||
TypePrinting *TypePrinter,
|
||||
SlotTracker *Machine, const Module *Context) {
|
||||
Out << "!MDLocalVariable(";
|
||||
Out << "!DILocalVariable(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printTag(N);
|
||||
Printer.printString("name", N->getName());
|
||||
@ -1754,10 +1754,10 @@ static void writeMDLocalVariable(raw_ostream &Out, const MDLocalVariable *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDExpression(raw_ostream &Out, const MDExpression *N,
|
||||
static void writeDIExpression(raw_ostream &Out, const DIExpression *N,
|
||||
TypePrinting *TypePrinter, SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDExpression(";
|
||||
Out << "!DIExpression(";
|
||||
FieldSeparator FS;
|
||||
if (N->isValid()) {
|
||||
for (auto I = N->expr_op_begin(), E = N->expr_op_end(); I != E; ++I) {
|
||||
@ -1775,10 +1775,10 @@ static void writeMDExpression(raw_ostream &Out, const MDExpression *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDObjCProperty(raw_ostream &Out, const MDObjCProperty *N,
|
||||
static void writeDIObjCProperty(raw_ostream &Out, const DIObjCProperty *N,
|
||||
TypePrinting *TypePrinter, SlotTracker *Machine,
|
||||
const Module *Context) {
|
||||
Out << "!MDObjCProperty(";
|
||||
Out << "!DIObjCProperty(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printString("name", N->getName());
|
||||
Printer.printMetadata("file", N->getRawFile());
|
||||
@ -1790,10 +1790,10 @@ static void writeMDObjCProperty(raw_ostream &Out, const MDObjCProperty *N,
|
||||
Out << ")";
|
||||
}
|
||||
|
||||
static void writeMDImportedEntity(raw_ostream &Out, const MDImportedEntity *N,
|
||||
static void writeDIImportedEntity(raw_ostream &Out, const DIImportedEntity *N,
|
||||
TypePrinting *TypePrinter,
|
||||
SlotTracker *Machine, const Module *Context) {
|
||||
Out << "!MDImportedEntity(";
|
||||
Out << "!DIImportedEntity(";
|
||||
MDFieldPrinter Printer(Out, TypePrinter, Machine, Context);
|
||||
Printer.printTag(N);
|
||||
Printer.printString("name", N->getName());
|
||||
|
@ -87,13 +87,13 @@ void DIBuilder::finalize() {
|
||||
RetainValues.push_back(AllRetainTypes[I]);
|
||||
TempRetainTypes->replaceAllUsesWith(MDTuple::get(VMContext, RetainValues));
|
||||
|
||||
MDSubprogramArray SPs = MDTuple::get(VMContext, AllSubprograms);
|
||||
DISubprogramArray SPs = MDTuple::get(VMContext, AllSubprograms);
|
||||
TempSubprograms->replaceAllUsesWith(SPs.get());
|
||||
for (auto *SP : SPs) {
|
||||
if (MDTuple *Temp = SP->getVariables().get()) {
|
||||
const auto &PV = PreservedVariables.lookup(SP);
|
||||
SmallVector<Metadata *, 4> Variables(PV.begin(), PV.end());
|
||||
DebugNodeArray AV = getOrCreateArray(Variables);
|
||||
DINodeArray AV = getOrCreateArray(Variables);
|
||||
TempMDTuple(Temp)->replaceAllUsesWith(AV.get());
|
||||
}
|
||||
}
|
||||
@ -116,13 +116,13 @@ void DIBuilder::finalize() {
|
||||
}
|
||||
|
||||
/// If N is compile unit return NULL otherwise return N.
|
||||
static MDScope *getNonCompileUnitScope(MDScope *N) {
|
||||
if (!N || isa<MDCompileUnit>(N))
|
||||
static DIScope *getNonCompileUnitScope(DIScope *N) {
|
||||
if (!N || isa<DICompileUnit>(N))
|
||||
return nullptr;
|
||||
return cast<MDScope>(N);
|
||||
return cast<DIScope>(N);
|
||||
}
|
||||
|
||||
MDCompileUnit *DIBuilder::createCompileUnit(
|
||||
DICompileUnit *DIBuilder::createCompileUnit(
|
||||
unsigned Lang, StringRef Filename, StringRef Directory, StringRef Producer,
|
||||
bool isOptimized, StringRef Flags, unsigned RunTimeVer, StringRef SplitName,
|
||||
DebugEmissionKind Kind, bool EmitDebugInfo) {
|
||||
@ -133,7 +133,7 @@ MDCompileUnit *DIBuilder::createCompileUnit(
|
||||
assert(!Filename.empty() &&
|
||||
"Unable to create compile unit without filename");
|
||||
|
||||
// TODO: Once we make MDCompileUnit distinct, stop using temporaries here
|
||||
// TODO: Once we make DICompileUnit distinct, stop using temporaries here
|
||||
// (just start with operands assigned to nullptr).
|
||||
TempEnumTypes = MDTuple::getTemporary(VMContext, None);
|
||||
TempRetainTypes = MDTuple::getTemporary(VMContext, None);
|
||||
@ -143,8 +143,8 @@ MDCompileUnit *DIBuilder::createCompileUnit(
|
||||
|
||||
// TODO: Switch to getDistinct(). We never want to merge compile units based
|
||||
// on contents.
|
||||
MDCompileUnit *CUNode = MDCompileUnit::get(
|
||||
VMContext, Lang, MDFile::get(VMContext, Filename, Directory), Producer,
|
||||
DICompileUnit *CUNode = DICompileUnit::get(
|
||||
VMContext, Lang, DIFile::get(VMContext, Filename, Directory), Producer,
|
||||
isOptimized, Flags, RunTimeVer, SplitName, Kind, TempEnumTypes.get(),
|
||||
TempRetainTypes.get(), TempSubprograms.get(), TempGVs.get(),
|
||||
TempImportedModules.get());
|
||||
@ -163,132 +163,132 @@ MDCompileUnit *DIBuilder::createCompileUnit(
|
||||
return CUNode;
|
||||
}
|
||||
|
||||
static MDImportedEntity*
|
||||
createImportedModule(LLVMContext &C, dwarf::Tag Tag, MDScope* Context,
|
||||
static DIImportedEntity *
|
||||
createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context,
|
||||
Metadata *NS, unsigned Line, StringRef Name,
|
||||
SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
|
||||
auto *M =
|
||||
MDImportedEntity::get(C, Tag, Context, DebugNodeRef(NS), Line, Name);
|
||||
auto *M = DIImportedEntity::get(C, Tag, Context, DINodeRef(NS), Line, Name);
|
||||
AllImportedModules.emplace_back(M);
|
||||
return M;
|
||||
}
|
||||
|
||||
MDImportedEntity* DIBuilder::createImportedModule(MDScope* Context,
|
||||
MDNamespace* NS,
|
||||
unsigned Line) {
|
||||
DIImportedEntity *DIBuilder::createImportedModule(DIScope *Context,
|
||||
DINamespace *NS,
|
||||
unsigned Line) {
|
||||
return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
|
||||
Context, NS, Line, StringRef(), AllImportedModules);
|
||||
}
|
||||
|
||||
MDImportedEntity* DIBuilder::createImportedModule(MDScope* Context,
|
||||
MDImportedEntity* NS,
|
||||
unsigned Line) {
|
||||
DIImportedEntity *DIBuilder::createImportedModule(DIScope *Context,
|
||||
DIImportedEntity *NS,
|
||||
unsigned Line) {
|
||||
return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
|
||||
Context, NS, Line, StringRef(), AllImportedModules);
|
||||
}
|
||||
|
||||
MDImportedEntity *DIBuilder::createImportedDeclaration(MDScope *Context,
|
||||
DebugNode *Decl,
|
||||
DIImportedEntity *DIBuilder::createImportedDeclaration(DIScope *Context,
|
||||
DINode *Decl,
|
||||
unsigned Line,
|
||||
StringRef Name) {
|
||||
// Make sure to use the unique identifier based metadata reference for
|
||||
// types that have one.
|
||||
return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_declaration,
|
||||
Context, DebugNodeRef::get(Decl), Line, Name,
|
||||
Context, DINodeRef::get(Decl), Line, Name,
|
||||
AllImportedModules);
|
||||
}
|
||||
|
||||
MDFile* DIBuilder::createFile(StringRef Filename, StringRef Directory) {
|
||||
return MDFile::get(VMContext, Filename, Directory);
|
||||
DIFile *DIBuilder::createFile(StringRef Filename, StringRef Directory) {
|
||||
return DIFile::get(VMContext, Filename, Directory);
|
||||
}
|
||||
|
||||
MDEnumerator *DIBuilder::createEnumerator(StringRef Name, int64_t Val) {
|
||||
DIEnumerator *DIBuilder::createEnumerator(StringRef Name, int64_t Val) {
|
||||
assert(!Name.empty() && "Unable to create enumerator without name");
|
||||
return MDEnumerator::get(VMContext, Val, Name);
|
||||
return DIEnumerator::get(VMContext, Val, Name);
|
||||
}
|
||||
|
||||
MDBasicType *DIBuilder::createUnspecifiedType(StringRef Name) {
|
||||
DIBasicType *DIBuilder::createUnspecifiedType(StringRef Name) {
|
||||
assert(!Name.empty() && "Unable to create type without name");
|
||||
return MDBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name);
|
||||
return DIBasicType::get(VMContext, dwarf::DW_TAG_unspecified_type, Name);
|
||||
}
|
||||
|
||||
MDBasicType *DIBuilder::createNullPtrType() {
|
||||
DIBasicType *DIBuilder::createNullPtrType() {
|
||||
return createUnspecifiedType("decltype(nullptr)");
|
||||
}
|
||||
|
||||
MDBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
|
||||
DIBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits,
|
||||
unsigned Encoding) {
|
||||
assert(!Name.empty() && "Unable to create type without name");
|
||||
return MDBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
|
||||
return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
|
||||
AlignInBits, Encoding);
|
||||
}
|
||||
|
||||
MDDerivedType *DIBuilder::createQualifiedType(unsigned Tag, MDType *FromTy) {
|
||||
return MDDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr,
|
||||
MDTypeRef::get(FromTy), 0, 0, 0, 0);
|
||||
DIDerivedType *DIBuilder::createQualifiedType(unsigned Tag, DIType *FromTy) {
|
||||
return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr,
|
||||
DITypeRef::get(FromTy), 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
MDDerivedType *DIBuilder::createPointerType(MDType *PointeeTy,
|
||||
DIDerivedType *DIBuilder::createPointerType(DIType *PointeeTy,
|
||||
uint64_t SizeInBits,
|
||||
uint64_t AlignInBits,
|
||||
StringRef Name) {
|
||||
// FIXME: Why is there a name here?
|
||||
return MDDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
|
||||
nullptr, 0, nullptr, MDTypeRef::get(PointeeTy),
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
|
||||
nullptr, 0, nullptr, DITypeRef::get(PointeeTy),
|
||||
SizeInBits, AlignInBits, 0, 0);
|
||||
}
|
||||
|
||||
MDDerivedType *DIBuilder::createMemberPointerType(MDType *PointeeTy,
|
||||
MDType *Base,
|
||||
DIDerivedType *DIBuilder::createMemberPointerType(DIType *PointeeTy,
|
||||
DIType *Base,
|
||||
uint64_t SizeInBits,
|
||||
uint64_t AlignInBits) {
|
||||
return MDDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
|
||||
nullptr, 0, nullptr, MDTypeRef::get(PointeeTy),
|
||||
SizeInBits, AlignInBits, 0, 0, MDTypeRef::get(Base));
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
|
||||
nullptr, 0, nullptr, DITypeRef::get(PointeeTy),
|
||||
SizeInBits, AlignInBits, 0, 0,
|
||||
DITypeRef::get(Base));
|
||||
}
|
||||
|
||||
MDDerivedType *DIBuilder::createReferenceType(unsigned Tag, MDType *RTy) {
|
||||
DIDerivedType *DIBuilder::createReferenceType(unsigned Tag, DIType *RTy) {
|
||||
assert(RTy && "Unable to create reference type");
|
||||
return MDDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr,
|
||||
MDTypeRef::get(RTy), 0, 0, 0, 0);
|
||||
return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr,
|
||||
DITypeRef::get(RTy), 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
MDDerivedType *DIBuilder::createTypedef(MDType *Ty, StringRef Name,
|
||||
MDFile *File, unsigned LineNo,
|
||||
MDScope *Context) {
|
||||
return MDDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
|
||||
DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name,
|
||||
DIFile *File, unsigned LineNo,
|
||||
DIScope *Context) {
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
|
||||
LineNo,
|
||||
MDScopeRef::get(getNonCompileUnitScope(Context)),
|
||||
MDTypeRef::get(Ty), 0, 0, 0, 0);
|
||||
DIScopeRef::get(getNonCompileUnitScope(Context)),
|
||||
DITypeRef::get(Ty), 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
MDDerivedType *DIBuilder::createFriend(MDType *Ty, MDType *FriendTy) {
|
||||
DIDerivedType *DIBuilder::createFriend(DIType *Ty, DIType *FriendTy) {
|
||||
assert(Ty && "Invalid type!");
|
||||
assert(FriendTy && "Invalid friend type!");
|
||||
return MDDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0,
|
||||
MDTypeRef::get(Ty), MDTypeRef::get(FriendTy), 0, 0,
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0,
|
||||
DITypeRef::get(Ty), DITypeRef::get(FriendTy), 0, 0,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
MDDerivedType *DIBuilder::createInheritance(MDType *Ty, MDType *BaseTy,
|
||||
DIDerivedType *DIBuilder::createInheritance(DIType *Ty, DIType *BaseTy,
|
||||
uint64_t BaseOffset,
|
||||
unsigned Flags) {
|
||||
assert(Ty && "Unable to create inheritance");
|
||||
return MDDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
|
||||
0, MDTypeRef::get(Ty), MDTypeRef::get(BaseTy), 0, 0,
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
|
||||
0, DITypeRef::get(Ty), DITypeRef::get(BaseTy), 0, 0,
|
||||
BaseOffset, Flags);
|
||||
}
|
||||
|
||||
MDDerivedType *DIBuilder::createMemberType(MDScope *Scope, StringRef Name,
|
||||
MDFile *File, unsigned LineNumber,
|
||||
DIDerivedType *DIBuilder::createMemberType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits,
|
||||
uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits,
|
||||
unsigned Flags, MDType *Ty) {
|
||||
return MDDerivedType::get(
|
||||
unsigned Flags, DIType *Ty) {
|
||||
return DIDerivedType::get(
|
||||
VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
|
||||
MDScopeRef::get(getNonCompileUnitScope(Scope)), MDTypeRef::get(Ty),
|
||||
DIScopeRef::get(getNonCompileUnitScope(Scope)), DITypeRef::get(Ty),
|
||||
SizeInBits, AlignInBits, OffsetInBits, Flags);
|
||||
}
|
||||
|
||||
@ -298,91 +298,91 @@ static ConstantAsMetadata *getConstantOrNull(Constant *C) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MDDerivedType *DIBuilder::createStaticMemberType(MDScope *Scope, StringRef Name,
|
||||
MDFile *File,
|
||||
DIDerivedType *DIBuilder::createStaticMemberType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File,
|
||||
unsigned LineNumber,
|
||||
MDType *Ty, unsigned Flags,
|
||||
DIType *Ty, unsigned Flags,
|
||||
llvm::Constant *Val) {
|
||||
Flags |= DebugNode::FlagStaticMember;
|
||||
return MDDerivedType::get(
|
||||
Flags |= DINode::FlagStaticMember;
|
||||
return DIDerivedType::get(
|
||||
VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
|
||||
MDScopeRef::get(getNonCompileUnitScope(Scope)), MDTypeRef::get(Ty), 0, 0,
|
||||
DIScopeRef::get(getNonCompileUnitScope(Scope)), DITypeRef::get(Ty), 0, 0,
|
||||
0, Flags, getConstantOrNull(Val));
|
||||
}
|
||||
|
||||
MDDerivedType *DIBuilder::createObjCIVar(StringRef Name, MDFile *File,
|
||||
DIDerivedType *DIBuilder::createObjCIVar(StringRef Name, DIFile *File,
|
||||
unsigned LineNumber,
|
||||
uint64_t SizeInBits,
|
||||
uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
MDType *Ty, MDNode *PropertyNode) {
|
||||
return MDDerivedType::get(
|
||||
DIType *Ty, MDNode *PropertyNode) {
|
||||
return DIDerivedType::get(
|
||||
VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
|
||||
MDScopeRef::get(getNonCompileUnitScope(File)), MDTypeRef::get(Ty),
|
||||
DIScopeRef::get(getNonCompileUnitScope(File)), DITypeRef::get(Ty),
|
||||
SizeInBits, AlignInBits, OffsetInBits, Flags, PropertyNode);
|
||||
}
|
||||
|
||||
MDObjCProperty *
|
||||
DIBuilder::createObjCProperty(StringRef Name, MDFile *File, unsigned LineNumber,
|
||||
DIObjCProperty *
|
||||
DIBuilder::createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
StringRef GetterName, StringRef SetterName,
|
||||
unsigned PropertyAttributes, MDType *Ty) {
|
||||
return MDObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
|
||||
unsigned PropertyAttributes, DIType *Ty) {
|
||||
return DIObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
|
||||
SetterName, PropertyAttributes, Ty);
|
||||
}
|
||||
|
||||
MDTemplateTypeParameter *
|
||||
DIBuilder::createTemplateTypeParameter(MDScope *Context, StringRef Name,
|
||||
MDType *Ty) {
|
||||
assert((!Context || isa<MDCompileUnit>(Context)) && "Expected compile unit");
|
||||
return MDTemplateTypeParameter::get(VMContext, Name, MDTypeRef::get(Ty));
|
||||
DITemplateTypeParameter *
|
||||
DIBuilder::createTemplateTypeParameter(DIScope *Context, StringRef Name,
|
||||
DIType *Ty) {
|
||||
assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
|
||||
return DITemplateTypeParameter::get(VMContext, Name, DITypeRef::get(Ty));
|
||||
}
|
||||
|
||||
static MDTemplateValueParameter *
|
||||
static DITemplateValueParameter *
|
||||
createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag,
|
||||
MDScope *Context, StringRef Name, MDType *Ty,
|
||||
DIScope *Context, StringRef Name, DIType *Ty,
|
||||
Metadata *MD) {
|
||||
assert((!Context || isa<MDCompileUnit>(Context)) && "Expected compile unit");
|
||||
return MDTemplateValueParameter::get(VMContext, Tag, Name, MDTypeRef::get(Ty),
|
||||
assert((!Context || isa<DICompileUnit>(Context)) && "Expected compile unit");
|
||||
return DITemplateValueParameter::get(VMContext, Tag, Name, DITypeRef::get(Ty),
|
||||
MD);
|
||||
}
|
||||
|
||||
MDTemplateValueParameter *
|
||||
DIBuilder::createTemplateValueParameter(MDScope *Context, StringRef Name,
|
||||
MDType *Ty, Constant *Val) {
|
||||
DITemplateValueParameter *
|
||||
DIBuilder::createTemplateValueParameter(DIScope *Context, StringRef Name,
|
||||
DIType *Ty, Constant *Val) {
|
||||
return createTemplateValueParameterHelper(
|
||||
VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
|
||||
getConstantOrNull(Val));
|
||||
}
|
||||
|
||||
MDTemplateValueParameter *
|
||||
DIBuilder::createTemplateTemplateParameter(MDScope *Context, StringRef Name,
|
||||
MDType *Ty, StringRef Val) {
|
||||
DITemplateValueParameter *
|
||||
DIBuilder::createTemplateTemplateParameter(DIScope *Context, StringRef Name,
|
||||
DIType *Ty, StringRef Val) {
|
||||
return createTemplateValueParameterHelper(
|
||||
VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
|
||||
MDString::get(VMContext, Val));
|
||||
}
|
||||
|
||||
MDTemplateValueParameter *
|
||||
DIBuilder::createTemplateParameterPack(MDScope *Context, StringRef Name,
|
||||
MDType *Ty, DebugNodeArray Val) {
|
||||
DITemplateValueParameter *
|
||||
DIBuilder::createTemplateParameterPack(DIScope *Context, StringRef Name,
|
||||
DIType *Ty, DINodeArray Val) {
|
||||
return createTemplateValueParameterHelper(
|
||||
VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
|
||||
Val.get());
|
||||
}
|
||||
|
||||
MDCompositeType *DIBuilder::createClassType(
|
||||
MDScope *Context, StringRef Name, MDFile *File, unsigned LineNumber,
|
||||
DICompositeType *DIBuilder::createClassType(
|
||||
DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
unsigned Flags, MDType *DerivedFrom, DebugNodeArray Elements,
|
||||
MDType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
|
||||
assert((!Context || isa<MDScope>(Context)) &&
|
||||
unsigned Flags, DIType *DerivedFrom, DINodeArray Elements,
|
||||
DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
|
||||
assert((!Context || isa<DIScope>(Context)) &&
|
||||
"createClassType should be called with a valid Context");
|
||||
|
||||
auto *R = MDCompositeType::get(
|
||||
auto *R = DICompositeType::get(
|
||||
VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
|
||||
MDScopeRef::get(getNonCompileUnitScope(Context)),
|
||||
MDTypeRef::get(DerivedFrom), SizeInBits, AlignInBits, OffsetInBits, Flags,
|
||||
Elements, 0, MDTypeRef::get(VTableHolder),
|
||||
DIScopeRef::get(getNonCompileUnitScope(Context)),
|
||||
DITypeRef::get(DerivedFrom), SizeInBits, AlignInBits, OffsetInBits, Flags,
|
||||
Elements, 0, DITypeRef::get(VTableHolder),
|
||||
cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
|
||||
if (!UniqueIdentifier.empty())
|
||||
retainType(R);
|
||||
@ -390,29 +390,29 @@ MDCompositeType *DIBuilder::createClassType(
|
||||
return R;
|
||||
}
|
||||
|
||||
MDCompositeType *DIBuilder::createStructType(
|
||||
MDScope *Context, StringRef Name, MDFile *File, unsigned LineNumber,
|
||||
DICompositeType *DIBuilder::createStructType(
|
||||
DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
|
||||
MDType *DerivedFrom, DebugNodeArray Elements, unsigned RunTimeLang,
|
||||
MDType *VTableHolder, StringRef UniqueIdentifier) {
|
||||
auto *R = MDCompositeType::get(
|
||||
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang,
|
||||
DIType *VTableHolder, StringRef UniqueIdentifier) {
|
||||
auto *R = DICompositeType::get(
|
||||
VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
|
||||
MDScopeRef::get(getNonCompileUnitScope(Context)),
|
||||
MDTypeRef::get(DerivedFrom), SizeInBits, AlignInBits, 0, Flags, Elements,
|
||||
RunTimeLang, MDTypeRef::get(VTableHolder), nullptr, UniqueIdentifier);
|
||||
DIScopeRef::get(getNonCompileUnitScope(Context)),
|
||||
DITypeRef::get(DerivedFrom), SizeInBits, AlignInBits, 0, Flags, Elements,
|
||||
RunTimeLang, DITypeRef::get(VTableHolder), nullptr, UniqueIdentifier);
|
||||
if (!UniqueIdentifier.empty())
|
||||
retainType(R);
|
||||
trackIfUnresolved(R);
|
||||
return R;
|
||||
}
|
||||
|
||||
MDCompositeType *DIBuilder::createUnionType(
|
||||
MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
|
||||
DICompositeType *DIBuilder::createUnionType(
|
||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
|
||||
DebugNodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
|
||||
auto *R = MDCompositeType::get(
|
||||
DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
|
||||
auto *R = DICompositeType::get(
|
||||
VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
|
||||
MDScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits,
|
||||
DIScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits,
|
||||
AlignInBits, 0, Flags, Elements, RunTimeLang, nullptr, nullptr,
|
||||
UniqueIdentifier);
|
||||
if (!UniqueIdentifier.empty())
|
||||
@ -421,20 +421,20 @@ MDCompositeType *DIBuilder::createUnionType(
|
||||
return R;
|
||||
}
|
||||
|
||||
MDSubroutineType *DIBuilder::createSubroutineType(MDFile *File,
|
||||
MDTypeRefArray ParameterTypes,
|
||||
DISubroutineType *DIBuilder::createSubroutineType(DIFile *File,
|
||||
DITypeRefArray ParameterTypes,
|
||||
unsigned Flags) {
|
||||
return MDSubroutineType::get(VMContext, Flags, ParameterTypes);
|
||||
return DISubroutineType::get(VMContext, Flags, ParameterTypes);
|
||||
}
|
||||
|
||||
MDCompositeType *DIBuilder::createEnumerationType(
|
||||
MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, DebugNodeArray Elements,
|
||||
MDType *UnderlyingType, StringRef UniqueIdentifier) {
|
||||
auto *CTy = MDCompositeType::get(
|
||||
DICompositeType *DIBuilder::createEnumerationType(
|
||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, DINodeArray Elements,
|
||||
DIType *UnderlyingType, StringRef UniqueIdentifier) {
|
||||
auto *CTy = DICompositeType::get(
|
||||
VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
|
||||
MDScopeRef::get(getNonCompileUnitScope(Scope)),
|
||||
MDTypeRef::get(UnderlyingType), SizeInBits, AlignInBits, 0, 0, Elements,
|
||||
DIScopeRef::get(getNonCompileUnitScope(Scope)),
|
||||
DITypeRef::get(UnderlyingType), SizeInBits, AlignInBits, 0, 0, Elements,
|
||||
0, nullptr, nullptr, UniqueIdentifier);
|
||||
AllEnumTypes.push_back(CTy);
|
||||
if (!UniqueIdentifier.empty())
|
||||
@ -443,67 +443,67 @@ MDCompositeType *DIBuilder::createEnumerationType(
|
||||
return CTy;
|
||||
}
|
||||
|
||||
MDCompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
|
||||
MDType *Ty,
|
||||
DebugNodeArray Subscripts) {
|
||||
auto *R = MDCompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
|
||||
nullptr, 0, nullptr, MDTypeRef::get(Ty), Size,
|
||||
DICompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
|
||||
DIType *Ty,
|
||||
DINodeArray Subscripts) {
|
||||
auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
|
||||
nullptr, 0, nullptr, DITypeRef::get(Ty), Size,
|
||||
AlignInBits, 0, 0, Subscripts, 0, nullptr);
|
||||
trackIfUnresolved(R);
|
||||
return R;
|
||||
}
|
||||
|
||||
MDCompositeType *DIBuilder::createVectorType(uint64_t Size,
|
||||
uint64_t AlignInBits, MDType *Ty,
|
||||
DebugNodeArray Subscripts) {
|
||||
DICompositeType *DIBuilder::createVectorType(uint64_t Size,
|
||||
uint64_t AlignInBits, DIType *Ty,
|
||||
DINodeArray Subscripts) {
|
||||
auto *R =
|
||||
MDCompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0,
|
||||
nullptr, MDTypeRef::get(Ty), Size, AlignInBits, 0,
|
||||
DebugNode::FlagVector, Subscripts, 0, nullptr);
|
||||
DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0,
|
||||
nullptr, DITypeRef::get(Ty), Size, AlignInBits, 0,
|
||||
DINode::FlagVector, Subscripts, 0, nullptr);
|
||||
trackIfUnresolved(R);
|
||||
return R;
|
||||
}
|
||||
|
||||
static MDType *createTypeWithFlags(LLVMContext &Context, MDType *Ty,
|
||||
static DIType *createTypeWithFlags(LLVMContext &Context, DIType *Ty,
|
||||
unsigned FlagsToSet) {
|
||||
auto NewTy = Ty->clone();
|
||||
NewTy->setFlags(NewTy->getFlags() | FlagsToSet);
|
||||
return MDNode::replaceWithUniqued(std::move(NewTy));
|
||||
}
|
||||
|
||||
MDType *DIBuilder::createArtificialType(MDType *Ty) {
|
||||
DIType *DIBuilder::createArtificialType(DIType *Ty) {
|
||||
// FIXME: Restrict this to the nodes where it's valid.
|
||||
if (Ty->isArtificial())
|
||||
return Ty;
|
||||
return createTypeWithFlags(VMContext, Ty, DebugNode::FlagArtificial);
|
||||
return createTypeWithFlags(VMContext, Ty, DINode::FlagArtificial);
|
||||
}
|
||||
|
||||
MDType *DIBuilder::createObjectPointerType(MDType *Ty) {
|
||||
DIType *DIBuilder::createObjectPointerType(DIType *Ty) {
|
||||
// FIXME: Restrict this to the nodes where it's valid.
|
||||
if (Ty->isObjectPointer())
|
||||
return Ty;
|
||||
unsigned Flags = DebugNode::FlagObjectPointer | DebugNode::FlagArtificial;
|
||||
unsigned Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
|
||||
return createTypeWithFlags(VMContext, Ty, Flags);
|
||||
}
|
||||
|
||||
void DIBuilder::retainType(MDType *T) {
|
||||
void DIBuilder::retainType(DIType *T) {
|
||||
assert(T && "Expected non-null type");
|
||||
AllRetainTypes.emplace_back(T);
|
||||
}
|
||||
|
||||
MDBasicType *DIBuilder::createUnspecifiedParameter() { return nullptr; }
|
||||
DIBasicType *DIBuilder::createUnspecifiedParameter() { return nullptr; }
|
||||
|
||||
MDCompositeType*
|
||||
DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, MDScope * Scope,
|
||||
MDFile* F, unsigned Line, unsigned RuntimeLang,
|
||||
DICompositeType *
|
||||
DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope,
|
||||
DIFile *F, unsigned Line, unsigned RuntimeLang,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
StringRef UniqueIdentifier) {
|
||||
// FIXME: Define in terms of createReplaceableForwardDecl() by calling
|
||||
// replaceWithUniqued().
|
||||
auto *RetTy = MDCompositeType::get(
|
||||
auto *RetTy = DICompositeType::get(
|
||||
VMContext, Tag, Name, F, Line,
|
||||
MDScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits,
|
||||
AlignInBits, 0, DebugNode::FlagFwdDecl, nullptr, RuntimeLang, nullptr,
|
||||
DIScopeRef::get(getNonCompileUnitScope(Scope)), nullptr, SizeInBits,
|
||||
AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang, nullptr,
|
||||
nullptr, UniqueIdentifier);
|
||||
if (!UniqueIdentifier.empty())
|
||||
retainType(RetTy);
|
||||
@ -511,118 +511,119 @@ DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, MDScope * Scope,
|
||||
return RetTy;
|
||||
}
|
||||
|
||||
MDCompositeType* DIBuilder::createReplaceableCompositeType(
|
||||
unsigned Tag, StringRef Name, MDScope * Scope, MDFile* F, unsigned Line,
|
||||
DICompositeType *DIBuilder::createReplaceableCompositeType(
|
||||
unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
|
||||
unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
unsigned Flags, StringRef UniqueIdentifier) {
|
||||
auto *RetTy = MDCompositeType::getTemporary(
|
||||
auto *RetTy = DICompositeType::getTemporary(
|
||||
VMContext, Tag, Name, F, Line,
|
||||
MDScopeRef::get(getNonCompileUnitScope(Scope)), nullptr,
|
||||
DIScopeRef::get(getNonCompileUnitScope(Scope)), nullptr,
|
||||
SizeInBits, AlignInBits, 0, Flags, nullptr, RuntimeLang,
|
||||
nullptr, nullptr, UniqueIdentifier).release();
|
||||
nullptr, nullptr, UniqueIdentifier)
|
||||
.release();
|
||||
if (!UniqueIdentifier.empty())
|
||||
retainType(RetTy);
|
||||
trackIfUnresolved(RetTy);
|
||||
return RetTy;
|
||||
}
|
||||
|
||||
DebugNodeArray DIBuilder::getOrCreateArray(ArrayRef<Metadata *> Elements) {
|
||||
DINodeArray DIBuilder::getOrCreateArray(ArrayRef<Metadata *> Elements) {
|
||||
return MDTuple::get(VMContext, Elements);
|
||||
}
|
||||
|
||||
MDTypeRefArray DIBuilder::getOrCreateTypeArray(ArrayRef<Metadata *> Elements) {
|
||||
DITypeRefArray DIBuilder::getOrCreateTypeArray(ArrayRef<Metadata *> Elements) {
|
||||
SmallVector<llvm::Metadata *, 16> Elts;
|
||||
for (unsigned i = 0, e = Elements.size(); i != e; ++i) {
|
||||
if (Elements[i] && isa<MDNode>(Elements[i]))
|
||||
Elts.push_back(MDTypeRef::get(cast<MDType>(Elements[i])));
|
||||
Elts.push_back(DITypeRef::get(cast<DIType>(Elements[i])));
|
||||
else
|
||||
Elts.push_back(Elements[i]);
|
||||
}
|
||||
return MDTypeRefArray(MDNode::get(VMContext, Elts));
|
||||
return DITypeRefArray(MDNode::get(VMContext, Elts));
|
||||
}
|
||||
|
||||
MDSubrange *DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
|
||||
return MDSubrange::get(VMContext, Count, Lo);
|
||||
DISubrange *DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
|
||||
return DISubrange::get(VMContext, Count, Lo);
|
||||
}
|
||||
|
||||
static void checkGlobalVariableScope(MDScope * Context) {
|
||||
static void checkGlobalVariableScope(DIScope *Context) {
|
||||
#ifndef NDEBUG
|
||||
if (auto *CT =
|
||||
dyn_cast_or_null<MDCompositeType>(getNonCompileUnitScope(Context)))
|
||||
dyn_cast_or_null<DICompositeType>(getNonCompileUnitScope(Context)))
|
||||
assert(CT->getIdentifier().empty() &&
|
||||
"Context of a global variable should not be a type with identifier");
|
||||
#endif
|
||||
}
|
||||
|
||||
MDGlobalVariable *DIBuilder::createGlobalVariable(
|
||||
MDScope *Context, StringRef Name, StringRef LinkageName, MDFile *F,
|
||||
unsigned LineNumber, MDType *Ty, bool isLocalToUnit, Constant *Val,
|
||||
DIGlobalVariable *DIBuilder::createGlobalVariable(
|
||||
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
|
||||
unsigned LineNumber, DIType *Ty, bool isLocalToUnit, Constant *Val,
|
||||
MDNode *Decl) {
|
||||
checkGlobalVariableScope(Context);
|
||||
|
||||
auto *N = MDGlobalVariable::get(VMContext, cast_or_null<MDScope>(Context),
|
||||
auto *N = DIGlobalVariable::get(VMContext, cast_or_null<DIScope>(Context),
|
||||
Name, LinkageName, F, LineNumber,
|
||||
MDTypeRef::get(Ty), isLocalToUnit, true, Val,
|
||||
cast_or_null<MDDerivedType>(Decl));
|
||||
DITypeRef::get(Ty), isLocalToUnit, true, Val,
|
||||
cast_or_null<DIDerivedType>(Decl));
|
||||
AllGVs.push_back(N);
|
||||
return N;
|
||||
}
|
||||
|
||||
MDGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl(
|
||||
MDScope *Context, StringRef Name, StringRef LinkageName, MDFile *F,
|
||||
unsigned LineNumber, MDType *Ty, bool isLocalToUnit, Constant *Val,
|
||||
DIGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl(
|
||||
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
|
||||
unsigned LineNumber, DIType *Ty, bool isLocalToUnit, Constant *Val,
|
||||
MDNode *Decl) {
|
||||
checkGlobalVariableScope(Context);
|
||||
|
||||
return MDGlobalVariable::getTemporary(
|
||||
VMContext, cast_or_null<MDScope>(Context), Name, LinkageName, F,
|
||||
LineNumber, MDTypeRef::get(Ty), isLocalToUnit, false, Val,
|
||||
cast_or_null<MDDerivedType>(Decl))
|
||||
return DIGlobalVariable::getTemporary(
|
||||
VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
|
||||
LineNumber, DITypeRef::get(Ty), isLocalToUnit, false, Val,
|
||||
cast_or_null<DIDerivedType>(Decl))
|
||||
.release();
|
||||
}
|
||||
|
||||
MDLocalVariable *DIBuilder::createLocalVariable(
|
||||
unsigned Tag, MDScope *Scope, StringRef Name, MDFile *File, unsigned LineNo,
|
||||
MDType *Ty, bool AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
|
||||
DILocalVariable *DIBuilder::createLocalVariable(
|
||||
unsigned Tag, DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
|
||||
DIType *Ty, bool AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
|
||||
// FIXME: Why getNonCompileUnitScope()?
|
||||
// FIXME: Why is "!Context" okay here?
|
||||
// FIXME: WHy doesn't this check for a subprogram or lexical block (AFAICT
|
||||
// the only valid scopes)?
|
||||
MDScope* Context = getNonCompileUnitScope(Scope);
|
||||
DIScope *Context = getNonCompileUnitScope(Scope);
|
||||
|
||||
auto *Node = MDLocalVariable::get(
|
||||
VMContext, Tag, cast_or_null<MDLocalScope>(Context), Name, File, LineNo,
|
||||
MDTypeRef::get(Ty), ArgNo, Flags);
|
||||
auto *Node = DILocalVariable::get(
|
||||
VMContext, Tag, cast_or_null<DILocalScope>(Context), Name, File, LineNo,
|
||||
DITypeRef::get(Ty), ArgNo, Flags);
|
||||
if (AlwaysPreserve) {
|
||||
// The optimizer may remove local variable. If there is an interest
|
||||
// to preserve variable info in such situation then stash it in a
|
||||
// named mdnode.
|
||||
MDSubprogram *Fn = getDISubprogram(Scope);
|
||||
DISubprogram *Fn = getDISubprogram(Scope);
|
||||
assert(Fn && "Missing subprogram for local variable");
|
||||
PreservedVariables[Fn].emplace_back(Node);
|
||||
}
|
||||
return Node;
|
||||
}
|
||||
|
||||
MDExpression* DIBuilder::createExpression(ArrayRef<uint64_t> Addr) {
|
||||
return MDExpression::get(VMContext, Addr);
|
||||
DIExpression *DIBuilder::createExpression(ArrayRef<uint64_t> Addr) {
|
||||
return DIExpression::get(VMContext, Addr);
|
||||
}
|
||||
|
||||
MDExpression* DIBuilder::createExpression(ArrayRef<int64_t> Signed) {
|
||||
DIExpression *DIBuilder::createExpression(ArrayRef<int64_t> Signed) {
|
||||
// TODO: Remove the callers of this signed version and delete.
|
||||
SmallVector<uint64_t, 8> Addr(Signed.begin(), Signed.end());
|
||||
return createExpression(Addr);
|
||||
}
|
||||
|
||||
MDExpression* DIBuilder::createBitPieceExpression(unsigned OffsetInBytes,
|
||||
unsigned SizeInBytes) {
|
||||
DIExpression *DIBuilder::createBitPieceExpression(unsigned OffsetInBytes,
|
||||
unsigned SizeInBytes) {
|
||||
uint64_t Addr[] = {dwarf::DW_OP_bit_piece, OffsetInBytes, SizeInBytes};
|
||||
return MDExpression::get(VMContext, Addr);
|
||||
return DIExpression::get(VMContext, Addr);
|
||||
}
|
||||
|
||||
MDSubprogram *DIBuilder::createFunction(MDScopeRef Context, StringRef Name,
|
||||
StringRef LinkageName, MDFile *File,
|
||||
unsigned LineNo, MDSubroutineType *Ty,
|
||||
DISubprogram *DIBuilder::createFunction(DIScopeRef Context, StringRef Name,
|
||||
StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DISubroutineType *Ty,
|
||||
bool isLocalToUnit, bool isDefinition,
|
||||
unsigned ScopeLine, unsigned Flags,
|
||||
bool isOptimized, Function *Fn,
|
||||
@ -635,20 +636,20 @@ MDSubprogram *DIBuilder::createFunction(MDScopeRef Context, StringRef Name,
|
||||
Flags, isOptimized, Fn, TParams, Decl);
|
||||
}
|
||||
|
||||
MDSubprogram* DIBuilder::createFunction(MDScope * Context, StringRef Name,
|
||||
StringRef LinkageName, MDFile* File,
|
||||
unsigned LineNo, MDSubroutineType* Ty,
|
||||
bool isLocalToUnit, bool isDefinition,
|
||||
unsigned ScopeLine, unsigned Flags,
|
||||
bool isOptimized, Function *Fn,
|
||||
MDNode *TParams, MDNode *Decl) {
|
||||
DISubprogram *DIBuilder::createFunction(DIScope *Context, StringRef Name,
|
||||
StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DISubroutineType *Ty,
|
||||
bool isLocalToUnit, bool isDefinition,
|
||||
unsigned ScopeLine, unsigned Flags,
|
||||
bool isOptimized, Function *Fn,
|
||||
MDNode *TParams, MDNode *Decl) {
|
||||
assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type &&
|
||||
"function types should be subroutines");
|
||||
auto *Node = MDSubprogram::get(
|
||||
VMContext, MDScopeRef::get(getNonCompileUnitScope(Context)), Name,
|
||||
LinkageName, File, LineNo, Ty,
|
||||
isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized,
|
||||
Fn, cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl),
|
||||
auto *Node = DISubprogram::get(
|
||||
VMContext, DIScopeRef::get(getNonCompileUnitScope(Context)), Name,
|
||||
LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine,
|
||||
nullptr, 0, 0, Flags, isOptimized, Fn, cast_or_null<MDTuple>(TParams),
|
||||
cast_or_null<DISubprogram>(Decl),
|
||||
MDTuple::getTemporary(VMContext, None).release());
|
||||
|
||||
if (isDefinition)
|
||||
@ -657,27 +658,25 @@ MDSubprogram* DIBuilder::createFunction(MDScope * Context, StringRef Name,
|
||||
return Node;
|
||||
}
|
||||
|
||||
MDSubprogram*
|
||||
DIBuilder::createTempFunctionFwdDecl(MDScope * Context, StringRef Name,
|
||||
StringRef LinkageName, MDFile* File,
|
||||
unsigned LineNo, MDSubroutineType* Ty,
|
||||
bool isLocalToUnit, bool isDefinition,
|
||||
unsigned ScopeLine, unsigned Flags,
|
||||
bool isOptimized, Function *Fn,
|
||||
MDNode *TParams, MDNode *Decl) {
|
||||
return MDSubprogram::getTemporary(
|
||||
VMContext, MDScopeRef::get(getNonCompileUnitScope(Context)), Name,
|
||||
LinkageName, File, LineNo, Ty,
|
||||
isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags,
|
||||
isOptimized, Fn, cast_or_null<MDTuple>(TParams),
|
||||
cast_or_null<MDSubprogram>(Decl), nullptr).release();
|
||||
DISubprogram *DIBuilder::createTempFunctionFwdDecl(
|
||||
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
||||
bool isDefinition, unsigned ScopeLine, unsigned Flags, bool isOptimized,
|
||||
Function *Fn, MDNode *TParams, MDNode *Decl) {
|
||||
return DISubprogram::getTemporary(
|
||||
VMContext, DIScopeRef::get(getNonCompileUnitScope(Context)), Name,
|
||||
LinkageName, File, LineNo, Ty, isLocalToUnit, isDefinition,
|
||||
ScopeLine, nullptr, 0, 0, Flags, isOptimized, Fn,
|
||||
cast_or_null<MDTuple>(TParams), cast_or_null<DISubprogram>(Decl),
|
||||
nullptr)
|
||||
.release();
|
||||
}
|
||||
|
||||
MDSubprogram *
|
||||
DIBuilder::createMethod(MDScope *Context, StringRef Name, StringRef LinkageName,
|
||||
MDFile *F, unsigned LineNo, MDSubroutineType *Ty,
|
||||
DISubprogram *
|
||||
DIBuilder::createMethod(DIScope *Context, StringRef Name, StringRef LinkageName,
|
||||
DIFile *F, unsigned LineNo, DISubroutineType *Ty,
|
||||
bool isLocalToUnit, bool isDefinition, unsigned VK,
|
||||
unsigned VIndex, MDType *VTableHolder, unsigned Flags,
|
||||
unsigned VIndex, DIType *VTableHolder, unsigned Flags,
|
||||
bool isOptimized, Function *Fn, MDNode *TParam) {
|
||||
assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type &&
|
||||
"function types should be subroutines");
|
||||
@ -685,10 +684,10 @@ DIBuilder::createMethod(MDScope *Context, StringRef Name, StringRef LinkageName,
|
||||
"Methods should have both a Context and a context that isn't "
|
||||
"the compile unit.");
|
||||
// FIXME: Do we want to use different scope/lines?
|
||||
auto *SP = MDSubprogram::get(
|
||||
VMContext, MDScopeRef::get(cast<MDScope>(Context)), Name, LinkageName, F,
|
||||
auto *SP = DISubprogram::get(
|
||||
VMContext, DIScopeRef::get(cast<DIScope>(Context)), Name, LinkageName, F,
|
||||
LineNo, Ty, isLocalToUnit, isDefinition, LineNo,
|
||||
MDTypeRef::get(VTableHolder), VK, VIndex, Flags, isOptimized, Fn,
|
||||
DITypeRef::get(VTableHolder), VK, VIndex, Flags, isOptimized, Fn,
|
||||
cast_or_null<MDTuple>(TParam), nullptr, nullptr);
|
||||
|
||||
if (isDefinition)
|
||||
@ -697,23 +696,23 @@ DIBuilder::createMethod(MDScope *Context, StringRef Name, StringRef LinkageName,
|
||||
return SP;
|
||||
}
|
||||
|
||||
MDNamespace* DIBuilder::createNameSpace(MDScope * Scope, StringRef Name,
|
||||
MDFile* File, unsigned LineNo) {
|
||||
return MDNamespace::get(VMContext, getNonCompileUnitScope(Scope), File, Name,
|
||||
DINamespace *DIBuilder::createNameSpace(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNo) {
|
||||
return DINamespace::get(VMContext, getNonCompileUnitScope(Scope), File, Name,
|
||||
LineNo);
|
||||
}
|
||||
|
||||
MDLexicalBlockFile* DIBuilder::createLexicalBlockFile(MDScope * Scope,
|
||||
MDFile* File,
|
||||
unsigned Discriminator) {
|
||||
return MDLexicalBlockFile::get(VMContext, Scope, File, Discriminator);
|
||||
DILexicalBlockFile *DIBuilder::createLexicalBlockFile(DIScope *Scope,
|
||||
DIFile *File,
|
||||
unsigned Discriminator) {
|
||||
return DILexicalBlockFile::get(VMContext, Scope, File, Discriminator);
|
||||
}
|
||||
|
||||
MDLexicalBlock* DIBuilder::createLexicalBlock(MDScope * Scope, MDFile* File,
|
||||
unsigned Line, unsigned Col) {
|
||||
DILexicalBlock *DIBuilder::createLexicalBlock(DIScope *Scope, DIFile *File,
|
||||
unsigned Line, unsigned Col) {
|
||||
// Make these distinct, to avoid merging two lexical blocks on the same
|
||||
// file/line/column.
|
||||
return MDLexicalBlock::getDistinct(VMContext, getNonCompileUnitScope(Scope),
|
||||
return DILexicalBlock::getDistinct(VMContext, getNonCompileUnitScope(Scope),
|
||||
File, Line, Col);
|
||||
}
|
||||
|
||||
@ -722,15 +721,15 @@ static Value *getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V) {
|
||||
return MetadataAsValue::get(VMContext, ValueAsMetadata::get(V));
|
||||
}
|
||||
|
||||
static Instruction *withDebugLoc(Instruction *I, const MDLocation *DL) {
|
||||
I->setDebugLoc(const_cast<MDLocation *>(DL));
|
||||
static Instruction *withDebugLoc(Instruction *I, const DILocation *DL) {
|
||||
I->setDebugLoc(const_cast<DILocation *>(DL));
|
||||
return I;
|
||||
}
|
||||
|
||||
Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo,
|
||||
MDExpression* Expr, const MDLocation *DL,
|
||||
Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
|
||||
DIExpression *Expr, const DILocation *DL,
|
||||
Instruction *InsertBefore) {
|
||||
assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.declare");
|
||||
assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare");
|
||||
assert(DL && "Expected debug loc");
|
||||
assert(DL->getScope()->getSubprogram() ==
|
||||
VarInfo->getScope()->getSubprogram() &&
|
||||
@ -746,10 +745,10 @@ Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo,
|
||||
return withDebugLoc(CallInst::Create(DeclareFn, Args, "", InsertBefore), DL);
|
||||
}
|
||||
|
||||
Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo,
|
||||
MDExpression* Expr, const MDLocation *DL,
|
||||
Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
|
||||
DIExpression *Expr, const DILocation *DL,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.declare");
|
||||
assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.declare");
|
||||
assert(DL && "Expected debug loc");
|
||||
assert(DL->getScope()->getSubprogram() ==
|
||||
VarInfo->getScope()->getSubprogram() &&
|
||||
@ -771,12 +770,12 @@ Instruction *DIBuilder::insertDeclare(Value *Storage, MDLocalVariable* VarInfo,
|
||||
}
|
||||
|
||||
Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
|
||||
MDLocalVariable* VarInfo,
|
||||
MDExpression* Expr,
|
||||
const MDLocation *DL,
|
||||
DILocalVariable *VarInfo,
|
||||
DIExpression *Expr,
|
||||
const DILocation *DL,
|
||||
Instruction *InsertBefore) {
|
||||
assert(V && "no value passed to dbg.value");
|
||||
assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.value");
|
||||
assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.value");
|
||||
assert(DL && "Expected debug loc");
|
||||
assert(DL->getScope()->getSubprogram() ==
|
||||
VarInfo->getScope()->getSubprogram() &&
|
||||
@ -794,12 +793,12 @@ Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
|
||||
}
|
||||
|
||||
Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
|
||||
MDLocalVariable* VarInfo,
|
||||
MDExpression* Expr,
|
||||
const MDLocation *DL,
|
||||
DILocalVariable *VarInfo,
|
||||
DIExpression *Expr,
|
||||
const DILocation *DL,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
assert(V && "no value passed to dbg.value");
|
||||
assert(VarInfo && "empty or invalid MDLocalVariable* passed to dbg.value");
|
||||
assert(VarInfo && "empty or invalid DILocalVariable* passed to dbg.value");
|
||||
assert(DL && "Expected debug loc");
|
||||
assert(DL->getScope()->getSubprogram() ==
|
||||
VarInfo->getScope()->getSubprogram() &&
|
||||
@ -817,10 +816,11 @@ Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
|
||||
return withDebugLoc(CallInst::Create(ValueFn, Args, "", InsertAtEnd), DL);
|
||||
}
|
||||
|
||||
void DIBuilder::replaceVTableHolder(MDCompositeType* &T, MDCompositeType* VTableHolder) {
|
||||
void DIBuilder::replaceVTableHolder(DICompositeType *&T,
|
||||
DICompositeType *VTableHolder) {
|
||||
{
|
||||
TypedTrackingMDRef<MDCompositeType> N(T);
|
||||
N->replaceVTableHolder(MDTypeRef::get(VTableHolder));
|
||||
TypedTrackingMDRef<DICompositeType> N(T);
|
||||
N->replaceVTableHolder(DITypeRef::get(VTableHolder));
|
||||
T = N.get();
|
||||
}
|
||||
|
||||
@ -836,14 +836,14 @@ void DIBuilder::replaceVTableHolder(MDCompositeType* &T, MDCompositeType* VTable
|
||||
trackIfUnresolved(N);
|
||||
}
|
||||
|
||||
void DIBuilder::replaceArrays(MDCompositeType *&T, DebugNodeArray Elements,
|
||||
DebugNodeArray TParams) {
|
||||
void DIBuilder::replaceArrays(DICompositeType *&T, DINodeArray Elements,
|
||||
DINodeArray TParams) {
|
||||
{
|
||||
TypedTrackingMDRef<MDCompositeType> N(T);
|
||||
TypedTrackingMDRef<DICompositeType> N(T);
|
||||
if (Elements)
|
||||
N->replaceElements(Elements);
|
||||
if (TParams)
|
||||
N->replaceTemplateParams(MDTemplateParameterArray(TParams));
|
||||
N->replaceTemplateParams(DITemplateParameterArray(TParams));
|
||||
T = N.get();
|
||||
}
|
||||
|
||||
|
@ -33,13 +33,13 @@
|
||||
using namespace llvm;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
MDSubprogram *llvm::getDISubprogram(const MDNode *Scope) {
|
||||
if (auto *LocalScope = dyn_cast_or_null<MDLocalScope>(Scope))
|
||||
DISubprogram *llvm::getDISubprogram(const MDNode *Scope) {
|
||||
if (auto *LocalScope = dyn_cast_or_null<DILocalScope>(Scope))
|
||||
return LocalScope->getSubprogram();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MDSubprogram *llvm::getDISubprogram(const Function *F) {
|
||||
DISubprogram *llvm::getDISubprogram(const Function *F) {
|
||||
// We look for the first instr that has a debug annotation leading back to F.
|
||||
for (auto &BB : *F) {
|
||||
auto Inst = std::find_if(BB.begin(), BB.end(), [](const Instruction &Inst) {
|
||||
@ -56,11 +56,11 @@ MDSubprogram *llvm::getDISubprogram(const Function *F) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MDCompositeTypeBase *llvm::getDICompositeType(MDType *T) {
|
||||
if (auto *C = dyn_cast_or_null<MDCompositeTypeBase>(T))
|
||||
DICompositeTypeBase *llvm::getDICompositeType(DIType *T) {
|
||||
if (auto *C = dyn_cast_or_null<DICompositeTypeBase>(T))
|
||||
return C;
|
||||
|
||||
if (auto *D = dyn_cast_or_null<MDDerivedTypeBase>(T)) {
|
||||
if (auto *D = dyn_cast_or_null<DIDerivedTypeBase>(T)) {
|
||||
// This function is currently used by dragonegg and dragonegg does
|
||||
// not generate identifier for types, so using an empty map to resolve
|
||||
// DerivedFrom should be fine.
|
||||
@ -75,12 +75,12 @@ DITypeIdentifierMap
|
||||
llvm::generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes) {
|
||||
DITypeIdentifierMap Map;
|
||||
for (unsigned CUi = 0, CUe = CU_Nodes->getNumOperands(); CUi != CUe; ++CUi) {
|
||||
auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(CUi));
|
||||
DebugNodeArray Retain = CU->getRetainedTypes();
|
||||
auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(CUi));
|
||||
DINodeArray Retain = CU->getRetainedTypes();
|
||||
for (unsigned Ti = 0, Te = Retain.size(); Ti != Te; ++Ti) {
|
||||
if (!isa<MDCompositeType>(Retain[Ti]))
|
||||
if (!isa<DICompositeType>(Retain[Ti]))
|
||||
continue;
|
||||
auto *Ty = cast<MDCompositeType>(Retain[Ti]);
|
||||
auto *Ty = cast<DICompositeType>(Retain[Ti]);
|
||||
if (MDString *TypeId = Ty->getRawIdentifier()) {
|
||||
// Definition has priority over declaration.
|
||||
// Try to insert (TypeId, Ty) to Map.
|
||||
@ -123,7 +123,7 @@ void DebugInfoFinder::processModule(const Module &M) {
|
||||
InitializeTypeMap(M);
|
||||
if (NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu")) {
|
||||
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
|
||||
auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(i));
|
||||
auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i));
|
||||
addCompileUnit(CU);
|
||||
for (auto *DIG : CU->getGlobalVariables()) {
|
||||
if (addGlobalVariable(DIG)) {
|
||||
@ -139,18 +139,18 @@ void DebugInfoFinder::processModule(const Module &M) {
|
||||
processType(RT);
|
||||
for (auto *Import : CU->getImportedEntities()) {
|
||||
auto *Entity = Import->getEntity().resolve(TypeIdentifierMap);
|
||||
if (auto *T = dyn_cast<MDType>(Entity))
|
||||
if (auto *T = dyn_cast<DIType>(Entity))
|
||||
processType(T);
|
||||
else if (auto *SP = dyn_cast<MDSubprogram>(Entity))
|
||||
else if (auto *SP = dyn_cast<DISubprogram>(Entity))
|
||||
processSubprogram(SP);
|
||||
else if (auto *NS = dyn_cast<MDNamespace>(Entity))
|
||||
else if (auto *NS = dyn_cast<DINamespace>(Entity))
|
||||
processScope(NS->getScope());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DebugInfoFinder::processLocation(const Module &M, const MDLocation *Loc) {
|
||||
void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) {
|
||||
if (!Loc)
|
||||
return;
|
||||
InitializeTypeMap(M);
|
||||
@ -158,61 +158,61 @@ void DebugInfoFinder::processLocation(const Module &M, const MDLocation *Loc) {
|
||||
processLocation(M, Loc->getInlinedAt());
|
||||
}
|
||||
|
||||
void DebugInfoFinder::processType(MDType *DT) {
|
||||
void DebugInfoFinder::processType(DIType *DT) {
|
||||
if (!addType(DT))
|
||||
return;
|
||||
processScope(DT->getScope().resolve(TypeIdentifierMap));
|
||||
if (auto *DCT = dyn_cast<MDCompositeTypeBase>(DT)) {
|
||||
if (auto *DCT = dyn_cast<DICompositeTypeBase>(DT)) {
|
||||
processType(DCT->getBaseType().resolve(TypeIdentifierMap));
|
||||
if (auto *ST = dyn_cast<MDSubroutineType>(DCT)) {
|
||||
for (MDTypeRef Ref : ST->getTypeArray())
|
||||
if (auto *ST = dyn_cast<DISubroutineType>(DCT)) {
|
||||
for (DITypeRef Ref : ST->getTypeArray())
|
||||
processType(Ref.resolve(TypeIdentifierMap));
|
||||
return;
|
||||
}
|
||||
for (Metadata *D : DCT->getElements()) {
|
||||
if (auto *T = dyn_cast<MDType>(D))
|
||||
if (auto *T = dyn_cast<DIType>(D))
|
||||
processType(T);
|
||||
else if (auto *SP = dyn_cast<MDSubprogram>(D))
|
||||
else if (auto *SP = dyn_cast<DISubprogram>(D))
|
||||
processSubprogram(SP);
|
||||
}
|
||||
} else if (auto *DDT = dyn_cast<MDDerivedTypeBase>(DT)) {
|
||||
} else if (auto *DDT = dyn_cast<DIDerivedTypeBase>(DT)) {
|
||||
processType(DDT->getBaseType().resolve(TypeIdentifierMap));
|
||||
}
|
||||
}
|
||||
|
||||
void DebugInfoFinder::processScope(MDScope *Scope) {
|
||||
void DebugInfoFinder::processScope(DIScope *Scope) {
|
||||
if (!Scope)
|
||||
return;
|
||||
if (auto *Ty = dyn_cast<MDType>(Scope)) {
|
||||
if (auto *Ty = dyn_cast<DIType>(Scope)) {
|
||||
processType(Ty);
|
||||
return;
|
||||
}
|
||||
if (auto *CU = dyn_cast<MDCompileUnit>(Scope)) {
|
||||
if (auto *CU = dyn_cast<DICompileUnit>(Scope)) {
|
||||
addCompileUnit(CU);
|
||||
return;
|
||||
}
|
||||
if (auto *SP = dyn_cast<MDSubprogram>(Scope)) {
|
||||
if (auto *SP = dyn_cast<DISubprogram>(Scope)) {
|
||||
processSubprogram(SP);
|
||||
return;
|
||||
}
|
||||
if (!addScope(Scope))
|
||||
return;
|
||||
if (auto *LB = dyn_cast<MDLexicalBlockBase>(Scope)) {
|
||||
if (auto *LB = dyn_cast<DILexicalBlockBase>(Scope)) {
|
||||
processScope(LB->getScope());
|
||||
} else if (auto *NS = dyn_cast<MDNamespace>(Scope)) {
|
||||
} else if (auto *NS = dyn_cast<DINamespace>(Scope)) {
|
||||
processScope(NS->getScope());
|
||||
}
|
||||
}
|
||||
|
||||
void DebugInfoFinder::processSubprogram(MDSubprogram *SP) {
|
||||
void DebugInfoFinder::processSubprogram(DISubprogram *SP) {
|
||||
if (!addSubprogram(SP))
|
||||
return;
|
||||
processScope(SP->getScope().resolve(TypeIdentifierMap));
|
||||
processType(SP->getType());
|
||||
for (auto *Element : SP->getTemplateParams()) {
|
||||
if (auto *TType = dyn_cast<MDTemplateTypeParameter>(Element)) {
|
||||
if (auto *TType = dyn_cast<DITemplateTypeParameter>(Element)) {
|
||||
processType(TType->getType().resolve(TypeIdentifierMap));
|
||||
} else if (auto *TVal = dyn_cast<MDTemplateValueParameter>(Element)) {
|
||||
} else if (auto *TVal = dyn_cast<DITemplateValueParameter>(Element)) {
|
||||
processType(TVal->getType().resolve(TypeIdentifierMap));
|
||||
}
|
||||
}
|
||||
@ -225,7 +225,7 @@ void DebugInfoFinder::processDeclare(const Module &M,
|
||||
return;
|
||||
InitializeTypeMap(M);
|
||||
|
||||
auto *DV = dyn_cast<MDLocalVariable>(N);
|
||||
auto *DV = dyn_cast<DILocalVariable>(N);
|
||||
if (!DV)
|
||||
return;
|
||||
|
||||
@ -241,7 +241,7 @@ void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
|
||||
return;
|
||||
InitializeTypeMap(M);
|
||||
|
||||
auto *DV = dyn_cast<MDLocalVariable>(N);
|
||||
auto *DV = dyn_cast<DILocalVariable>(N);
|
||||
if (!DV)
|
||||
return;
|
||||
|
||||
@ -251,18 +251,18 @@ void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
|
||||
processType(DV->getType().resolve(TypeIdentifierMap));
|
||||
}
|
||||
|
||||
bool DebugInfoFinder::addType(MDType *DT) {
|
||||
bool DebugInfoFinder::addType(DIType *DT) {
|
||||
if (!DT)
|
||||
return false;
|
||||
|
||||
if (!NodesSeen.insert(DT).second)
|
||||
return false;
|
||||
|
||||
TYs.push_back(const_cast<MDType *>(DT));
|
||||
TYs.push_back(const_cast<DIType *>(DT));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DebugInfoFinder::addCompileUnit(MDCompileUnit *CU) {
|
||||
bool DebugInfoFinder::addCompileUnit(DICompileUnit *CU) {
|
||||
if (!CU)
|
||||
return false;
|
||||
if (!NodesSeen.insert(CU).second)
|
||||
@ -272,7 +272,7 @@ bool DebugInfoFinder::addCompileUnit(MDCompileUnit *CU) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DebugInfoFinder::addGlobalVariable(MDGlobalVariable *DIG) {
|
||||
bool DebugInfoFinder::addGlobalVariable(DIGlobalVariable *DIG) {
|
||||
if (!DIG)
|
||||
return false;
|
||||
|
||||
@ -283,7 +283,7 @@ bool DebugInfoFinder::addGlobalVariable(MDGlobalVariable *DIG) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DebugInfoFinder::addSubprogram(MDSubprogram *SP) {
|
||||
bool DebugInfoFinder::addSubprogram(DISubprogram *SP) {
|
||||
if (!SP)
|
||||
return false;
|
||||
|
||||
@ -294,7 +294,7 @@ bool DebugInfoFinder::addSubprogram(MDSubprogram *SP) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DebugInfoFinder::addScope(MDScope *Scope) {
|
||||
bool DebugInfoFinder::addScope(DIScope *Scope) {
|
||||
if (!Scope)
|
||||
return false;
|
||||
// FIXME: Ocaml binding generates a scope with no content, we treat it
|
||||
@ -369,16 +369,16 @@ unsigned llvm::getDebugMetadataVersionFromModule(const Module &M) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DenseMap<const llvm::Function *, MDSubprogram *>
|
||||
DenseMap<const llvm::Function *, DISubprogram *>
|
||||
llvm::makeSubprogramMap(const Module &M) {
|
||||
DenseMap<const Function *, MDSubprogram *> R;
|
||||
DenseMap<const Function *, DISubprogram *> R;
|
||||
|
||||
NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu");
|
||||
if (!CU_Nodes)
|
||||
return R;
|
||||
|
||||
for (MDNode *N : CU_Nodes->operands()) {
|
||||
auto *CUNode = cast<MDCompileUnit>(N);
|
||||
auto *CUNode = cast<DICompileUnit>(N);
|
||||
for (auto *SP : CUNode->getSubprograms()) {
|
||||
if (Function *F = SP->getFunction())
|
||||
R.insert(std::make_pair(F, SP));
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
MDLocation::MDLocation(LLVMContext &C, StorageType Storage, unsigned Line,
|
||||
DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line,
|
||||
unsigned Column, ArrayRef<Metadata *> MDs)
|
||||
: MDNode(C, MDLocationKind, Storage, MDs) {
|
||||
: MDNode(C, DILocationKind, Storage, MDs) {
|
||||
assert((MDs.size() == 1 || MDs.size() == 2) &&
|
||||
"Expected a scope and optional inlined-at");
|
||||
|
||||
@ -38,7 +38,7 @@ static void adjustColumn(unsigned &Column) {
|
||||
Column = 0;
|
||||
}
|
||||
|
||||
MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line,
|
||||
DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line,
|
||||
unsigned Column, Metadata *Scope,
|
||||
Metadata *InlinedAt, StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
@ -48,8 +48,8 @@ MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line,
|
||||
assert(Scope && "Expected scope");
|
||||
if (Storage == Uniqued) {
|
||||
if (auto *N =
|
||||
getUniqued(Context.pImpl->MDLocations,
|
||||
MDLocationInfo::KeyTy(Line, Column, Scope, InlinedAt)))
|
||||
getUniqued(Context.pImpl->DILocations,
|
||||
DILocationInfo::KeyTy(Line, Column, Scope, InlinedAt)))
|
||||
return N;
|
||||
if (!ShouldCreate)
|
||||
return nullptr;
|
||||
@ -62,11 +62,11 @@ MDLocation *MDLocation::getImpl(LLVMContext &Context, unsigned Line,
|
||||
if (InlinedAt)
|
||||
Ops.push_back(InlinedAt);
|
||||
return storeImpl(new (Ops.size())
|
||||
MDLocation(Context, Storage, Line, Column, Ops),
|
||||
Storage, Context.pImpl->MDLocations);
|
||||
DILocation(Context, Storage, Line, Column, Ops),
|
||||
Storage, Context.pImpl->DILocations);
|
||||
}
|
||||
|
||||
unsigned MDLocation::computeNewDiscriminator() const {
|
||||
unsigned DILocation::computeNewDiscriminator() const {
|
||||
// FIXME: This seems completely wrong.
|
||||
//
|
||||
// 1. If two modules are generated in the same context, then the second
|
||||
@ -83,14 +83,14 @@ unsigned MDLocation::computeNewDiscriminator() const {
|
||||
return ++getContext().pImpl->DiscriminatorTable[Key];
|
||||
}
|
||||
|
||||
unsigned DebugNode::getFlag(StringRef Flag) {
|
||||
unsigned DINode::getFlag(StringRef Flag) {
|
||||
return StringSwitch<unsigned>(Flag)
|
||||
#define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
|
||||
#include "llvm/IR/DebugInfoFlags.def"
|
||||
.Default(0);
|
||||
}
|
||||
|
||||
const char *DebugNode::getFlagString(unsigned Flag) {
|
||||
const char *DINode::getFlagString(unsigned Flag) {
|
||||
switch (Flag) {
|
||||
default:
|
||||
return "";
|
||||
@ -101,8 +101,8 @@ const char *DebugNode::getFlagString(unsigned Flag) {
|
||||
}
|
||||
}
|
||||
|
||||
unsigned DebugNode::splitFlags(unsigned Flags,
|
||||
SmallVectorImpl<unsigned> &SplitFlags) {
|
||||
unsigned DINode::splitFlags(unsigned Flags,
|
||||
SmallVectorImpl<unsigned> &SplitFlags) {
|
||||
// Accessibility flags need to be specially handled, since they're packed
|
||||
// together.
|
||||
if (unsigned A = Flags & FlagAccessibility) {
|
||||
@ -125,33 +125,33 @@ unsigned DebugNode::splitFlags(unsigned Flags,
|
||||
return Flags;
|
||||
}
|
||||
|
||||
MDScopeRef MDScope::getScope() const {
|
||||
if (auto *T = dyn_cast<MDType>(this))
|
||||
DIScopeRef DIScope::getScope() const {
|
||||
if (auto *T = dyn_cast<DIType>(this))
|
||||
return T->getScope();
|
||||
|
||||
if (auto *SP = dyn_cast<MDSubprogram>(this))
|
||||
if (auto *SP = dyn_cast<DISubprogram>(this))
|
||||
return SP->getScope();
|
||||
|
||||
if (auto *LB = dyn_cast<MDLexicalBlockBase>(this))
|
||||
return MDScopeRef(LB->getScope());
|
||||
if (auto *LB = dyn_cast<DILexicalBlockBase>(this))
|
||||
return DIScopeRef(LB->getScope());
|
||||
|
||||
if (auto *NS = dyn_cast<MDNamespace>(this))
|
||||
return MDScopeRef(NS->getScope());
|
||||
if (auto *NS = dyn_cast<DINamespace>(this))
|
||||
return DIScopeRef(NS->getScope());
|
||||
|
||||
assert((isa<MDFile>(this) || isa<MDCompileUnit>(this)) &&
|
||||
assert((isa<DIFile>(this) || isa<DICompileUnit>(this)) &&
|
||||
"Unhandled type of scope.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StringRef MDScope::getName() const {
|
||||
if (auto *T = dyn_cast<MDType>(this))
|
||||
StringRef DIScope::getName() const {
|
||||
if (auto *T = dyn_cast<DIType>(this))
|
||||
return T->getName();
|
||||
if (auto *SP = dyn_cast<MDSubprogram>(this))
|
||||
if (auto *SP = dyn_cast<DISubprogram>(this))
|
||||
return SP->getName();
|
||||
if (auto *NS = dyn_cast<MDNamespace>(this))
|
||||
if (auto *NS = dyn_cast<DINamespace>(this))
|
||||
return NS->getName();
|
||||
assert((isa<MDLexicalBlockBase>(this) || isa<MDFile>(this) ||
|
||||
isa<MDCompileUnit>(this)) &&
|
||||
assert((isa<DILexicalBlockBase>(this) || isa<DIFile>(this) ||
|
||||
isa<DICompileUnit>(this)) &&
|
||||
"Unhandled type of scope.");
|
||||
return "";
|
||||
}
|
||||
@ -168,15 +168,14 @@ static bool isCanonical(const MDString *S) {
|
||||
}
|
||||
#endif
|
||||
|
||||
GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
MDString *Header,
|
||||
ArrayRef<Metadata *> DwarfOps,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
GenericDINode *GenericDINode::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
MDString *Header,
|
||||
ArrayRef<Metadata *> DwarfOps,
|
||||
StorageType Storage, bool ShouldCreate) {
|
||||
unsigned Hash = 0;
|
||||
if (Storage == Uniqued) {
|
||||
GenericDebugNodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps);
|
||||
if (auto *N = getUniqued(Context.pImpl->GenericDebugNodes, Key))
|
||||
GenericDINodeInfo::KeyTy Key(Tag, getString(Header), DwarfOps);
|
||||
if (auto *N = getUniqued(Context.pImpl->GenericDINodes, Key))
|
||||
return N;
|
||||
if (!ShouldCreate)
|
||||
return nullptr;
|
||||
@ -188,13 +187,13 @@ GenericDebugNode *GenericDebugNode::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
// Use a nullptr for empty headers.
|
||||
assert(isCanonical(Header) && "Expected canonical MDString");
|
||||
Metadata *PreOps[] = {Header};
|
||||
return storeImpl(new (DwarfOps.size() + 1) GenericDebugNode(
|
||||
return storeImpl(new (DwarfOps.size() + 1) GenericDINode(
|
||||
Context, Storage, Hash, Tag, PreOps, DwarfOps),
|
||||
Storage, Context.pImpl->GenericDebugNodes);
|
||||
Storage, Context.pImpl->GenericDINodes);
|
||||
}
|
||||
|
||||
void GenericDebugNode::recalculateHash() {
|
||||
setHash(GenericDebugNodeInfo::KeyTy::calculateHash(this));
|
||||
void GenericDINode::recalculateHash() {
|
||||
setHash(GenericDINodeInfo::KeyTy::calculateHash(this));
|
||||
}
|
||||
|
||||
#define UNWRAP_ARGS_IMPL(...) __VA_ARGS__
|
||||
@ -224,49 +223,49 @@ void GenericDebugNode::recalculateHash() {
|
||||
CLASS(Context, Storage, OPS), \
|
||||
Storage, Context.pImpl->CLASS##s)
|
||||
|
||||
MDSubrange *MDSubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
|
||||
DISubrange *DISubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo,
|
||||
StorageType Storage, bool ShouldCreate) {
|
||||
DEFINE_GETIMPL_LOOKUP(MDSubrange, (Count, Lo));
|
||||
DEFINE_GETIMPL_STORE_NO_OPS(MDSubrange, (Count, Lo));
|
||||
DEFINE_GETIMPL_LOOKUP(DISubrange, (Count, Lo));
|
||||
DEFINE_GETIMPL_STORE_NO_OPS(DISubrange, (Count, Lo));
|
||||
}
|
||||
|
||||
MDEnumerator *MDEnumerator::getImpl(LLVMContext &Context, int64_t Value,
|
||||
DIEnumerator *DIEnumerator::getImpl(LLVMContext &Context, int64_t Value,
|
||||
MDString *Name, StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDEnumerator, (Value, getString(Name)));
|
||||
DEFINE_GETIMPL_LOOKUP(DIEnumerator, (Value, getString(Name)));
|
||||
Metadata *Ops[] = {Name};
|
||||
DEFINE_GETIMPL_STORE(MDEnumerator, (Value), Ops);
|
||||
DEFINE_GETIMPL_STORE(DIEnumerator, (Value), Ops);
|
||||
}
|
||||
|
||||
MDBasicType *MDBasicType::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
MDString *Name, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, unsigned Encoding,
|
||||
StorageType Storage, bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(
|
||||
MDBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding));
|
||||
DIBasicType, (Tag, getString(Name), SizeInBits, AlignInBits, Encoding));
|
||||
Metadata *Ops[] = {nullptr, nullptr, Name};
|
||||
DEFINE_GETIMPL_STORE(MDBasicType, (Tag, SizeInBits, AlignInBits, Encoding),
|
||||
DEFINE_GETIMPL_STORE(DIBasicType, (Tag, SizeInBits, AlignInBits, Encoding),
|
||||
Ops);
|
||||
}
|
||||
|
||||
MDDerivedType *MDDerivedType::getImpl(
|
||||
DIDerivedType *DIDerivedType::getImpl(
|
||||
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
||||
unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
|
||||
Metadata *ExtraData, StorageType Storage, bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDDerivedType, (Tag, getString(Name), File, Line, Scope,
|
||||
DEFINE_GETIMPL_LOOKUP(DIDerivedType, (Tag, getString(Name), File, Line, Scope,
|
||||
BaseType, SizeInBits, AlignInBits,
|
||||
OffsetInBits, Flags, ExtraData));
|
||||
Metadata *Ops[] = {File, Scope, Name, BaseType, ExtraData};
|
||||
DEFINE_GETIMPL_STORE(
|
||||
MDDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags),
|
||||
DIDerivedType, (Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags),
|
||||
Ops);
|
||||
}
|
||||
|
||||
MDCompositeType *MDCompositeType::getImpl(
|
||||
DICompositeType *DICompositeType::getImpl(
|
||||
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
||||
unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
|
||||
@ -274,39 +273,39 @@ MDCompositeType *MDCompositeType::getImpl(
|
||||
Metadata *TemplateParams, MDString *Identifier, StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDCompositeType,
|
||||
DEFINE_GETIMPL_LOOKUP(DICompositeType,
|
||||
(Tag, getString(Name), File, Line, Scope, BaseType,
|
||||
SizeInBits, AlignInBits, OffsetInBits, Flags, Elements,
|
||||
RuntimeLang, VTableHolder, TemplateParams,
|
||||
getString(Identifier)));
|
||||
Metadata *Ops[] = {File, Scope, Name, BaseType,
|
||||
Elements, VTableHolder, TemplateParams, Identifier};
|
||||
DEFINE_GETIMPL_STORE(MDCompositeType, (Tag, Line, RuntimeLang, SizeInBits,
|
||||
DEFINE_GETIMPL_STORE(DICompositeType, (Tag, Line, RuntimeLang, SizeInBits,
|
||||
AlignInBits, OffsetInBits, Flags),
|
||||
Ops);
|
||||
}
|
||||
|
||||
MDSubroutineType *MDSubroutineType::getImpl(LLVMContext &Context,
|
||||
DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context,
|
||||
unsigned Flags, Metadata *TypeArray,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
DEFINE_GETIMPL_LOOKUP(MDSubroutineType, (Flags, TypeArray));
|
||||
DEFINE_GETIMPL_LOOKUP(DISubroutineType, (Flags, TypeArray));
|
||||
Metadata *Ops[] = {nullptr, nullptr, nullptr, nullptr,
|
||||
TypeArray, nullptr, nullptr, nullptr};
|
||||
DEFINE_GETIMPL_STORE(MDSubroutineType, (Flags), Ops);
|
||||
DEFINE_GETIMPL_STORE(DISubroutineType, (Flags), Ops);
|
||||
}
|
||||
|
||||
MDFile *MDFile::getImpl(LLVMContext &Context, MDString *Filename,
|
||||
DIFile *DIFile::getImpl(LLVMContext &Context, MDString *Filename,
|
||||
MDString *Directory, StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
assert(isCanonical(Filename) && "Expected canonical MDString");
|
||||
assert(isCanonical(Directory) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDFile, (getString(Filename), getString(Directory)));
|
||||
DEFINE_GETIMPL_LOOKUP(DIFile, (getString(Filename), getString(Directory)));
|
||||
Metadata *Ops[] = {Filename, Directory};
|
||||
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDFile, Ops);
|
||||
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DIFile, Ops);
|
||||
}
|
||||
|
||||
MDCompileUnit *MDCompileUnit::getImpl(
|
||||
DICompileUnit *DICompileUnit::getImpl(
|
||||
LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
|
||||
MDString *Producer, bool IsOptimized, MDString *Flags,
|
||||
unsigned RuntimeVersion, MDString *SplitDebugFilename,
|
||||
@ -317,7 +316,7 @@ MDCompileUnit *MDCompileUnit::getImpl(
|
||||
assert(isCanonical(Flags) && "Expected canonical MDString");
|
||||
assert(isCanonical(SplitDebugFilename) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(
|
||||
MDCompileUnit,
|
||||
DICompileUnit,
|
||||
(SourceLanguage, File, getString(Producer), IsOptimized, getString(Flags),
|
||||
RuntimeVersion, getString(SplitDebugFilename), EmissionKind, EnumTypes,
|
||||
RetainedTypes, Subprograms, GlobalVariables, ImportedEntities));
|
||||
@ -325,17 +324,17 @@ MDCompileUnit *MDCompileUnit::getImpl(
|
||||
RetainedTypes, Subprograms, GlobalVariables,
|
||||
ImportedEntities};
|
||||
DEFINE_GETIMPL_STORE(
|
||||
MDCompileUnit,
|
||||
DICompileUnit,
|
||||
(SourceLanguage, IsOptimized, RuntimeVersion, EmissionKind), Ops);
|
||||
}
|
||||
|
||||
MDSubprogram *MDLocalScope::getSubprogram() const {
|
||||
if (auto *Block = dyn_cast<MDLexicalBlockBase>(this))
|
||||
DISubprogram *DILocalScope::getSubprogram() const {
|
||||
if (auto *Block = dyn_cast<DILexicalBlockBase>(this))
|
||||
return Block->getScope()->getSubprogram();
|
||||
return const_cast<MDSubprogram *>(cast<MDSubprogram>(this));
|
||||
return const_cast<DISubprogram *>(cast<DISubprogram>(this));
|
||||
}
|
||||
|
||||
MDSubprogram *MDSubprogram::getImpl(
|
||||
DISubprogram *DISubprogram::getImpl(
|
||||
LLVMContext &Context, Metadata *Scope, MDString *Name,
|
||||
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
|
||||
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
||||
@ -345,7 +344,7 @@ MDSubprogram *MDSubprogram::getImpl(
|
||||
StorageType Storage, bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
assert(isCanonical(LinkageName) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDSubprogram,
|
||||
DEFINE_GETIMPL_LOOKUP(DISubprogram,
|
||||
(Scope, getString(Name), getString(LinkageName), File,
|
||||
Line, Type, IsLocalToUnit, IsDefinition, ScopeLine,
|
||||
ContainingType, Virtuality, VirtualIndex, Flags,
|
||||
@ -354,18 +353,18 @@ MDSubprogram *MDSubprogram::getImpl(
|
||||
Metadata *Ops[] = {File, Scope, Name, Name,
|
||||
LinkageName, Type, ContainingType, Function,
|
||||
TemplateParams, Declaration, Variables};
|
||||
DEFINE_GETIMPL_STORE(MDSubprogram,
|
||||
DEFINE_GETIMPL_STORE(DISubprogram,
|
||||
(Line, ScopeLine, Virtuality, VirtualIndex, Flags,
|
||||
IsLocalToUnit, IsDefinition, IsOptimized),
|
||||
Ops);
|
||||
}
|
||||
|
||||
Function *MDSubprogram::getFunction() const {
|
||||
Function *DISubprogram::getFunction() const {
|
||||
// FIXME: Should this be looking through bitcasts?
|
||||
return dyn_cast_or_null<Function>(getFunctionConstant());
|
||||
}
|
||||
|
||||
bool MDSubprogram::describes(const Function *F) const {
|
||||
bool DISubprogram::describes(const Function *F) const {
|
||||
assert(F && "Invalid function");
|
||||
if (F == getFunction())
|
||||
return true;
|
||||
@ -375,64 +374,64 @@ bool MDSubprogram::describes(const Function *F) const {
|
||||
return F->getName() == Name;
|
||||
}
|
||||
|
||||
void MDSubprogram::replaceFunction(Function *F) {
|
||||
void DISubprogram::replaceFunction(Function *F) {
|
||||
replaceFunction(F ? ConstantAsMetadata::get(F)
|
||||
: static_cast<ConstantAsMetadata *>(nullptr));
|
||||
}
|
||||
|
||||
MDLexicalBlock *MDLexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
DILexicalBlock *DILexicalBlock::getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
Metadata *File, unsigned Line,
|
||||
unsigned Column, StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
assert(Scope && "Expected scope");
|
||||
DEFINE_GETIMPL_LOOKUP(MDLexicalBlock, (Scope, File, Line, Column));
|
||||
DEFINE_GETIMPL_LOOKUP(DILexicalBlock, (Scope, File, Line, Column));
|
||||
Metadata *Ops[] = {File, Scope};
|
||||
DEFINE_GETIMPL_STORE(MDLexicalBlock, (Line, Column), Ops);
|
||||
DEFINE_GETIMPL_STORE(DILexicalBlock, (Line, Column), Ops);
|
||||
}
|
||||
|
||||
MDLexicalBlockFile *MDLexicalBlockFile::getImpl(LLVMContext &Context,
|
||||
DILexicalBlockFile *DILexicalBlockFile::getImpl(LLVMContext &Context,
|
||||
Metadata *Scope, Metadata *File,
|
||||
unsigned Discriminator,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
assert(Scope && "Expected scope");
|
||||
DEFINE_GETIMPL_LOOKUP(MDLexicalBlockFile, (Scope, File, Discriminator));
|
||||
DEFINE_GETIMPL_LOOKUP(DILexicalBlockFile, (Scope, File, Discriminator));
|
||||
Metadata *Ops[] = {File, Scope};
|
||||
DEFINE_GETIMPL_STORE(MDLexicalBlockFile, (Discriminator), Ops);
|
||||
DEFINE_GETIMPL_STORE(DILexicalBlockFile, (Discriminator), Ops);
|
||||
}
|
||||
|
||||
MDNamespace *MDNamespace::getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
DINamespace *DINamespace::getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
Metadata *File, MDString *Name, unsigned Line,
|
||||
StorageType Storage, bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDNamespace, (Scope, File, getString(Name), Line));
|
||||
DEFINE_GETIMPL_LOOKUP(DINamespace, (Scope, File, getString(Name), Line));
|
||||
Metadata *Ops[] = {File, Scope, Name};
|
||||
DEFINE_GETIMPL_STORE(MDNamespace, (Line), Ops);
|
||||
DEFINE_GETIMPL_STORE(DINamespace, (Line), Ops);
|
||||
}
|
||||
|
||||
MDTemplateTypeParameter *MDTemplateTypeParameter::getImpl(LLVMContext &Context,
|
||||
DITemplateTypeParameter *DITemplateTypeParameter::getImpl(LLVMContext &Context,
|
||||
MDString *Name,
|
||||
Metadata *Type,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDTemplateTypeParameter, (getString(Name), Type));
|
||||
DEFINE_GETIMPL_LOOKUP(DITemplateTypeParameter, (getString(Name), Type));
|
||||
Metadata *Ops[] = {Name, Type};
|
||||
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDTemplateTypeParameter, Ops);
|
||||
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(DITemplateTypeParameter, Ops);
|
||||
}
|
||||
|
||||
MDTemplateValueParameter *MDTemplateValueParameter::getImpl(
|
||||
DITemplateValueParameter *DITemplateValueParameter::getImpl(
|
||||
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
|
||||
Metadata *Value, StorageType Storage, bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDTemplateValueParameter,
|
||||
DEFINE_GETIMPL_LOOKUP(DITemplateValueParameter,
|
||||
(Tag, getString(Name), Type, Value));
|
||||
Metadata *Ops[] = {Name, Type, Value};
|
||||
DEFINE_GETIMPL_STORE(MDTemplateValueParameter, (Tag), Ops);
|
||||
DEFINE_GETIMPL_STORE(DITemplateValueParameter, (Tag), Ops);
|
||||
}
|
||||
|
||||
MDGlobalVariable *
|
||||
MDGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
|
||||
DIGlobalVariable *
|
||||
DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
|
||||
MDString *LinkageName, Metadata *File, unsigned Line,
|
||||
Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
|
||||
Metadata *Variable,
|
||||
@ -440,17 +439,17 @@ MDGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
|
||||
StorageType Storage, bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
assert(isCanonical(LinkageName) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDGlobalVariable,
|
||||
DEFINE_GETIMPL_LOOKUP(DIGlobalVariable,
|
||||
(Scope, getString(Name), getString(LinkageName), File,
|
||||
Line, Type, IsLocalToUnit, IsDefinition, Variable,
|
||||
StaticDataMemberDeclaration));
|
||||
Metadata *Ops[] = {Scope, Name, File, Type,
|
||||
Name, LinkageName, Variable, StaticDataMemberDeclaration};
|
||||
DEFINE_GETIMPL_STORE(MDGlobalVariable, (Line, IsLocalToUnit, IsDefinition),
|
||||
DEFINE_GETIMPL_STORE(DIGlobalVariable, (Line, IsLocalToUnit, IsDefinition),
|
||||
Ops);
|
||||
}
|
||||
|
||||
MDLocalVariable *MDLocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
Metadata *Scope, MDString *Name,
|
||||
Metadata *File, unsigned Line,
|
||||
Metadata *Type, unsigned Arg,
|
||||
@ -461,20 +460,20 @@ MDLocalVariable *MDLocalVariable::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
|
||||
assert(Scope && "Expected scope");
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDLocalVariable, (Tag, Scope, getString(Name), File,
|
||||
DEFINE_GETIMPL_LOOKUP(DILocalVariable, (Tag, Scope, getString(Name), File,
|
||||
Line, Type, Arg, Flags));
|
||||
Metadata *Ops[] = {Scope, Name, File, Type};
|
||||
DEFINE_GETIMPL_STORE(MDLocalVariable, (Tag, Line, Arg, Flags), Ops);
|
||||
DEFINE_GETIMPL_STORE(DILocalVariable, (Tag, Line, Arg, Flags), Ops);
|
||||
}
|
||||
|
||||
MDExpression *MDExpression::getImpl(LLVMContext &Context,
|
||||
DIExpression *DIExpression::getImpl(LLVMContext &Context,
|
||||
ArrayRef<uint64_t> Elements,
|
||||
StorageType Storage, bool ShouldCreate) {
|
||||
DEFINE_GETIMPL_LOOKUP(MDExpression, (Elements));
|
||||
DEFINE_GETIMPL_STORE_NO_OPS(MDExpression, (Elements));
|
||||
DEFINE_GETIMPL_LOOKUP(DIExpression, (Elements));
|
||||
DEFINE_GETIMPL_STORE_NO_OPS(DIExpression, (Elements));
|
||||
}
|
||||
|
||||
unsigned MDExpression::ExprOperand::getSize() const {
|
||||
unsigned DIExpression::ExprOperand::getSize() const {
|
||||
switch (getOp()) {
|
||||
case dwarf::DW_OP_bit_piece:
|
||||
return 3;
|
||||
@ -485,7 +484,7 @@ unsigned MDExpression::ExprOperand::getSize() const {
|
||||
}
|
||||
}
|
||||
|
||||
bool MDExpression::isValid() const {
|
||||
bool DIExpression::isValid() const {
|
||||
for (auto I = expr_op_begin(), E = expr_op_end(); I != E; ++I) {
|
||||
// Check that there's space for the operand.
|
||||
if (I->get() + I->getSize() > E->get())
|
||||
@ -506,7 +505,7 @@ bool MDExpression::isValid() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MDExpression::isBitPiece() const {
|
||||
bool DIExpression::isBitPiece() const {
|
||||
assert(isValid() && "Expected valid expression");
|
||||
if (unsigned N = getNumElements())
|
||||
if (N >= 3)
|
||||
@ -514,38 +513,38 @@ bool MDExpression::isBitPiece() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t MDExpression::getBitPieceOffset() const {
|
||||
uint64_t DIExpression::getBitPieceOffset() const {
|
||||
assert(isBitPiece() && "Expected bit piece");
|
||||
return getElement(getNumElements() - 2);
|
||||
}
|
||||
|
||||
uint64_t MDExpression::getBitPieceSize() const {
|
||||
uint64_t DIExpression::getBitPieceSize() const {
|
||||
assert(isBitPiece() && "Expected bit piece");
|
||||
return getElement(getNumElements() - 1);
|
||||
}
|
||||
|
||||
MDObjCProperty *MDObjCProperty::getImpl(
|
||||
DIObjCProperty *DIObjCProperty::getImpl(
|
||||
LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
|
||||
MDString *GetterName, MDString *SetterName, unsigned Attributes,
|
||||
Metadata *Type, StorageType Storage, bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
assert(isCanonical(GetterName) && "Expected canonical MDString");
|
||||
assert(isCanonical(SetterName) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDObjCProperty,
|
||||
DEFINE_GETIMPL_LOOKUP(DIObjCProperty,
|
||||
(getString(Name), File, Line, getString(GetterName),
|
||||
getString(SetterName), Attributes, Type));
|
||||
Metadata *Ops[] = {Name, File, GetterName, SetterName, Type};
|
||||
DEFINE_GETIMPL_STORE(MDObjCProperty, (Line, Attributes), Ops);
|
||||
DEFINE_GETIMPL_STORE(DIObjCProperty, (Line, Attributes), Ops);
|
||||
}
|
||||
|
||||
MDImportedEntity *MDImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
DIImportedEntity *DIImportedEntity::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
Metadata *Scope, Metadata *Entity,
|
||||
unsigned Line, MDString *Name,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDImportedEntity,
|
||||
DEFINE_GETIMPL_LOOKUP(DIImportedEntity,
|
||||
(Tag, Scope, Entity, Line, getString(Name)));
|
||||
Metadata *Ops[] = {Scope, Entity, Name};
|
||||
DEFINE_GETIMPL_STORE(MDImportedEntity, (Tag, Line), Ops);
|
||||
DEFINE_GETIMPL_STORE(DIImportedEntity, (Tag, Line), Ops);
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ using namespace llvm;
|
||||
//===----------------------------------------------------------------------===//
|
||||
// DebugLoc Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
DebugLoc::DebugLoc(const MDLocation *L) : Loc(const_cast<MDLocation *>(L)) {}
|
||||
DebugLoc::DebugLoc(const DILocation *L) : Loc(const_cast<DILocation *>(L)) {}
|
||||
DebugLoc::DebugLoc(const MDNode *L) : Loc(const_cast<MDNode *>(L)) {}
|
||||
|
||||
MDLocation *DebugLoc::get() const {
|
||||
return cast_or_null<MDLocation>(Loc.get());
|
||||
DILocation *DebugLoc::get() const {
|
||||
return cast_or_null<DILocation>(Loc.get());
|
||||
}
|
||||
|
||||
unsigned DebugLoc::getLine() const {
|
||||
@ -38,17 +38,17 @@ MDNode *DebugLoc::getScope() const {
|
||||
return get()->getScope();
|
||||
}
|
||||
|
||||
MDLocation *DebugLoc::getInlinedAt() const {
|
||||
DILocation *DebugLoc::getInlinedAt() const {
|
||||
assert(get() && "Expected valid DebugLoc");
|
||||
return get()->getInlinedAt();
|
||||
}
|
||||
|
||||
MDNode *DebugLoc::getInlinedAtScope() const {
|
||||
return cast<MDLocation>(Loc)->getInlinedAtScope();
|
||||
return cast<DILocation>(Loc)->getInlinedAtScope();
|
||||
}
|
||||
|
||||
DebugLoc DebugLoc::getFnDebugLoc() const {
|
||||
// FIXME: Add a method on \a MDLocation that does this work.
|
||||
// FIXME: Add a method on \a DILocation that does this work.
|
||||
const MDNode *Scope = getInlinedAtScope();
|
||||
if (auto *SP = getDISubprogram(Scope))
|
||||
return DebugLoc::get(SP->getScopeLine(), 0, SP);
|
||||
@ -62,7 +62,7 @@ DebugLoc DebugLoc::get(unsigned Line, unsigned Col, const MDNode *Scope,
|
||||
if (!Scope)
|
||||
return DebugLoc();
|
||||
|
||||
return MDLocation::get(Scope->getContext(), Line, Col,
|
||||
return DILocation::get(Scope->getContext(), Line, Col,
|
||||
const_cast<MDNode *>(Scope),
|
||||
const_cast<MDNode *>(InlinedAt));
|
||||
}
|
||||
@ -88,7 +88,7 @@ void DebugLoc::print(raw_ostream &OS) const {
|
||||
return;
|
||||
|
||||
// Print source line info.
|
||||
auto *Scope = cast<MDScope>(getScope());
|
||||
auto *Scope = cast<DIScope>(getScope());
|
||||
OS << Scope->getFilename();
|
||||
OS << ':' << getLine();
|
||||
if (getCol() != 0)
|
||||
|
@ -135,7 +135,7 @@ bool DiagnosticInfoOptimizationBase::isLocationAvailable() const {
|
||||
void DiagnosticInfoOptimizationBase::getLocation(StringRef *Filename,
|
||||
unsigned *Line,
|
||||
unsigned *Column) const {
|
||||
MDLocation *L = getDebugLoc();
|
||||
DILocation *L = getDebugLoc();
|
||||
*Filename = L->getFilename();
|
||||
*Line = L->getLine();
|
||||
*Column = L->getColumn();
|
||||
|
@ -228,8 +228,8 @@ template <> struct MDNodeKeyImpl<MDTuple> : MDNodeOpsKey {
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief DenseMapInfo for MDLocation.
|
||||
template <> struct MDNodeKeyImpl<MDLocation> {
|
||||
/// \brief DenseMapInfo for DILocation.
|
||||
template <> struct MDNodeKeyImpl<DILocation> {
|
||||
unsigned Line;
|
||||
unsigned Column;
|
||||
Metadata *Scope;
|
||||
@ -239,11 +239,11 @@ template <> struct MDNodeKeyImpl<MDLocation> {
|
||||
Metadata *InlinedAt)
|
||||
: Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt) {}
|
||||
|
||||
MDNodeKeyImpl(const MDLocation *L)
|
||||
MDNodeKeyImpl(const DILocation *L)
|
||||
: Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()),
|
||||
InlinedAt(L->getRawInlinedAt()) {}
|
||||
|
||||
bool isKeyOf(const MDLocation *RHS) const {
|
||||
bool isKeyOf(const DILocation *RHS) const {
|
||||
return Line == RHS->getLine() && Column == RHS->getColumn() &&
|
||||
Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt();
|
||||
}
|
||||
@ -252,57 +252,57 @@ template <> struct MDNodeKeyImpl<MDLocation> {
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief DenseMapInfo for GenericDebugNode.
|
||||
template <> struct MDNodeKeyImpl<GenericDebugNode> : MDNodeOpsKey {
|
||||
/// \brief DenseMapInfo for GenericDINode.
|
||||
template <> struct MDNodeKeyImpl<GenericDINode> : MDNodeOpsKey {
|
||||
unsigned Tag;
|
||||
StringRef Header;
|
||||
MDNodeKeyImpl(unsigned Tag, StringRef Header, ArrayRef<Metadata *> DwarfOps)
|
||||
: MDNodeOpsKey(DwarfOps), Tag(Tag), Header(Header) {}
|
||||
MDNodeKeyImpl(const GenericDebugNode *N)
|
||||
MDNodeKeyImpl(const GenericDINode *N)
|
||||
: MDNodeOpsKey(N, 1), Tag(N->getTag()), Header(N->getHeader()) {}
|
||||
|
||||
bool isKeyOf(const GenericDebugNode *RHS) const {
|
||||
bool isKeyOf(const GenericDINode *RHS) const {
|
||||
return Tag == RHS->getTag() && Header == RHS->getHeader() &&
|
||||
compareOps(RHS, 1);
|
||||
}
|
||||
|
||||
unsigned getHashValue() const { return hash_combine(getHash(), Tag, Header); }
|
||||
|
||||
static unsigned calculateHash(GenericDebugNode *N) {
|
||||
static unsigned calculateHash(GenericDINode *N) {
|
||||
return MDNodeOpsKey::calculateHash(N, 1);
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDSubrange> {
|
||||
template <> struct MDNodeKeyImpl<DISubrange> {
|
||||
int64_t Count;
|
||||
int64_t LowerBound;
|
||||
|
||||
MDNodeKeyImpl(int64_t Count, int64_t LowerBound)
|
||||
: Count(Count), LowerBound(LowerBound) {}
|
||||
MDNodeKeyImpl(const MDSubrange *N)
|
||||
MDNodeKeyImpl(const DISubrange *N)
|
||||
: Count(N->getCount()), LowerBound(N->getLowerBound()) {}
|
||||
|
||||
bool isKeyOf(const MDSubrange *RHS) const {
|
||||
bool isKeyOf(const DISubrange *RHS) const {
|
||||
return Count == RHS->getCount() && LowerBound == RHS->getLowerBound();
|
||||
}
|
||||
unsigned getHashValue() const { return hash_combine(Count, LowerBound); }
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDEnumerator> {
|
||||
template <> struct MDNodeKeyImpl<DIEnumerator> {
|
||||
int64_t Value;
|
||||
StringRef Name;
|
||||
|
||||
MDNodeKeyImpl(int64_t Value, StringRef Name) : Value(Value), Name(Name) {}
|
||||
MDNodeKeyImpl(const MDEnumerator *N)
|
||||
MDNodeKeyImpl(const DIEnumerator *N)
|
||||
: Value(N->getValue()), Name(N->getName()) {}
|
||||
|
||||
bool isKeyOf(const MDEnumerator *RHS) const {
|
||||
bool isKeyOf(const DIEnumerator *RHS) const {
|
||||
return Value == RHS->getValue() && Name == RHS->getName();
|
||||
}
|
||||
unsigned getHashValue() const { return hash_combine(Value, Name); }
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDBasicType> {
|
||||
template <> struct MDNodeKeyImpl<DIBasicType> {
|
||||
unsigned Tag;
|
||||
StringRef Name;
|
||||
uint64_t SizeInBits;
|
||||
@ -313,11 +313,11 @@ template <> struct MDNodeKeyImpl<MDBasicType> {
|
||||
uint64_t AlignInBits, unsigned Encoding)
|
||||
: Tag(Tag), Name(Name), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
|
||||
Encoding(Encoding) {}
|
||||
MDNodeKeyImpl(const MDBasicType *N)
|
||||
MDNodeKeyImpl(const DIBasicType *N)
|
||||
: Tag(N->getTag()), Name(N->getName()), SizeInBits(N->getSizeInBits()),
|
||||
AlignInBits(N->getAlignInBits()), Encoding(N->getEncoding()) {}
|
||||
|
||||
bool isKeyOf(const MDBasicType *RHS) const {
|
||||
bool isKeyOf(const DIBasicType *RHS) const {
|
||||
return Tag == RHS->getTag() && Name == RHS->getName() &&
|
||||
SizeInBits == RHS->getSizeInBits() &&
|
||||
AlignInBits == RHS->getAlignInBits() &&
|
||||
@ -328,7 +328,7 @@ template <> struct MDNodeKeyImpl<MDBasicType> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDDerivedType> {
|
||||
template <> struct MDNodeKeyImpl<DIDerivedType> {
|
||||
unsigned Tag;
|
||||
StringRef Name;
|
||||
Metadata *File;
|
||||
@ -348,14 +348,14 @@ template <> struct MDNodeKeyImpl<MDDerivedType> {
|
||||
: Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope),
|
||||
BaseType(BaseType), SizeInBits(SizeInBits), AlignInBits(AlignInBits),
|
||||
OffsetInBits(OffsetInBits), Flags(Flags), ExtraData(ExtraData) {}
|
||||
MDNodeKeyImpl(const MDDerivedType *N)
|
||||
MDNodeKeyImpl(const DIDerivedType *N)
|
||||
: Tag(N->getTag()), Name(N->getName()), File(N->getRawFile()),
|
||||
Line(N->getLine()), Scope(N->getRawScope()),
|
||||
BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
|
||||
AlignInBits(N->getAlignInBits()), OffsetInBits(N->getOffsetInBits()),
|
||||
Flags(N->getFlags()), ExtraData(N->getRawExtraData()) {}
|
||||
|
||||
bool isKeyOf(const MDDerivedType *RHS) const {
|
||||
bool isKeyOf(const DIDerivedType *RHS) const {
|
||||
return Tag == RHS->getTag() && Name == RHS->getName() &&
|
||||
File == RHS->getRawFile() && Line == RHS->getLine() &&
|
||||
Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
|
||||
@ -370,7 +370,7 @@ template <> struct MDNodeKeyImpl<MDDerivedType> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDCompositeType> {
|
||||
template <> struct MDNodeKeyImpl<DICompositeType> {
|
||||
unsigned Tag;
|
||||
StringRef Name;
|
||||
Metadata *File;
|
||||
@ -398,7 +398,7 @@ template <> struct MDNodeKeyImpl<MDCompositeType> {
|
||||
OffsetInBits(OffsetInBits), Flags(Flags), Elements(Elements),
|
||||
RuntimeLang(RuntimeLang), VTableHolder(VTableHolder),
|
||||
TemplateParams(TemplateParams), Identifier(Identifier) {}
|
||||
MDNodeKeyImpl(const MDCompositeType *N)
|
||||
MDNodeKeyImpl(const DICompositeType *N)
|
||||
: Tag(N->getTag()), Name(N->getName()), File(N->getRawFile()),
|
||||
Line(N->getLine()), Scope(N->getRawScope()),
|
||||
BaseType(N->getRawBaseType()), SizeInBits(N->getSizeInBits()),
|
||||
@ -408,7 +408,7 @@ template <> struct MDNodeKeyImpl<MDCompositeType> {
|
||||
TemplateParams(N->getRawTemplateParams()),
|
||||
Identifier(N->getIdentifier()) {}
|
||||
|
||||
bool isKeyOf(const MDCompositeType *RHS) const {
|
||||
bool isKeyOf(const DICompositeType *RHS) const {
|
||||
return Tag == RHS->getTag() && Name == RHS->getName() &&
|
||||
File == RHS->getRawFile() && Line == RHS->getLine() &&
|
||||
Scope == RHS->getRawScope() && BaseType == RHS->getRawBaseType() &&
|
||||
@ -428,37 +428,37 @@ template <> struct MDNodeKeyImpl<MDCompositeType> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDSubroutineType> {
|
||||
template <> struct MDNodeKeyImpl<DISubroutineType> {
|
||||
unsigned Flags;
|
||||
Metadata *TypeArray;
|
||||
|
||||
MDNodeKeyImpl(int64_t Flags, Metadata *TypeArray)
|
||||
: Flags(Flags), TypeArray(TypeArray) {}
|
||||
MDNodeKeyImpl(const MDSubroutineType *N)
|
||||
MDNodeKeyImpl(const DISubroutineType *N)
|
||||
: Flags(N->getFlags()), TypeArray(N->getRawTypeArray()) {}
|
||||
|
||||
bool isKeyOf(const MDSubroutineType *RHS) const {
|
||||
bool isKeyOf(const DISubroutineType *RHS) const {
|
||||
return Flags == RHS->getFlags() && TypeArray == RHS->getRawTypeArray();
|
||||
}
|
||||
unsigned getHashValue() const { return hash_combine(Flags, TypeArray); }
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDFile> {
|
||||
template <> struct MDNodeKeyImpl<DIFile> {
|
||||
StringRef Filename;
|
||||
StringRef Directory;
|
||||
|
||||
MDNodeKeyImpl(StringRef Filename, StringRef Directory)
|
||||
: Filename(Filename), Directory(Directory) {}
|
||||
MDNodeKeyImpl(const MDFile *N)
|
||||
MDNodeKeyImpl(const DIFile *N)
|
||||
: Filename(N->getFilename()), Directory(N->getDirectory()) {}
|
||||
|
||||
bool isKeyOf(const MDFile *RHS) const {
|
||||
bool isKeyOf(const DIFile *RHS) const {
|
||||
return Filename == RHS->getFilename() && Directory == RHS->getDirectory();
|
||||
}
|
||||
unsigned getHashValue() const { return hash_combine(Filename, Directory); }
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDCompileUnit> {
|
||||
template <> struct MDNodeKeyImpl<DICompileUnit> {
|
||||
unsigned SourceLanguage;
|
||||
Metadata *File;
|
||||
StringRef Producer;
|
||||
@ -485,7 +485,7 @@ template <> struct MDNodeKeyImpl<MDCompileUnit> {
|
||||
EnumTypes(EnumTypes), RetainedTypes(RetainedTypes),
|
||||
Subprograms(Subprograms), GlobalVariables(GlobalVariables),
|
||||
ImportedEntities(ImportedEntities) {}
|
||||
MDNodeKeyImpl(const MDCompileUnit *N)
|
||||
MDNodeKeyImpl(const DICompileUnit *N)
|
||||
: SourceLanguage(N->getSourceLanguage()), File(N->getRawFile()),
|
||||
Producer(N->getProducer()), IsOptimized(N->isOptimized()),
|
||||
Flags(N->getFlags()), RuntimeVersion(N->getRuntimeVersion()),
|
||||
@ -496,7 +496,7 @@ template <> struct MDNodeKeyImpl<MDCompileUnit> {
|
||||
GlobalVariables(N->getRawGlobalVariables()),
|
||||
ImportedEntities(N->getRawImportedEntities()) {}
|
||||
|
||||
bool isKeyOf(const MDCompileUnit *RHS) const {
|
||||
bool isKeyOf(const DICompileUnit *RHS) const {
|
||||
return SourceLanguage == RHS->getSourceLanguage() &&
|
||||
File == RHS->getRawFile() && Producer == RHS->getProducer() &&
|
||||
IsOptimized == RHS->isOptimized() && Flags == RHS->getFlags() &&
|
||||
@ -517,7 +517,7 @@ template <> struct MDNodeKeyImpl<MDCompileUnit> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDSubprogram> {
|
||||
template <> struct MDNodeKeyImpl<DISubprogram> {
|
||||
Metadata *Scope;
|
||||
StringRef Name;
|
||||
StringRef LinkageName;
|
||||
@ -551,7 +551,7 @@ template <> struct MDNodeKeyImpl<MDSubprogram> {
|
||||
VirtualIndex(VirtualIndex), Flags(Flags), IsOptimized(IsOptimized),
|
||||
Function(Function), TemplateParams(TemplateParams),
|
||||
Declaration(Declaration), Variables(Variables) {}
|
||||
MDNodeKeyImpl(const MDSubprogram *N)
|
||||
MDNodeKeyImpl(const DISubprogram *N)
|
||||
: Scope(N->getRawScope()), Name(N->getName()),
|
||||
LinkageName(N->getLinkageName()), File(N->getRawFile()),
|
||||
Line(N->getLine()), Type(N->getRawType()),
|
||||
@ -563,7 +563,7 @@ template <> struct MDNodeKeyImpl<MDSubprogram> {
|
||||
TemplateParams(N->getRawTemplateParams()),
|
||||
Declaration(N->getRawDeclaration()), Variables(N->getRawVariables()) {}
|
||||
|
||||
bool isKeyOf(const MDSubprogram *RHS) const {
|
||||
bool isKeyOf(const DISubprogram *RHS) const {
|
||||
return Scope == RHS->getRawScope() && Name == RHS->getName() &&
|
||||
LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() &&
|
||||
Line == RHS->getLine() && Type == RHS->getRawType() &&
|
||||
@ -587,7 +587,7 @@ template <> struct MDNodeKeyImpl<MDSubprogram> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDLexicalBlock> {
|
||||
template <> struct MDNodeKeyImpl<DILexicalBlock> {
|
||||
Metadata *Scope;
|
||||
Metadata *File;
|
||||
unsigned Line;
|
||||
@ -595,11 +595,11 @@ template <> struct MDNodeKeyImpl<MDLexicalBlock> {
|
||||
|
||||
MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Line, unsigned Column)
|
||||
: Scope(Scope), File(File), Line(Line), Column(Column) {}
|
||||
MDNodeKeyImpl(const MDLexicalBlock *N)
|
||||
MDNodeKeyImpl(const DILexicalBlock *N)
|
||||
: Scope(N->getRawScope()), File(N->getRawFile()), Line(N->getLine()),
|
||||
Column(N->getColumn()) {}
|
||||
|
||||
bool isKeyOf(const MDLexicalBlock *RHS) const {
|
||||
bool isKeyOf(const DILexicalBlock *RHS) const {
|
||||
return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
|
||||
Line == RHS->getLine() && Column == RHS->getColumn();
|
||||
}
|
||||
@ -608,18 +608,18 @@ template <> struct MDNodeKeyImpl<MDLexicalBlock> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDLexicalBlockFile> {
|
||||
template <> struct MDNodeKeyImpl<DILexicalBlockFile> {
|
||||
Metadata *Scope;
|
||||
Metadata *File;
|
||||
unsigned Discriminator;
|
||||
|
||||
MDNodeKeyImpl(Metadata *Scope, Metadata *File, unsigned Discriminator)
|
||||
: Scope(Scope), File(File), Discriminator(Discriminator) {}
|
||||
MDNodeKeyImpl(const MDLexicalBlockFile *N)
|
||||
MDNodeKeyImpl(const DILexicalBlockFile *N)
|
||||
: Scope(N->getRawScope()), File(N->getRawFile()),
|
||||
Discriminator(N->getDiscriminator()) {}
|
||||
|
||||
bool isKeyOf(const MDLexicalBlockFile *RHS) const {
|
||||
bool isKeyOf(const DILexicalBlockFile *RHS) const {
|
||||
return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
|
||||
Discriminator == RHS->getDiscriminator();
|
||||
}
|
||||
@ -628,7 +628,7 @@ template <> struct MDNodeKeyImpl<MDLexicalBlockFile> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDNamespace> {
|
||||
template <> struct MDNodeKeyImpl<DINamespace> {
|
||||
Metadata *Scope;
|
||||
Metadata *File;
|
||||
StringRef Name;
|
||||
@ -636,11 +636,11 @@ template <> struct MDNodeKeyImpl<MDNamespace> {
|
||||
|
||||
MDNodeKeyImpl(Metadata *Scope, Metadata *File, StringRef Name, unsigned Line)
|
||||
: Scope(Scope), File(File), Name(Name), Line(Line) {}
|
||||
MDNodeKeyImpl(const MDNamespace *N)
|
||||
MDNodeKeyImpl(const DINamespace *N)
|
||||
: Scope(N->getRawScope()), File(N->getRawFile()), Name(N->getName()),
|
||||
Line(N->getLine()) {}
|
||||
|
||||
bool isKeyOf(const MDNamespace *RHS) const {
|
||||
bool isKeyOf(const DINamespace *RHS) const {
|
||||
return Scope == RHS->getRawScope() && File == RHS->getRawFile() &&
|
||||
Name == RHS->getName() && Line == RHS->getLine();
|
||||
}
|
||||
@ -649,21 +649,21 @@ template <> struct MDNodeKeyImpl<MDNamespace> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDTemplateTypeParameter> {
|
||||
template <> struct MDNodeKeyImpl<DITemplateTypeParameter> {
|
||||
StringRef Name;
|
||||
Metadata *Type;
|
||||
|
||||
MDNodeKeyImpl(StringRef Name, Metadata *Type) : Name(Name), Type(Type) {}
|
||||
MDNodeKeyImpl(const MDTemplateTypeParameter *N)
|
||||
MDNodeKeyImpl(const DITemplateTypeParameter *N)
|
||||
: Name(N->getName()), Type(N->getRawType()) {}
|
||||
|
||||
bool isKeyOf(const MDTemplateTypeParameter *RHS) const {
|
||||
bool isKeyOf(const DITemplateTypeParameter *RHS) const {
|
||||
return Name == RHS->getName() && Type == RHS->getRawType();
|
||||
}
|
||||
unsigned getHashValue() const { return hash_combine(Name, Type); }
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDTemplateValueParameter> {
|
||||
template <> struct MDNodeKeyImpl<DITemplateValueParameter> {
|
||||
unsigned Tag;
|
||||
StringRef Name;
|
||||
Metadata *Type;
|
||||
@ -671,18 +671,18 @@ template <> struct MDNodeKeyImpl<MDTemplateValueParameter> {
|
||||
|
||||
MDNodeKeyImpl(unsigned Tag, StringRef Name, Metadata *Type, Metadata *Value)
|
||||
: Tag(Tag), Name(Name), Type(Type), Value(Value) {}
|
||||
MDNodeKeyImpl(const MDTemplateValueParameter *N)
|
||||
MDNodeKeyImpl(const DITemplateValueParameter *N)
|
||||
: Tag(N->getTag()), Name(N->getName()), Type(N->getRawType()),
|
||||
Value(N->getValue()) {}
|
||||
|
||||
bool isKeyOf(const MDTemplateValueParameter *RHS) const {
|
||||
bool isKeyOf(const DITemplateValueParameter *RHS) const {
|
||||
return Tag == RHS->getTag() && Name == RHS->getName() &&
|
||||
Type == RHS->getRawType() && Value == RHS->getValue();
|
||||
}
|
||||
unsigned getHashValue() const { return hash_combine(Tag, Name, Type, Value); }
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDGlobalVariable> {
|
||||
template <> struct MDNodeKeyImpl<DIGlobalVariable> {
|
||||
Metadata *Scope;
|
||||
StringRef Name;
|
||||
StringRef LinkageName;
|
||||
@ -702,7 +702,7 @@ template <> struct MDNodeKeyImpl<MDGlobalVariable> {
|
||||
Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
|
||||
IsDefinition(IsDefinition), Variable(Variable),
|
||||
StaticDataMemberDeclaration(StaticDataMemberDeclaration) {}
|
||||
MDNodeKeyImpl(const MDGlobalVariable *N)
|
||||
MDNodeKeyImpl(const DIGlobalVariable *N)
|
||||
: Scope(N->getRawScope()), Name(N->getName()),
|
||||
LinkageName(N->getLinkageName()), File(N->getRawFile()),
|
||||
Line(N->getLine()), Type(N->getRawType()),
|
||||
@ -710,7 +710,7 @@ template <> struct MDNodeKeyImpl<MDGlobalVariable> {
|
||||
Variable(N->getRawVariable()),
|
||||
StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()) {}
|
||||
|
||||
bool isKeyOf(const MDGlobalVariable *RHS) const {
|
||||
bool isKeyOf(const DIGlobalVariable *RHS) const {
|
||||
return Scope == RHS->getRawScope() && Name == RHS->getName() &&
|
||||
LinkageName == RHS->getLinkageName() && File == RHS->getRawFile() &&
|
||||
Line == RHS->getLine() && Type == RHS->getRawType() &&
|
||||
@ -727,7 +727,7 @@ template <> struct MDNodeKeyImpl<MDGlobalVariable> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDLocalVariable> {
|
||||
template <> struct MDNodeKeyImpl<DILocalVariable> {
|
||||
unsigned Tag;
|
||||
Metadata *Scope;
|
||||
StringRef Name;
|
||||
@ -741,12 +741,12 @@ template <> struct MDNodeKeyImpl<MDLocalVariable> {
|
||||
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(const MDLocalVariable *N)
|
||||
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()) {}
|
||||
|
||||
bool isKeyOf(const MDLocalVariable *RHS) const {
|
||||
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() &&
|
||||
@ -757,13 +757,13 @@ template <> struct MDNodeKeyImpl<MDLocalVariable> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDExpression> {
|
||||
template <> struct MDNodeKeyImpl<DIExpression> {
|
||||
ArrayRef<uint64_t> Elements;
|
||||
|
||||
MDNodeKeyImpl(ArrayRef<uint64_t> Elements) : Elements(Elements) {}
|
||||
MDNodeKeyImpl(const MDExpression *N) : Elements(N->getElements()) {}
|
||||
MDNodeKeyImpl(const DIExpression *N) : Elements(N->getElements()) {}
|
||||
|
||||
bool isKeyOf(const MDExpression *RHS) const {
|
||||
bool isKeyOf(const DIExpression *RHS) const {
|
||||
return Elements == RHS->getElements();
|
||||
}
|
||||
unsigned getHashValue() const {
|
||||
@ -771,7 +771,7 @@ template <> struct MDNodeKeyImpl<MDExpression> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDObjCProperty> {
|
||||
template <> struct MDNodeKeyImpl<DIObjCProperty> {
|
||||
StringRef Name;
|
||||
Metadata *File;
|
||||
unsigned Line;
|
||||
@ -785,12 +785,12 @@ template <> struct MDNodeKeyImpl<MDObjCProperty> {
|
||||
Metadata *Type)
|
||||
: Name(Name), File(File), Line(Line), GetterName(GetterName),
|
||||
SetterName(SetterName), Attributes(Attributes), Type(Type) {}
|
||||
MDNodeKeyImpl(const MDObjCProperty *N)
|
||||
MDNodeKeyImpl(const DIObjCProperty *N)
|
||||
: Name(N->getName()), File(N->getRawFile()), Line(N->getLine()),
|
||||
GetterName(N->getGetterName()), SetterName(N->getSetterName()),
|
||||
Attributes(N->getAttributes()), Type(N->getRawType()) {}
|
||||
|
||||
bool isKeyOf(const MDObjCProperty *RHS) const {
|
||||
bool isKeyOf(const DIObjCProperty *RHS) const {
|
||||
return Name == RHS->getName() && File == RHS->getRawFile() &&
|
||||
Line == RHS->getLine() && GetterName == RHS->getGetterName() &&
|
||||
SetterName == RHS->getSetterName() &&
|
||||
@ -802,7 +802,7 @@ template <> struct MDNodeKeyImpl<MDObjCProperty> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDImportedEntity> {
|
||||
template <> struct MDNodeKeyImpl<DIImportedEntity> {
|
||||
unsigned Tag;
|
||||
Metadata *Scope;
|
||||
Metadata *Entity;
|
||||
@ -812,11 +812,11 @@ template <> struct MDNodeKeyImpl<MDImportedEntity> {
|
||||
MDNodeKeyImpl(unsigned Tag, Metadata *Scope, Metadata *Entity, unsigned Line,
|
||||
StringRef Name)
|
||||
: Tag(Tag), Scope(Scope), Entity(Entity), Line(Line), Name(Name) {}
|
||||
MDNodeKeyImpl(const MDImportedEntity *N)
|
||||
MDNodeKeyImpl(const DIImportedEntity *N)
|
||||
: Tag(N->getTag()), Scope(N->getRawScope()), Entity(N->getRawEntity()),
|
||||
Line(N->getLine()), Name(N->getName()) {}
|
||||
|
||||
bool isKeyOf(const MDImportedEntity *RHS) const {
|
||||
bool isKeyOf(const DIImportedEntity *RHS) const {
|
||||
return Tag == RHS->getTag() && Scope == RHS->getRawScope() &&
|
||||
Entity == RHS->getRawEntity() && Line == RHS->getLine() &&
|
||||
Name == RHS->getName();
|
||||
|
@ -305,11 +305,11 @@ private:
|
||||
template <class Ty> bool isValidMetadataArray(const MDTuple &N);
|
||||
#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) void visit##CLASS(const CLASS &N);
|
||||
#include "llvm/IR/Metadata.def"
|
||||
void visitMDScope(const MDScope &N);
|
||||
void visitMDDerivedTypeBase(const MDDerivedTypeBase &N);
|
||||
void visitMDVariable(const MDVariable &N);
|
||||
void visitMDLexicalBlockBase(const MDLexicalBlockBase &N);
|
||||
void visitMDTemplateParameter(const MDTemplateParameter &N);
|
||||
void visitDIScope(const DIScope &N);
|
||||
void visitDIDerivedTypeBase(const DIDerivedTypeBase &N);
|
||||
void visitDIVariable(const DIVariable &N);
|
||||
void visitDILexicalBlockBase(const DILexicalBlockBase &N);
|
||||
void visitDITemplateParameter(const DITemplateParameter &N);
|
||||
|
||||
void visitTemplateParams(const MDNode &N, const Metadata &RawParams);
|
||||
|
||||
@ -321,17 +321,17 @@ private:
|
||||
|
||||
/// \brief Check for a valid type reference.
|
||||
///
|
||||
/// Checks for subclasses of \a MDType, or \a isValidUUID().
|
||||
/// Checks for subclasses of \a DIType, or \a isValidUUID().
|
||||
bool isTypeRef(const MDNode &N, const Metadata *MD);
|
||||
|
||||
/// \brief Check for a valid scope reference.
|
||||
///
|
||||
/// Checks for subclasses of \a MDScope, or \a isValidUUID().
|
||||
/// Checks for subclasses of \a DIScope, or \a isValidUUID().
|
||||
bool isScopeRef(const MDNode &N, const Metadata *MD);
|
||||
|
||||
/// \brief Check for a valid debug info reference.
|
||||
///
|
||||
/// Checks for subclasses of \a DebugNode, or \a isValidUUID().
|
||||
/// Checks for subclasses of \a DINode, or \a isValidUUID().
|
||||
bool isDIRef(const MDNode &N, const Metadata *MD);
|
||||
|
||||
// InstVisitor overrides...
|
||||
@ -605,7 +605,7 @@ void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
|
||||
MDNode *MD = NMD.getOperand(i);
|
||||
|
||||
if (NMD.getName() == "llvm.dbg.cu") {
|
||||
Assert(MD && isa<MDCompileUnit>(MD), "invalid compile unit", &NMD, MD);
|
||||
Assert(MD && isa<DICompileUnit>(MD), "invalid compile unit", &NMD, MD);
|
||||
}
|
||||
|
||||
if (!MD)
|
||||
@ -711,17 +711,17 @@ bool Verifier::isValidUUID(const MDNode &N, const Metadata *MD) {
|
||||
|
||||
/// \brief Check if a value can be a reference to a type.
|
||||
bool Verifier::isTypeRef(const MDNode &N, const Metadata *MD) {
|
||||
return !MD || isValidUUID(N, MD) || isa<MDType>(MD);
|
||||
return !MD || isValidUUID(N, MD) || isa<DIType>(MD);
|
||||
}
|
||||
|
||||
/// \brief Check if a value can be a ScopeRef.
|
||||
bool Verifier::isScopeRef(const MDNode &N, const Metadata *MD) {
|
||||
return !MD || isValidUUID(N, MD) || isa<MDScope>(MD);
|
||||
return !MD || isValidUUID(N, MD) || isa<DIScope>(MD);
|
||||
}
|
||||
|
||||
/// \brief Check if a value can be a debug info ref.
|
||||
bool Verifier::isDIRef(const MDNode &N, const Metadata *MD) {
|
||||
return !MD || isValidUUID(N, MD) || isa<DebugNode>(MD);
|
||||
return !MD || isValidUUID(N, MD) || isa<DINode>(MD);
|
||||
}
|
||||
|
||||
template <class Ty>
|
||||
@ -748,40 +748,40 @@ bool isValidMetadataNullArray(const MDTuple &N) {
|
||||
return isValidMetadataArrayImpl<Ty>(N, /* AllowNull */ true);
|
||||
}
|
||||
|
||||
void Verifier::visitMDLocation(const MDLocation &N) {
|
||||
Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()),
|
||||
void Verifier::visitDILocation(const DILocation &N) {
|
||||
Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()),
|
||||
"location requires a valid scope", &N, N.getRawScope());
|
||||
if (auto *IA = N.getRawInlinedAt())
|
||||
Assert(isa<MDLocation>(IA), "inlined-at should be a location", &N, IA);
|
||||
Assert(isa<DILocation>(IA), "inlined-at should be a location", &N, IA);
|
||||
}
|
||||
|
||||
void Verifier::visitGenericDebugNode(const GenericDebugNode &N) {
|
||||
void Verifier::visitGenericDINode(const GenericDINode &N) {
|
||||
Assert(N.getTag(), "invalid tag", &N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDScope(const MDScope &N) {
|
||||
void Verifier::visitDIScope(const DIScope &N) {
|
||||
if (auto *F = N.getRawFile())
|
||||
Assert(isa<MDFile>(F), "invalid file", &N, F);
|
||||
Assert(isa<DIFile>(F), "invalid file", &N, F);
|
||||
}
|
||||
|
||||
void Verifier::visitMDSubrange(const MDSubrange &N) {
|
||||
void Verifier::visitDISubrange(const DISubrange &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_subrange_type, "invalid tag", &N);
|
||||
Assert(N.getCount() >= -1, "invalid subrange count", &N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDEnumerator(const MDEnumerator &N) {
|
||||
void Verifier::visitDIEnumerator(const DIEnumerator &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_enumerator, "invalid tag", &N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDBasicType(const MDBasicType &N) {
|
||||
void Verifier::visitDIBasicType(const DIBasicType &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_base_type ||
|
||||
N.getTag() == dwarf::DW_TAG_unspecified_type,
|
||||
"invalid tag", &N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDDerivedTypeBase(const MDDerivedTypeBase &N) {
|
||||
void Verifier::visitDIDerivedTypeBase(const DIDerivedTypeBase &N) {
|
||||
// Common scope checks.
|
||||
visitMDScope(N);
|
||||
visitDIScope(N);
|
||||
|
||||
Assert(isScopeRef(N, N.getScope()), "invalid scope", &N, N.getScope());
|
||||
Assert(isTypeRef(N, N.getBaseType()), "invalid base type", &N,
|
||||
@ -808,9 +808,9 @@ void Verifier::visitMDDerivedTypeBase(const MDDerivedTypeBase &N) {
|
||||
}
|
||||
}
|
||||
|
||||
void Verifier::visitMDDerivedType(const MDDerivedType &N) {
|
||||
void Verifier::visitDIDerivedType(const DIDerivedType &N) {
|
||||
// Common derived type checks.
|
||||
visitMDDerivedTypeBase(N);
|
||||
visitDIDerivedTypeBase(N);
|
||||
|
||||
Assert(N.getTag() == dwarf::DW_TAG_typedef ||
|
||||
N.getTag() == dwarf::DW_TAG_pointer_type ||
|
||||
@ -831,22 +831,22 @@ void Verifier::visitMDDerivedType(const MDDerivedType &N) {
|
||||
}
|
||||
|
||||
static bool hasConflictingReferenceFlags(unsigned Flags) {
|
||||
return (Flags & DebugNode::FlagLValueReference) &&
|
||||
(Flags & DebugNode::FlagRValueReference);
|
||||
return (Flags & DINode::FlagLValueReference) &&
|
||||
(Flags & DINode::FlagRValueReference);
|
||||
}
|
||||
|
||||
void Verifier::visitTemplateParams(const MDNode &N, const Metadata &RawParams) {
|
||||
auto *Params = dyn_cast<MDTuple>(&RawParams);
|
||||
Assert(Params, "invalid template params", &N, &RawParams);
|
||||
for (Metadata *Op : Params->operands()) {
|
||||
Assert(Op && isa<MDTemplateParameter>(Op), "invalid template parameter", &N,
|
||||
Assert(Op && isa<DITemplateParameter>(Op), "invalid template parameter", &N,
|
||||
Params, Op);
|
||||
}
|
||||
}
|
||||
|
||||
void Verifier::visitMDCompositeType(const MDCompositeType &N) {
|
||||
void Verifier::visitDICompositeType(const DICompositeType &N) {
|
||||
// Common derived type checks.
|
||||
visitMDDerivedTypeBase(N);
|
||||
visitDIDerivedTypeBase(N);
|
||||
|
||||
Assert(N.getTag() == dwarf::DW_TAG_array_type ||
|
||||
N.getTag() == dwarf::DW_TAG_structure_type ||
|
||||
@ -868,7 +868,7 @@ void Verifier::visitMDCompositeType(const MDCompositeType &N) {
|
||||
visitTemplateParams(N, *Params);
|
||||
}
|
||||
|
||||
void Verifier::visitMDSubroutineType(const MDSubroutineType &N) {
|
||||
void Verifier::visitDISubroutineType(const DISubroutineType &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_subroutine_type, "invalid tag", &N);
|
||||
if (auto *Types = N.getRawTypeArray()) {
|
||||
Assert(isa<MDTuple>(Types), "invalid composite elements", &N, Types);
|
||||
@ -880,24 +880,24 @@ void Verifier::visitMDSubroutineType(const MDSubroutineType &N) {
|
||||
&N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDFile(const MDFile &N) {
|
||||
void Verifier::visitDIFile(const DIFile &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_file_type, "invalid tag", &N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDCompileUnit(const MDCompileUnit &N) {
|
||||
void Verifier::visitDICompileUnit(const DICompileUnit &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_compile_unit, "invalid tag", &N);
|
||||
|
||||
// Don't bother verifying the compilation directory or producer string
|
||||
// as those could be empty.
|
||||
Assert(N.getRawFile() && isa<MDFile>(N.getRawFile()),
|
||||
"invalid file", &N, N.getRawFile());
|
||||
Assert(N.getRawFile() && isa<DIFile>(N.getRawFile()), "invalid file", &N,
|
||||
N.getRawFile());
|
||||
Assert(!N.getFile()->getFilename().empty(), "invalid filename", &N,
|
||||
N.getFile());
|
||||
|
||||
if (auto *Array = N.getRawEnumTypes()) {
|
||||
Assert(isa<MDTuple>(Array), "invalid enum list", &N, Array);
|
||||
for (Metadata *Op : N.getEnumTypes()->operands()) {
|
||||
auto *Enum = dyn_cast_or_null<MDCompositeType>(Op);
|
||||
auto *Enum = dyn_cast_or_null<DICompositeType>(Op);
|
||||
Assert(Enum && Enum->getTag() == dwarf::DW_TAG_enumeration_type,
|
||||
"invalid enum type", &N, N.getEnumTypes(), Op);
|
||||
}
|
||||
@ -905,36 +905,36 @@ void Verifier::visitMDCompileUnit(const MDCompileUnit &N) {
|
||||
if (auto *Array = N.getRawRetainedTypes()) {
|
||||
Assert(isa<MDTuple>(Array), "invalid retained type list", &N, Array);
|
||||
for (Metadata *Op : N.getRetainedTypes()->operands()) {
|
||||
Assert(Op && isa<MDType>(Op), "invalid retained type", &N, Op);
|
||||
Assert(Op && isa<DIType>(Op), "invalid retained type", &N, Op);
|
||||
}
|
||||
}
|
||||
if (auto *Array = N.getRawSubprograms()) {
|
||||
Assert(isa<MDTuple>(Array), "invalid subprogram list", &N, Array);
|
||||
for (Metadata *Op : N.getSubprograms()->operands()) {
|
||||
Assert(Op && isa<MDSubprogram>(Op), "invalid subprogram ref", &N, Op);
|
||||
Assert(Op && isa<DISubprogram>(Op), "invalid subprogram ref", &N, Op);
|
||||
}
|
||||
}
|
||||
if (auto *Array = N.getRawGlobalVariables()) {
|
||||
Assert(isa<MDTuple>(Array), "invalid global variable list", &N, Array);
|
||||
for (Metadata *Op : N.getGlobalVariables()->operands()) {
|
||||
Assert(Op && isa<MDGlobalVariable>(Op), "invalid global variable ref", &N,
|
||||
Assert(Op && isa<DIGlobalVariable>(Op), "invalid global variable ref", &N,
|
||||
Op);
|
||||
}
|
||||
}
|
||||
if (auto *Array = N.getRawImportedEntities()) {
|
||||
Assert(isa<MDTuple>(Array), "invalid imported entity list", &N, Array);
|
||||
for (Metadata *Op : N.getImportedEntities()->operands()) {
|
||||
Assert(Op && isa<MDImportedEntity>(Op), "invalid imported entity ref", &N,
|
||||
Assert(Op && isa<DIImportedEntity>(Op), "invalid imported entity ref", &N,
|
||||
Op);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Verifier::visitMDSubprogram(const MDSubprogram &N) {
|
||||
void Verifier::visitDISubprogram(const DISubprogram &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_subprogram, "invalid tag", &N);
|
||||
Assert(isScopeRef(N, N.getRawScope()), "invalid scope", &N, N.getRawScope());
|
||||
if (auto *T = N.getRawType())
|
||||
Assert(isa<MDSubroutineType>(T), "invalid subroutine type", &N, T);
|
||||
Assert(isa<DISubroutineType>(T), "invalid subroutine type", &N, T);
|
||||
Assert(isTypeRef(N, N.getRawContainingType()), "invalid containing type", &N,
|
||||
N.getRawContainingType());
|
||||
if (auto *RawF = N.getRawFunction()) {
|
||||
@ -947,14 +947,14 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) {
|
||||
if (auto *Params = N.getRawTemplateParams())
|
||||
visitTemplateParams(N, *Params);
|
||||
if (auto *S = N.getRawDeclaration()) {
|
||||
Assert(isa<MDSubprogram>(S) && !cast<MDSubprogram>(S)->isDefinition(),
|
||||
Assert(isa<DISubprogram>(S) && !cast<DISubprogram>(S)->isDefinition(),
|
||||
"invalid subprogram declaration", &N, S);
|
||||
}
|
||||
if (auto *RawVars = N.getRawVariables()) {
|
||||
auto *Vars = dyn_cast<MDTuple>(RawVars);
|
||||
Assert(Vars, "invalid variable list", &N, RawVars);
|
||||
for (Metadata *Op : Vars->operands()) {
|
||||
Assert(Op && isa<MDLocalVariable>(Op), "invalid local variable", &N, Vars,
|
||||
Assert(Op && isa<DILocalVariable>(Op), "invalid local variable", &N, Vars,
|
||||
Op);
|
||||
}
|
||||
}
|
||||
@ -973,20 +973,20 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) {
|
||||
SmallPtrSet<const MDNode *, 32> Seen;
|
||||
for (auto &BB : *F)
|
||||
for (auto &I : BB) {
|
||||
// Be careful about using MDLocation here since we might be dealing with
|
||||
// Be careful about using DILocation here since we might be dealing with
|
||||
// broken code (this is the Verifier after all).
|
||||
MDLocation *DL =
|
||||
dyn_cast_or_null<MDLocation>(I.getDebugLoc().getAsMDNode());
|
||||
DILocation *DL =
|
||||
dyn_cast_or_null<DILocation>(I.getDebugLoc().getAsMDNode());
|
||||
if (!DL)
|
||||
continue;
|
||||
if (!Seen.insert(DL).second)
|
||||
continue;
|
||||
|
||||
MDLocalScope *Scope = DL->getInlinedAtScope();
|
||||
DILocalScope *Scope = DL->getInlinedAtScope();
|
||||
if (Scope && !Seen.insert(Scope).second)
|
||||
continue;
|
||||
|
||||
MDSubprogram *SP = Scope ? Scope->getSubprogram() : nullptr;
|
||||
DISubprogram *SP = Scope ? Scope->getSubprogram() : nullptr;
|
||||
if (SP && !Seen.insert(SP).second)
|
||||
continue;
|
||||
|
||||
@ -997,43 +997,43 @@ void Verifier::visitMDSubprogram(const MDSubprogram &N) {
|
||||
}
|
||||
}
|
||||
|
||||
void Verifier::visitMDLexicalBlockBase(const MDLexicalBlockBase &N) {
|
||||
void Verifier::visitDILexicalBlockBase(const DILexicalBlockBase &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_lexical_block, "invalid tag", &N);
|
||||
Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()),
|
||||
Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()),
|
||||
"invalid local scope", &N, N.getRawScope());
|
||||
}
|
||||
|
||||
void Verifier::visitMDLexicalBlock(const MDLexicalBlock &N) {
|
||||
visitMDLexicalBlockBase(N);
|
||||
void Verifier::visitDILexicalBlock(const DILexicalBlock &N) {
|
||||
visitDILexicalBlockBase(N);
|
||||
|
||||
Assert(N.getLine() || !N.getColumn(),
|
||||
"cannot have column info without line info", &N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDLexicalBlockFile(const MDLexicalBlockFile &N) {
|
||||
visitMDLexicalBlockBase(N);
|
||||
void Verifier::visitDILexicalBlockFile(const DILexicalBlockFile &N) {
|
||||
visitDILexicalBlockBase(N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDNamespace(const MDNamespace &N) {
|
||||
void Verifier::visitDINamespace(const DINamespace &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_namespace, "invalid tag", &N);
|
||||
if (auto *S = N.getRawScope())
|
||||
Assert(isa<MDScope>(S), "invalid scope ref", &N, S);
|
||||
Assert(isa<DIScope>(S), "invalid scope ref", &N, S);
|
||||
}
|
||||
|
||||
void Verifier::visitMDTemplateParameter(const MDTemplateParameter &N) {
|
||||
void Verifier::visitDITemplateParameter(const DITemplateParameter &N) {
|
||||
Assert(isTypeRef(N, N.getType()), "invalid type ref", &N, N.getType());
|
||||
}
|
||||
|
||||
void Verifier::visitMDTemplateTypeParameter(const MDTemplateTypeParameter &N) {
|
||||
visitMDTemplateParameter(N);
|
||||
void Verifier::visitDITemplateTypeParameter(const DITemplateTypeParameter &N) {
|
||||
visitDITemplateParameter(N);
|
||||
|
||||
Assert(N.getTag() == dwarf::DW_TAG_template_type_parameter, "invalid tag",
|
||||
&N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDTemplateValueParameter(
|
||||
const MDTemplateValueParameter &N) {
|
||||
visitMDTemplateParameter(N);
|
||||
void Verifier::visitDITemplateValueParameter(
|
||||
const DITemplateValueParameter &N) {
|
||||
visitDITemplateParameter(N);
|
||||
|
||||
Assert(N.getTag() == dwarf::DW_TAG_template_value_parameter ||
|
||||
N.getTag() == dwarf::DW_TAG_GNU_template_template_param ||
|
||||
@ -1041,17 +1041,17 @@ void Verifier::visitMDTemplateValueParameter(
|
||||
"invalid tag", &N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDVariable(const MDVariable &N) {
|
||||
void Verifier::visitDIVariable(const DIVariable &N) {
|
||||
if (auto *S = N.getRawScope())
|
||||
Assert(isa<MDScope>(S), "invalid scope", &N, S);
|
||||
Assert(isa<DIScope>(S), "invalid scope", &N, S);
|
||||
Assert(isTypeRef(N, N.getRawType()), "invalid type ref", &N, N.getRawType());
|
||||
if (auto *F = N.getRawFile())
|
||||
Assert(isa<MDFile>(F), "invalid file", &N, F);
|
||||
Assert(isa<DIFile>(F), "invalid file", &N, F);
|
||||
}
|
||||
|
||||
void Verifier::visitMDGlobalVariable(const MDGlobalVariable &N) {
|
||||
void Verifier::visitDIGlobalVariable(const DIGlobalVariable &N) {
|
||||
// Checks common to all variables.
|
||||
visitMDVariable(N);
|
||||
visitDIVariable(N);
|
||||
|
||||
Assert(N.getTag() == dwarf::DW_TAG_variable, "invalid tag", &N);
|
||||
Assert(!N.getName().empty(), "missing global variable name", &N);
|
||||
@ -1061,40 +1061,40 @@ void Verifier::visitMDGlobalVariable(const MDGlobalVariable &N) {
|
||||
"invalid global varaible ref", &N, V);
|
||||
}
|
||||
if (auto *Member = N.getRawStaticDataMemberDeclaration()) {
|
||||
Assert(isa<MDDerivedType>(Member), "invalid static data member declaration",
|
||||
Assert(isa<DIDerivedType>(Member), "invalid static data member declaration",
|
||||
&N, Member);
|
||||
}
|
||||
}
|
||||
|
||||
void Verifier::visitMDLocalVariable(const MDLocalVariable &N) {
|
||||
void Verifier::visitDILocalVariable(const DILocalVariable &N) {
|
||||
// Checks common to all variables.
|
||||
visitMDVariable(N);
|
||||
visitDIVariable(N);
|
||||
|
||||
Assert(N.getTag() == dwarf::DW_TAG_auto_variable ||
|
||||
N.getTag() == dwarf::DW_TAG_arg_variable,
|
||||
"invalid tag", &N);
|
||||
Assert(N.getRawScope() && isa<MDLocalScope>(N.getRawScope()),
|
||||
Assert(N.getRawScope() && isa<DILocalScope>(N.getRawScope()),
|
||||
"local variable requires a valid scope", &N, N.getRawScope());
|
||||
}
|
||||
|
||||
void Verifier::visitMDExpression(const MDExpression &N) {
|
||||
void Verifier::visitDIExpression(const DIExpression &N) {
|
||||
Assert(N.isValid(), "invalid expression", &N);
|
||||
}
|
||||
|
||||
void Verifier::visitMDObjCProperty(const MDObjCProperty &N) {
|
||||
void Verifier::visitDIObjCProperty(const DIObjCProperty &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_APPLE_property, "invalid tag", &N);
|
||||
if (auto *T = N.getRawType())
|
||||
Assert(isa<MDType>(T), "invalid type ref", &N, T);
|
||||
Assert(isa<DIType>(T), "invalid type ref", &N, T);
|
||||
if (auto *F = N.getRawFile())
|
||||
Assert(isa<MDFile>(F), "invalid file", &N, F);
|
||||
Assert(isa<DIFile>(F), "invalid file", &N, F);
|
||||
}
|
||||
|
||||
void Verifier::visitMDImportedEntity(const MDImportedEntity &N) {
|
||||
void Verifier::visitDIImportedEntity(const DIImportedEntity &N) {
|
||||
Assert(N.getTag() == dwarf::DW_TAG_imported_module ||
|
||||
N.getTag() == dwarf::DW_TAG_imported_declaration,
|
||||
"invalid tag", &N);
|
||||
if (auto *S = N.getRawScope())
|
||||
Assert(isa<MDScope>(S), "invalid scope for imported entity", &N, S);
|
||||
Assert(isa<DIScope>(S), "invalid scope for imported entity", &N, S);
|
||||
Assert(isDIRef(N, N.getEntity()), "invalid imported entity", &N,
|
||||
N.getEntity());
|
||||
}
|
||||
@ -2904,7 +2904,7 @@ void Verifier::visitInstruction(Instruction &I) {
|
||||
}
|
||||
|
||||
if (MDNode *N = I.getDebugLoc().getAsMDNode()) {
|
||||
Assert(isa<MDLocation>(N), "invalid !dbg metadata attachment", &I, N);
|
||||
Assert(isa<DILocation>(N), "invalid !dbg metadata attachment", &I, N);
|
||||
visitMDNode(*N);
|
||||
}
|
||||
|
||||
@ -3373,18 +3373,18 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
///
|
||||
/// This carefully grabs the subprogram from a local scope, avoiding the
|
||||
/// built-in assertions that would typically fire.
|
||||
static MDSubprogram *getSubprogram(Metadata *LocalScope) {
|
||||
static DISubprogram *getSubprogram(Metadata *LocalScope) {
|
||||
if (!LocalScope)
|
||||
return nullptr;
|
||||
|
||||
if (auto *SP = dyn_cast<MDSubprogram>(LocalScope))
|
||||
if (auto *SP = dyn_cast<DISubprogram>(LocalScope))
|
||||
return SP;
|
||||
|
||||
if (auto *LB = dyn_cast<MDLexicalBlockBase>(LocalScope))
|
||||
if (auto *LB = dyn_cast<DILexicalBlockBase>(LocalScope))
|
||||
return getSubprogram(LB->getRawScope());
|
||||
|
||||
// Just return null; broken scope chains are checked elsewhere.
|
||||
assert(!isa<MDLocalScope>(LocalScope) && "Unknown type of local scope");
|
||||
assert(!isa<DILocalScope>(LocalScope) && "Unknown type of local scope");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -3394,29 +3394,29 @@ void Verifier::visitDbgIntrinsic(StringRef Kind, DbgIntrinsicTy &DII) {
|
||||
Assert(isa<ValueAsMetadata>(MD) ||
|
||||
(isa<MDNode>(MD) && !cast<MDNode>(MD)->getNumOperands()),
|
||||
"invalid llvm.dbg." + Kind + " intrinsic address/value", &DII, MD);
|
||||
Assert(isa<MDLocalVariable>(DII.getRawVariable()),
|
||||
Assert(isa<DILocalVariable>(DII.getRawVariable()),
|
||||
"invalid llvm.dbg." + Kind + " intrinsic variable", &DII,
|
||||
DII.getRawVariable());
|
||||
Assert(isa<MDExpression>(DII.getRawExpression()),
|
||||
Assert(isa<DIExpression>(DII.getRawExpression()),
|
||||
"invalid llvm.dbg." + Kind + " intrinsic expression", &DII,
|
||||
DII.getRawExpression());
|
||||
|
||||
// Ignore broken !dbg attachments; they're checked elsewhere.
|
||||
if (MDNode *N = DII.getDebugLoc().getAsMDNode())
|
||||
if (!isa<MDLocation>(N))
|
||||
if (!isa<DILocation>(N))
|
||||
return;
|
||||
|
||||
BasicBlock *BB = DII.getParent();
|
||||
Function *F = BB ? BB->getParent() : nullptr;
|
||||
|
||||
// The scopes for variables and !dbg attachments must agree.
|
||||
MDLocalVariable *Var = DII.getVariable();
|
||||
MDLocation *Loc = DII.getDebugLoc();
|
||||
DILocalVariable *Var = DII.getVariable();
|
||||
DILocation *Loc = DII.getDebugLoc();
|
||||
Assert(Loc, "llvm.dbg." + Kind + " intrinsic requires a !dbg attachment",
|
||||
&DII, BB, F);
|
||||
|
||||
MDSubprogram *VarSP = getSubprogram(Var->getRawScope());
|
||||
MDSubprogram *LocSP = getSubprogram(Loc->getRawScope());
|
||||
DISubprogram *VarSP = getSubprogram(Var->getRawScope());
|
||||
DISubprogram *LocSP = getSubprogram(Loc->getRawScope());
|
||||
if (!VarSP || !LocSP)
|
||||
return; // Broken scope chains are checked elsewhere.
|
||||
|
||||
@ -3427,16 +3427,16 @@ void Verifier::visitDbgIntrinsic(StringRef Kind, DbgIntrinsicTy &DII) {
|
||||
}
|
||||
|
||||
template <class MapTy>
|
||||
static uint64_t getVariableSize(const MDLocalVariable &V, const MapTy &Map) {
|
||||
static uint64_t getVariableSize(const DILocalVariable &V, const MapTy &Map) {
|
||||
// Be careful of broken types (checked elsewhere).
|
||||
const Metadata *RawType = V.getRawType();
|
||||
while (RawType) {
|
||||
// Try to get the size directly.
|
||||
if (auto *T = dyn_cast<MDType>(RawType))
|
||||
if (auto *T = dyn_cast<DIType>(RawType))
|
||||
if (uint64_t Size = T->getSizeInBits())
|
||||
return Size;
|
||||
|
||||
if (auto *DT = dyn_cast<MDDerivedType>(RawType)) {
|
||||
if (auto *DT = dyn_cast<DIDerivedType>(RawType)) {
|
||||
// Look at the base type.
|
||||
RawType = DT->getRawBaseType();
|
||||
continue;
|
||||
@ -3459,15 +3459,15 @@ static uint64_t getVariableSize(const MDLocalVariable &V, const MapTy &Map) {
|
||||
template <class MapTy>
|
||||
void Verifier::verifyBitPieceExpression(const DbgInfoIntrinsic &I,
|
||||
const MapTy &TypeRefs) {
|
||||
MDLocalVariable *V;
|
||||
MDExpression *E;
|
||||
DILocalVariable *V;
|
||||
DIExpression *E;
|
||||
if (auto *DVI = dyn_cast<DbgValueInst>(&I)) {
|
||||
V = dyn_cast_or_null<MDLocalVariable>(DVI->getRawVariable());
|
||||
E = dyn_cast_or_null<MDExpression>(DVI->getRawExpression());
|
||||
V = dyn_cast_or_null<DILocalVariable>(DVI->getRawVariable());
|
||||
E = dyn_cast_or_null<DIExpression>(DVI->getRawExpression());
|
||||
} else {
|
||||
auto *DDI = cast<DbgDeclareInst>(&I);
|
||||
V = dyn_cast_or_null<MDLocalVariable>(DDI->getRawVariable());
|
||||
E = dyn_cast_or_null<MDExpression>(DDI->getRawExpression());
|
||||
V = dyn_cast_or_null<DILocalVariable>(DDI->getRawVariable());
|
||||
E = dyn_cast_or_null<DIExpression>(DDI->getRawExpression());
|
||||
}
|
||||
|
||||
// We don't know whether this intrinsic verified correctly.
|
||||
@ -3503,11 +3503,11 @@ void Verifier::verifyTypeRefs() {
|
||||
return;
|
||||
|
||||
// Visit all the compile units again to map the type references.
|
||||
SmallDenseMap<const MDString *, const MDType *, 32> TypeRefs;
|
||||
SmallDenseMap<const MDString *, const DIType *, 32> TypeRefs;
|
||||
for (auto *CU : CUs->operands())
|
||||
if (auto Ts = cast<MDCompileUnit>(CU)->getRetainedTypes())
|
||||
for (MDType *Op : Ts)
|
||||
if (auto *T = dyn_cast<MDCompositeType>(Op))
|
||||
if (auto Ts = cast<DICompileUnit>(CU)->getRetainedTypes())
|
||||
for (DIType *Op : Ts)
|
||||
if (auto *T = dyn_cast<DICompositeType>(Op))
|
||||
if (auto *S = T->getRawIdentifier()) {
|
||||
UnresolvedTypeRefs.erase(S);
|
||||
TypeRefs.insert(std::make_pair(S, T));
|
||||
|
@ -1288,10 +1288,10 @@ void ModuleLinker::stripReplacedSubprograms() {
|
||||
if (!CompileUnits)
|
||||
return;
|
||||
for (unsigned I = 0, E = CompileUnits->getNumOperands(); I != E; ++I) {
|
||||
auto *CU = cast<MDCompileUnit>(CompileUnits->getOperand(I));
|
||||
auto *CU = cast<DICompileUnit>(CompileUnits->getOperand(I));
|
||||
assert(CU && "Expected valid compile unit");
|
||||
|
||||
for (MDSubprogram *SP : CU->getSubprograms()) {
|
||||
for (DISubprogram *SP : CU->getSubprograms()) {
|
||||
if (!SP || !SP->getFunction() || !Functions.count(SP->getFunction()))
|
||||
continue;
|
||||
|
||||
|
@ -348,7 +348,7 @@ void AArch64AsmPrinter::PrintDebugValueComment(const MachineInstr *MI,
|
||||
assert(NOps == 4);
|
||||
OS << '\t' << MAI->getCommentString() << "DEBUG_VALUE: ";
|
||||
// cast away const; DIetc do not take const operands for some reason.
|
||||
OS << cast<MDLocalVariable>(MI->getOperand(NOps - 2).getMetadata())
|
||||
OS << cast<DILocalVariable>(MI->getOperand(NOps - 2).getMetadata())
|
||||
->getName();
|
||||
OS << " <- ";
|
||||
// Frame address. Currently handles register +- offset only.
|
||||
|
@ -129,7 +129,7 @@ void NVPTXAsmPrinter::emitLineNumberAsDotLoc(const MachineInstr &MI) {
|
||||
if (!curLoc)
|
||||
return;
|
||||
|
||||
auto *Scope = cast_or_null<MDScope>(curLoc.getScope());
|
||||
auto *Scope = cast_or_null<DIScope>(curLoc.getScope());
|
||||
if (!Scope)
|
||||
return;
|
||||
|
||||
@ -773,7 +773,7 @@ void NVPTXAsmPrinter::recordAndEmitFilenames(Module &M) {
|
||||
DbgFinder.processModule(M);
|
||||
|
||||
unsigned i = 1;
|
||||
for (const MDCompileUnit *DIUnit : DbgFinder.compile_units()) {
|
||||
for (const DICompileUnit *DIUnit : DbgFinder.compile_units()) {
|
||||
StringRef Filename = DIUnit->getFilename();
|
||||
StringRef Dirname = DIUnit->getDirectory();
|
||||
SmallString<128> FullPathName = Dirname;
|
||||
@ -788,7 +788,7 @@ void NVPTXAsmPrinter::recordAndEmitFilenames(Module &M) {
|
||||
++i;
|
||||
}
|
||||
|
||||
for (MDSubprogram *SP : DbgFinder.subprograms()) {
|
||||
for (DISubprogram *SP : DbgFinder.subprograms()) {
|
||||
StringRef Filename = SP->getFilename();
|
||||
StringRef Dirname = SP->getDirectory();
|
||||
SmallString<128> FullPathName = Dirname;
|
||||
|
@ -90,7 +90,7 @@ namespace {
|
||||
bool doInitialization(CallGraph &CG) override;
|
||||
/// The maximum number of elements to expand, or 0 for unlimited.
|
||||
unsigned maxElements;
|
||||
DenseMap<const Function *, MDSubprogram *> FunctionDIs;
|
||||
DenseMap<const Function *, DISubprogram *> FunctionDIs;
|
||||
};
|
||||
}
|
||||
|
||||
@ -706,7 +706,7 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
||||
// Patch the pointer to LLVM function in debug info descriptor.
|
||||
auto DI = FunctionDIs.find(F);
|
||||
if (DI != FunctionDIs.end()) {
|
||||
MDSubprogram *SP = DI->second;
|
||||
DISubprogram *SP = DI->second;
|
||||
SP->replaceFunction(NF);
|
||||
// Ensure the map is updated so it can be reused on subsequent argument
|
||||
// promotions of the same function.
|
||||
|
@ -127,7 +127,7 @@ namespace {
|
||||
// As the code generation for module is finished (and DIBuilder is
|
||||
// finalized) we assume that subprogram descriptors won't be changed, and
|
||||
// they are stored in map for short duration anyway.
|
||||
DenseMap<const Function *, MDSubprogram *> FunctionDIs;
|
||||
DenseMap<const Function *, DISubprogram *> FunctionDIs;
|
||||
|
||||
protected:
|
||||
// DAH uses this to specify a different ID.
|
||||
@ -303,7 +303,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn) {
|
||||
// Patch the pointer to LLVM function in debug info descriptor.
|
||||
auto DI = FunctionDIs.find(&Fn);
|
||||
if (DI != FunctionDIs.end()) {
|
||||
MDSubprogram *SP = DI->second;
|
||||
DISubprogram *SP = DI->second;
|
||||
SP->replaceFunction(NF);
|
||||
// Ensure the map is updated so it can be reused on non-varargs argument
|
||||
// eliminations of the same function.
|
||||
|
@ -305,10 +305,10 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
|
||||
SmallVector<Metadata *, 64> LiveSubprograms;
|
||||
DenseSet<const MDNode *> VisitedSet;
|
||||
|
||||
for (MDCompileUnit *DIC : F.compile_units()) {
|
||||
for (DICompileUnit *DIC : F.compile_units()) {
|
||||
// Create our live subprogram list.
|
||||
bool SubprogramChange = false;
|
||||
for (MDSubprogram *DISP : DIC->getSubprograms()) {
|
||||
for (DISubprogram *DISP : DIC->getSubprograms()) {
|
||||
// Make sure we visit each subprogram only once.
|
||||
if (!VisitedSet.insert(DISP).second)
|
||||
continue;
|
||||
@ -322,7 +322,7 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
|
||||
|
||||
// Create our live global variable list.
|
||||
bool GlobalVariableChange = false;
|
||||
for (MDGlobalVariable *DIG : DIC->getGlobalVariables()) {
|
||||
for (DIGlobalVariable *DIG : DIC->getGlobalVariables()) {
|
||||
// Make sure we only visit each global variable only once.
|
||||
if (!VisitedSet.insert(DIG).second)
|
||||
continue;
|
||||
|
@ -250,8 +250,8 @@ struct LocationMetadata {
|
||||
|
||||
void parse(MDNode *MDN) {
|
||||
assert(MDN->getNumOperands() == 3);
|
||||
MDString *MDFilename = cast<MDString>(MDN->getOperand(0));
|
||||
Filename = MDFilename->getString();
|
||||
MDString *DIFilename = cast<MDString>(MDN->getOperand(0));
|
||||
Filename = DIFilename->getString();
|
||||
LineNo =
|
||||
mdconst::extract<ConstantInt>(MDN->getOperand(1))->getLimitedValue();
|
||||
ColumnNo =
|
||||
|
@ -248,7 +248,7 @@ class DataFlowSanitizer : public ModulePass {
|
||||
DFSanABIList ABIList;
|
||||
DenseMap<Value *, Function *> UnwrappedFnMap;
|
||||
AttributeSet ReadOnlyNoneAttrs;
|
||||
DenseMap<const Function *, MDSubprogram *> FunctionDIs;
|
||||
DenseMap<const Function *, DISubprogram *> FunctionDIs;
|
||||
|
||||
Value *getShadowAddress(Value *Addr, Instruction *Pos);
|
||||
bool isInstrumented(const Function *F);
|
||||
|
@ -126,7 +126,7 @@ namespace {
|
||||
Function *insertFlush(ArrayRef<std::pair<GlobalVariable*, MDNode*> >);
|
||||
void insertIndirectCounterIncrement();
|
||||
|
||||
std::string mangleName(const MDCompileUnit *CU, const char *NewStem);
|
||||
std::string mangleName(const DICompileUnit *CU, const char *NewStem);
|
||||
|
||||
GCOVOptions Options;
|
||||
|
||||
@ -149,7 +149,7 @@ ModulePass *llvm::createGCOVProfilerPass(const GCOVOptions &Options) {
|
||||
return new GCOVProfiler(Options);
|
||||
}
|
||||
|
||||
static StringRef getFunctionName(const MDSubprogram *SP) {
|
||||
static StringRef getFunctionName(const DISubprogram *SP) {
|
||||
if (!SP->getLinkageName().empty())
|
||||
return SP->getLinkageName();
|
||||
return SP->getName();
|
||||
@ -309,7 +309,7 @@ namespace {
|
||||
// object users can construct, the blocks and lines will be rooted here.
|
||||
class GCOVFunction : public GCOVRecord {
|
||||
public:
|
||||
GCOVFunction(const MDSubprogram *SP, raw_ostream *os, uint32_t Ident,
|
||||
GCOVFunction(const DISubprogram *SP, raw_ostream *os, uint32_t Ident,
|
||||
bool UseCfgChecksum, bool ExitBlockBeforeBody)
|
||||
: SP(SP), Ident(Ident), UseCfgChecksum(UseCfgChecksum), CfgChecksum(0),
|
||||
ReturnBlock(1, os) {
|
||||
@ -411,7 +411,7 @@ namespace {
|
||||
}
|
||||
|
||||
private:
|
||||
const MDSubprogram *SP;
|
||||
const DISubprogram *SP;
|
||||
uint32_t Ident;
|
||||
uint32_t FuncChecksum;
|
||||
bool UseCfgChecksum;
|
||||
@ -421,7 +421,7 @@ namespace {
|
||||
};
|
||||
}
|
||||
|
||||
std::string GCOVProfiler::mangleName(const MDCompileUnit *CU,
|
||||
std::string GCOVProfiler::mangleName(const DICompileUnit *CU,
|
||||
const char *NewStem) {
|
||||
if (NamedMDNode *GCov = M->getNamedMetadata("llvm.gcov")) {
|
||||
for (int i = 0, e = GCov->getNumOperands(); i != e; ++i) {
|
||||
@ -488,7 +488,7 @@ void GCOVProfiler::emitProfileNotes() {
|
||||
// this pass over the original .o's as they're produced, or run it after
|
||||
// LTO, we'll generate the same .gcno files.
|
||||
|
||||
auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(i));
|
||||
auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i));
|
||||
std::error_code EC;
|
||||
raw_fd_ostream out(mangleName(CU, "gcno"), EC, sys::fs::F_None);
|
||||
std::string EdgeDestinations;
|
||||
@ -571,7 +571,7 @@ bool GCOVProfiler::emitProfileArcs() {
|
||||
bool Result = false;
|
||||
bool InsertIndCounterIncrCode = false;
|
||||
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
|
||||
auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(i));
|
||||
auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i));
|
||||
SmallVector<std::pair<GlobalVariable *, MDNode *>, 8> CountersBySP;
|
||||
for (auto *SP : CU->getSubprograms()) {
|
||||
Function *F = SP->getFunction();
|
||||
@ -847,7 +847,7 @@ Function *GCOVProfiler::insertCounterWriteout(
|
||||
NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
|
||||
if (CU_Nodes) {
|
||||
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
|
||||
auto *CU = cast<MDCompileUnit>(CU_Nodes->getOperand(i));
|
||||
auto *CU = cast<DICompileUnit>(CU_Nodes->getOperand(i));
|
||||
std::string FilenameGcda = mangleName(CU, "gcda");
|
||||
uint32_t CfgChecksum = FileChecksums.empty() ? 0 : FileChecksums[i];
|
||||
Builder.CreateCall3(StartFile,
|
||||
@ -855,7 +855,7 @@ Function *GCOVProfiler::insertCounterWriteout(
|
||||
Builder.CreateGlobalStringPtr(ReversedVersion),
|
||||
Builder.getInt32(CfgChecksum));
|
||||
for (unsigned j = 0, e = CountersBySP.size(); j != e; ++j) {
|
||||
auto *SP = cast_or_null<MDSubprogram>(CountersBySP[j].second);
|
||||
auto *SP = cast_or_null<DISubprogram>(CountersBySP[j].second);
|
||||
uint32_t FuncChecksum = Funcs.empty() ? 0 : Funcs[j]->getFuncChecksum();
|
||||
Builder.CreateCall5(
|
||||
EmitFunction, Builder.getInt32(j),
|
||||
|
@ -1096,8 +1096,8 @@ public:
|
||||
// Retain the debug information attached to the alloca for use when
|
||||
// rewriting loads and stores.
|
||||
if (auto *L = LocalAsMetadata::getIfExists(&AI)) {
|
||||
if (auto *DebugNode = MetadataAsValue::getIfExists(AI.getContext(), L)) {
|
||||
for (User *U : DebugNode->users())
|
||||
if (auto *DINode = MetadataAsValue::getIfExists(AI.getContext(), L)) {
|
||||
for (User *U : DINode->users())
|
||||
if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(U))
|
||||
DDIs.push_back(DDI);
|
||||
else if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(U))
|
||||
|
@ -224,7 +224,7 @@ unsigned SampleProfileLoader::getInstWeight(Instruction &Inst) {
|
||||
if (Lineno < HeaderLineno)
|
||||
return 0;
|
||||
|
||||
const MDLocation *DIL = DLoc;
|
||||
const DILocation *DIL = DLoc;
|
||||
int LOffset = Lineno - HeaderLineno;
|
||||
unsigned Discriminator = DIL->getDiscriminator();
|
||||
unsigned Weight = Samples->samplesAt(LOffset, Discriminator);
|
||||
@ -642,7 +642,7 @@ void SampleProfileLoader::propagateWeights(Function &F) {
|
||||
/// \returns the line number where \p F is defined. If it returns 0,
|
||||
/// it means that there is no debug information available for \p F.
|
||||
unsigned SampleProfileLoader::getFunctionLoc(Function &F) {
|
||||
if (MDSubprogram *S = getDISubprogram(&F))
|
||||
if (DISubprogram *S = getDISubprogram(&F))
|
||||
return S->getLine();
|
||||
|
||||
// If could not find the start of \p F, emit a diagnostic to inform the user
|
||||
|
@ -1060,8 +1060,8 @@ public:
|
||||
// Remember which alloca we're promoting (for isInstInList).
|
||||
this->AI = AI;
|
||||
if (auto *L = LocalAsMetadata::getIfExists(AI)) {
|
||||
if (auto *DebugNode = MetadataAsValue::getIfExists(AI->getContext(), L)) {
|
||||
for (User *U : DebugNode->users())
|
||||
if (auto *DINode = MetadataAsValue::getIfExists(AI->getContext(), L)) {
|
||||
for (User *U : DINode->users())
|
||||
if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(U))
|
||||
DDIs.push_back(DDI);
|
||||
else if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(U))
|
||||
|
@ -174,14 +174,14 @@ bool AddDiscriminators::runOnFunction(Function &F) {
|
||||
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
|
||||
BasicBlock *B = I;
|
||||
TerminatorInst *Last = B->getTerminator();
|
||||
const MDLocation *LastDIL = Last->getDebugLoc();
|
||||
const DILocation *LastDIL = Last->getDebugLoc();
|
||||
if (!LastDIL)
|
||||
continue;
|
||||
|
||||
for (unsigned I = 0; I < Last->getNumSuccessors(); ++I) {
|
||||
BasicBlock *Succ = Last->getSuccessor(I);
|
||||
Instruction *First = Succ->getFirstNonPHIOrDbgOrLifetime();
|
||||
const MDLocation *FirstDIL = First->getDebugLoc();
|
||||
const DILocation *FirstDIL = First->getDebugLoc();
|
||||
if (!FirstDIL)
|
||||
continue;
|
||||
|
||||
@ -197,7 +197,7 @@ bool AddDiscriminators::runOnFunction(Function &F) {
|
||||
auto *File = Builder.createFile(Filename, Scope->getDirectory());
|
||||
|
||||
// FIXME: Calculate the discriminator here, based on local information,
|
||||
// and delete MDLocation::computeNewDiscriminator(). The current
|
||||
// and delete DILocation::computeNewDiscriminator(). The current
|
||||
// solution gives different results depending on other modules in the
|
||||
// same context. All we really need is to discriminate between
|
||||
// FirstDIL and LastDIL -- a local map would suffice.
|
||||
@ -205,7 +205,7 @@ bool AddDiscriminators::runOnFunction(Function &F) {
|
||||
auto *NewScope =
|
||||
Builder.createLexicalBlockFile(Scope, File, Discriminator);
|
||||
auto *NewDIL =
|
||||
MDLocation::get(Ctx, FirstDIL->getLine(), FirstDIL->getColumn(),
|
||||
DILocation::get(Ctx, FirstDIL->getLine(), FirstDIL->getColumn(),
|
||||
NewScope, FirstDIL->getInlinedAt());
|
||||
DebugLoc newDebugLoc = NewDIL;
|
||||
|
||||
|
@ -155,9 +155,9 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
|
||||
}
|
||||
|
||||
// Find the MDNode which corresponds to the subprogram data that described F.
|
||||
static MDSubprogram *FindSubprogram(const Function *F,
|
||||
static DISubprogram *FindSubprogram(const Function *F,
|
||||
DebugInfoFinder &Finder) {
|
||||
for (MDSubprogram *Subprogram : Finder.subprograms()) {
|
||||
for (DISubprogram *Subprogram : Finder.subprograms()) {
|
||||
if (Subprogram->describes(F))
|
||||
return Subprogram;
|
||||
}
|
||||
@ -166,7 +166,7 @@ static MDSubprogram *FindSubprogram(const Function *F,
|
||||
|
||||
// Add an operand to an existing MDNode. The new operand will be added at the
|
||||
// back of the operand list.
|
||||
static void AddOperand(MDCompileUnit *CU, MDSubprogramArray SPs,
|
||||
static void AddOperand(DICompileUnit *CU, DISubprogramArray SPs,
|
||||
Metadata *NewSP) {
|
||||
SmallVector<Metadata *, 16> NewSPs;
|
||||
NewSPs.reserve(SPs.size() + 1);
|
||||
@ -183,14 +183,14 @@ static void CloneDebugInfoMetadata(Function *NewFunc, const Function *OldFunc,
|
||||
DebugInfoFinder Finder;
|
||||
Finder.processModule(*OldFunc->getParent());
|
||||
|
||||
const MDSubprogram *OldSubprogramMDNode = FindSubprogram(OldFunc, Finder);
|
||||
const DISubprogram *OldSubprogramMDNode = FindSubprogram(OldFunc, Finder);
|
||||
if (!OldSubprogramMDNode) return;
|
||||
|
||||
// Ensure that OldFunc appears in the map.
|
||||
// (if it's already there it must point to NewFunc anyway)
|
||||
VMap[OldFunc] = NewFunc;
|
||||
auto *NewSubprogram =
|
||||
cast<MDSubprogram>(MapMetadata(OldSubprogramMDNode, VMap));
|
||||
cast<DISubprogram>(MapMetadata(OldSubprogramMDNode, VMap));
|
||||
|
||||
for (auto *CU : Finder.compile_units()) {
|
||||
auto Subprograms = CU->getSubprograms();
|
||||
|
@ -830,17 +830,16 @@ static bool hasLifetimeMarkers(AllocaInst *AI) {
|
||||
/// Rebuild the entire inlined-at chain for this instruction so that the top of
|
||||
/// the chain now is inlined-at the new call site.
|
||||
static DebugLoc
|
||||
updateInlinedAtInfo(DebugLoc DL, MDLocation *InlinedAtNode,
|
||||
LLVMContext &Ctx,
|
||||
DenseMap<const MDLocation *, MDLocation *> &IANodes) {
|
||||
SmallVector<MDLocation*, 3> InlinedAtLocations;
|
||||
MDLocation *Last = InlinedAtNode;
|
||||
MDLocation *CurInlinedAt = DL;
|
||||
updateInlinedAtInfo(DebugLoc DL, DILocation *InlinedAtNode, LLVMContext &Ctx,
|
||||
DenseMap<const DILocation *, DILocation *> &IANodes) {
|
||||
SmallVector<DILocation *, 3> InlinedAtLocations;
|
||||
DILocation *Last = InlinedAtNode;
|
||||
DILocation *CurInlinedAt = DL;
|
||||
|
||||
// Gather all the inlined-at nodes
|
||||
while (MDLocation *IA = CurInlinedAt->getInlinedAt()) {
|
||||
while (DILocation *IA = CurInlinedAt->getInlinedAt()) {
|
||||
// Skip any we've already built nodes for
|
||||
if (MDLocation *Found = IANodes[IA]) {
|
||||
if (DILocation *Found = IANodes[IA]) {
|
||||
Last = Found;
|
||||
break;
|
||||
}
|
||||
@ -854,8 +853,8 @@ updateInlinedAtInfo(DebugLoc DL, MDLocation *InlinedAtNode,
|
||||
// map of already-constructed inlined-at nodes.
|
||||
for (auto I = InlinedAtLocations.rbegin(), E = InlinedAtLocations.rend();
|
||||
I != E; ++I) {
|
||||
const MDLocation *MD = *I;
|
||||
Last = IANodes[MD] = MDLocation::getDistinct(
|
||||
const DILocation *MD = *I;
|
||||
Last = IANodes[MD] = DILocation::getDistinct(
|
||||
Ctx, MD->getLine(), MD->getColumn(), MD->getScope(), Last);
|
||||
}
|
||||
|
||||
@ -873,18 +872,18 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
|
||||
return;
|
||||
|
||||
auto &Ctx = Fn->getContext();
|
||||
MDLocation *InlinedAtNode = TheCallDL;
|
||||
DILocation *InlinedAtNode = TheCallDL;
|
||||
|
||||
// Create a unique call site, not to be confused with any other call from the
|
||||
// same location.
|
||||
InlinedAtNode = MDLocation::getDistinct(
|
||||
InlinedAtNode = DILocation::getDistinct(
|
||||
Ctx, InlinedAtNode->getLine(), InlinedAtNode->getColumn(),
|
||||
InlinedAtNode->getScope(), InlinedAtNode->getInlinedAt());
|
||||
|
||||
// Cache the inlined-at nodes as they're built so they are reused, without
|
||||
// this every instruction's inlined-at chain would become distinct from each
|
||||
// other.
|
||||
DenseMap<const MDLocation *, MDLocation *> IANodes;
|
||||
DenseMap<const DILocation *, DILocation *> IANodes;
|
||||
|
||||
for (; FI != Fn->end(); ++FI) {
|
||||
for (BasicBlock::iterator BI = FI->begin(), BE = FI->end();
|
||||
|
@ -978,7 +978,7 @@ unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
|
||||
///
|
||||
|
||||
/// See if there is a dbg.value intrinsic for DIVar before I.
|
||||
static bool LdStHasDebugValue(const MDLocalVariable *DIVar, Instruction *I) {
|
||||
static bool LdStHasDebugValue(const DILocalVariable *DIVar, Instruction *I) {
|
||||
// Since we can't guarantee that the original dbg.declare instrinsic
|
||||
// is removed by LowerDbgDeclare(), we need to make sure that we are
|
||||
// not inserting the same dbg.value intrinsic over and over.
|
||||
|
@ -13,7 +13,7 @@ target triple = "x86_64-apple-darwin10.2"
|
||||
define i32 @main() nounwind readonly {
|
||||
%diff1 = alloca i64 ; <i64*> [#uses=2]
|
||||
; CHECK: call void @llvm.dbg.value(metadata i64 72,
|
||||
call void @llvm.dbg.declare(metadata i64* %diff1, metadata !0, metadata !MDExpression()), !dbg !MDLocation(scope: !1)
|
||||
call void @llvm.dbg.declare(metadata i64* %diff1, metadata !0, metadata !DIExpression()), !dbg !DILocation(scope: !1)
|
||||
store i64 72, i64* %diff1, align 8
|
||||
%v1 = load %struct.test*, %struct.test** @TestArrayPtr, align 8 ; <%struct.test*> [#uses=1]
|
||||
%v2 = ptrtoint %struct.test* %v1 to i64 ; <i64> [#uses=1]
|
||||
@ -25,14 +25,14 @@ define i32 @main() nounwind readonly {
|
||||
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
|
||||
|
||||
!7 = !{!1}
|
||||
!6 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 131941)", isOptimized: true, emissionKind: 0, file: !8, enums: !9, retainedTypes: !9, subprograms: !7)
|
||||
!0 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "c", line: 2, scope: !1, file: !2, type: !5)
|
||||
!1 = !MDSubprogram(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 = !MDFile(filename: "/d/j/debug-test.c", directory: "/Volumes/Data/b")
|
||||
!3 = !MDSubroutineType(types: !4)
|
||||
!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)
|
||||
!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)
|
||||
!4 = !{!5}
|
||||
!5 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
!8 = !MDFile(filename: "/d/j/debug-test.c", directory: "/Volumes/Data/b")
|
||||
!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
!8 = !DIFile(filename: "/d/j/debug-test.c", directory: "/Volumes/Data/b")
|
||||
!9 = !{i32 0}
|
||||
|
||||
!llvm.module.flags = !{!10}
|
||||
|
@ -4,69 +4,69 @@
|
||||
; CHECK: !named = !{!0, !0, !1, !2, !3, !4, !5, !6, !7, !8, !8, !9, !10, !11, !12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27, !27}
|
||||
!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29, !30}
|
||||
|
||||
; CHECK: !0 = !MDSubrange(count: 3)
|
||||
; CHECK-NEXT: !1 = !MDSubrange(count: 3, lowerBound: 4)
|
||||
; CHECK-NEXT: !2 = !MDSubrange(count: 3, lowerBound: -5)
|
||||
!0 = !MDSubrange(count: 3)
|
||||
!1 = !MDSubrange(count: 3, lowerBound: 0)
|
||||
; CHECK: !0 = !DISubrange(count: 3)
|
||||
; CHECK-NEXT: !1 = !DISubrange(count: 3, lowerBound: 4)
|
||||
; CHECK-NEXT: !2 = !DISubrange(count: 3, lowerBound: -5)
|
||||
!0 = !DISubrange(count: 3)
|
||||
!1 = !DISubrange(count: 3, lowerBound: 0)
|
||||
|
||||
!2 = !MDSubrange(count: 3, lowerBound: 4)
|
||||
!3 = !MDSubrange(count: 3, lowerBound: -5)
|
||||
!2 = !DISubrange(count: 3, lowerBound: 4)
|
||||
!3 = !DISubrange(count: 3, lowerBound: -5)
|
||||
|
||||
; CHECK-NEXT: !3 = !MDEnumerator(name: "seven", value: 7)
|
||||
; CHECK-NEXT: !4 = !MDEnumerator(name: "negeight", value: -8)
|
||||
; CHECK-NEXT: !5 = !MDEnumerator(name: "", value: 0)
|
||||
!4 = !MDEnumerator(name: "seven", value: 7)
|
||||
!5 = !MDEnumerator(name: "negeight", value: -8)
|
||||
!6 = !MDEnumerator(name: "", value: 0)
|
||||
; CHECK-NEXT: !3 = !DIEnumerator(name: "seven", value: 7)
|
||||
; CHECK-NEXT: !4 = !DIEnumerator(name: "negeight", value: -8)
|
||||
; CHECK-NEXT: !5 = !DIEnumerator(name: "", value: 0)
|
||||
!4 = !DIEnumerator(name: "seven", value: 7)
|
||||
!5 = !DIEnumerator(name: "negeight", value: -8)
|
||||
!6 = !DIEnumerator(name: "", value: 0)
|
||||
|
||||
; CHECK-NEXT: !6 = !MDBasicType(name: "name", size: 1, align: 2, encoding: DW_ATE_unsigned_char)
|
||||
; CHECK-NEXT: !7 = !MDBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
|
||||
; CHECK-NEXT: !8 = !MDBasicType()
|
||||
!7 = !MDBasicType(tag: DW_TAG_base_type, name: "name", size: 1, align: 2, encoding: DW_ATE_unsigned_char)
|
||||
!8 = !MDBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
|
||||
!9 = !MDBasicType()
|
||||
!10 = !MDBasicType(tag: DW_TAG_base_type, name: "", size: 0, align: 0, encoding: 0)
|
||||
; CHECK-NEXT: !6 = !DIBasicType(name: "name", size: 1, align: 2, encoding: DW_ATE_unsigned_char)
|
||||
; CHECK-NEXT: !7 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
|
||||
; CHECK-NEXT: !8 = !DIBasicType()
|
||||
!7 = !DIBasicType(tag: DW_TAG_base_type, name: "name", size: 1, align: 2, encoding: DW_ATE_unsigned_char)
|
||||
!8 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
|
||||
!9 = !DIBasicType()
|
||||
!10 = !DIBasicType(tag: DW_TAG_base_type, name: "", size: 0, align: 0, encoding: 0)
|
||||
|
||||
; CHECK-NEXT: !9 = !MDTemplateTypeParameter(type: !6)
|
||||
; CHECK-NEXT: !10 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
; CHECK-NEXT: !9 = !DITemplateTypeParameter(type: !6)
|
||||
; CHECK-NEXT: !10 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
; CHECK-NEXT: !11 = distinct !{}
|
||||
; CHECK-NEXT: !12 = !MDFile(filename: "", directory: "")
|
||||
!11 = !MDTemplateTypeParameter(type: !7)
|
||||
!12 = !MDFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
; CHECK-NEXT: !12 = !DIFile(filename: "", directory: "")
|
||||
!11 = !DITemplateTypeParameter(type: !7)
|
||||
!12 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
|
||||
!13 = distinct !{}
|
||||
!14 = !MDFile(filename: "", directory: "")
|
||||
!14 = !DIFile(filename: "", directory: "")
|
||||
|
||||
; CHECK-NEXT: !13 = !MDDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 32, align: 32)
|
||||
!15 = !MDDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32, align: 32)
|
||||
; CHECK-NEXT: !13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 32, align: 32)
|
||||
!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32, align: 32)
|
||||
|
||||
; CHECK-NEXT: !14 = !MDCompositeType(tag: DW_TAG_structure_type, name: "MyType", file: !10, line: 2, size: 32, align: 32, identifier: "MangledMyType")
|
||||
; CHECK-NEXT: !15 = distinct !MDCompositeType(tag: DW_TAG_structure_type, name: "Base", scope: !14, file: !10, line: 3, size: 128, align: 32, offset: 64, flags: DIFlagPublic, elements: !16, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !15, templateParams: !18, identifier: "MangledBase")
|
||||
; CHECK-NEXT: !14 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", file: !10, line: 2, size: 32, align: 32, identifier: "MangledMyType")
|
||||
; CHECK-NEXT: !15 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Base", scope: !14, file: !10, line: 3, size: 128, align: 32, offset: 64, flags: DIFlagPublic, elements: !16, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !15, templateParams: !18, identifier: "MangledBase")
|
||||
; CHECK-NEXT: !16 = !{!17}
|
||||
; CHECK-NEXT: !17 = !MDDerivedType(tag: DW_TAG_member, name: "field", scope: !15, file: !10, line: 4, baseType: !6, size: 32, align: 32, offset: 32, flags: DIFlagPublic)
|
||||
; CHECK-NEXT: !17 = !DIDerivedType(tag: DW_TAG_member, name: "field", scope: !15, file: !10, line: 4, baseType: !6, size: 32, align: 32, offset: 32, flags: DIFlagPublic)
|
||||
; CHECK-NEXT: !18 = !{!9}
|
||||
; CHECK-NEXT: !19 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Derived", scope: !14, file: !10, line: 3, baseType: !15, size: 128, align: 32, offset: 64, flags: DIFlagPublic, elements: !20, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !15, templateParams: !18, identifier: "MangledBase")
|
||||
; CHECK-NEXT: !19 = !DICompositeType(tag: DW_TAG_structure_type, name: "Derived", scope: !14, file: !10, line: 3, baseType: !15, size: 128, align: 32, offset: 64, flags: DIFlagPublic, elements: !20, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !15, templateParams: !18, identifier: "MangledBase")
|
||||
; CHECK-NEXT: !20 = !{!21}
|
||||
; CHECK-NEXT: !21 = !MDDerivedType(tag: DW_TAG_inheritance, scope: !19, baseType: !15)
|
||||
; CHECK-NEXT: !22 = !MDDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !6, size: 32, align: 32, extraData: !15)
|
||||
; CHECK-NEXT: !23 = !MDCompositeType(tag: DW_TAG_structure_type)
|
||||
; CHECK-NEXT: !24 = !MDCompositeType(tag: DW_TAG_structure_type, runtimeLang: DW_LANG_Cobol85)
|
||||
!16 = !MDCompositeType(tag: DW_TAG_structure_type, name: "MyType", file: !12, line: 2, size: 32, align: 32, identifier: "MangledMyType")
|
||||
!17 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Base", scope: !16, file: !12, line: 3, size: 128, align: 32, offset: 64, flags: DIFlagPublic, elements: !18, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !17, templateParams: !20, identifier: "MangledBase")
|
||||
; CHECK-NEXT: !21 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !19, baseType: !15)
|
||||
; CHECK-NEXT: !22 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !6, size: 32, align: 32, extraData: !15)
|
||||
; CHECK-NEXT: !23 = !DICompositeType(tag: DW_TAG_structure_type)
|
||||
; CHECK-NEXT: !24 = !DICompositeType(tag: DW_TAG_structure_type, runtimeLang: DW_LANG_Cobol85)
|
||||
!16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", file: !12, line: 2, size: 32, align: 32, identifier: "MangledMyType")
|
||||
!17 = !DICompositeType(tag: DW_TAG_structure_type, name: "Base", scope: !16, file: !12, line: 3, size: 128, align: 32, offset: 64, flags: DIFlagPublic, elements: !18, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !17, templateParams: !20, identifier: "MangledBase")
|
||||
!18 = !{!19}
|
||||
!19 = !MDDerivedType(tag: DW_TAG_member, name: "field", scope: !17, file: !12, line: 4, baseType: !7, size: 32, align: 32, offset: 32, flags: DIFlagPublic)
|
||||
!19 = !DIDerivedType(tag: DW_TAG_member, name: "field", scope: !17, file: !12, line: 4, baseType: !7, size: 32, align: 32, offset: 32, flags: DIFlagPublic)
|
||||
!20 = !{!11}
|
||||
!21 = !MDCompositeType(tag: DW_TAG_structure_type, name: "Derived", scope: !16, file: !12, line: 3, baseType: !17, size: 128, align: 32, offset: 64, flags: DIFlagPublic, elements: !22, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !17, templateParams: !20, identifier: "MangledBase")
|
||||
!21 = !DICompositeType(tag: DW_TAG_structure_type, name: "Derived", scope: !16, file: !12, line: 3, baseType: !17, size: 128, align: 32, offset: 64, flags: DIFlagPublic, elements: !22, runtimeLang: DW_LANG_C_plus_plus_11, vtableHolder: !17, templateParams: !20, identifier: "MangledBase")
|
||||
!22 = !{!23}
|
||||
!23 = !MDDerivedType(tag: DW_TAG_inheritance, scope: !21, baseType: !17)
|
||||
!24 = !MDDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !7, size: 32, align: 32, extraData: !17)
|
||||
!25 = !MDCompositeType(tag: DW_TAG_structure_type)
|
||||
!26 = !MDCompositeType(tag: DW_TAG_structure_type, runtimeLang: 6)
|
||||
!23 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !21, baseType: !17)
|
||||
!24 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !7, size: 32, align: 32, extraData: !17)
|
||||
!25 = !DICompositeType(tag: DW_TAG_structure_type)
|
||||
!26 = !DICompositeType(tag: DW_TAG_structure_type, runtimeLang: 6)
|
||||
|
||||
; !25 = !{!7, !7}
|
||||
; !26 = !MDSubroutineType(flags: DIFlagPublic | DIFlagStaticMember, types: !25)
|
||||
; !27 = !MDSubroutineType(types: !25)
|
||||
; !26 = !DISubroutineType(flags: DIFlagPublic | DIFlagStaticMember, types: !25)
|
||||
; !27 = !DISubroutineType(types: !25)
|
||||
!27 = !{!7, !7}
|
||||
!28 = !MDSubroutineType(flags: DIFlagPublic | DIFlagStaticMember, types: !27)
|
||||
!29 = !MDSubroutineType(flags: 0, types: !27)
|
||||
!30 = !MDSubroutineType(types: !27)
|
||||
!28 = !DISubroutineType(flags: DIFlagPublic | DIFlagStaticMember, types: !27)
|
||||
!29 = !DISubroutineType(flags: 0, types: !27)
|
||||
!30 = !DISubroutineType(types: !27)
|
||||
|
@ -12,17 +12,17 @@ entry:
|
||||
!llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!9}
|
||||
|
||||
!0 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.5 (trunk 195495) (llvm/trunk 195495:195504M)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
|
||||
!1 = !MDFile(filename: "../llvm/tools/clang/test/CodeGen/debug-info-version.c", directory: "/Users/manmanren/llvm_gmail/release")
|
||||
!0 = !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5 (trunk 195495) (llvm/trunk 195495:195504M)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
|
||||
!1 = !DIFile(filename: "../llvm/tools/clang/test/CodeGen/debug-info-version.c", directory: "/Users/manmanren/llvm_gmail/release")
|
||||
!2 = !{i32 0}
|
||||
!3 = !{!4}
|
||||
!4 = !MDSubprogram(name: "main", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !5, type: !6, function: i32 ()* @main, variables: !2)
|
||||
!5 = !MDFile(filename: "../llvm/tools/clang/test/CodeGen/debug-info-version.c", directory: "/Users/manmanren/llvm_gmail/release")
|
||||
!6 = !MDSubroutineType(types: !7)
|
||||
!4 = !DISubprogram(name: "main", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !5, type: !6, function: i32 ()* @main, variables: !2)
|
||||
!5 = !DIFile(filename: "../llvm/tools/clang/test/CodeGen/debug-info-version.c", directory: "/Users/manmanren/llvm_gmail/release")
|
||||
!6 = !DISubroutineType(types: !7)
|
||||
!7 = !{!8}
|
||||
!8 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
!9 = !{i32 2, !"Dwarf Version", i32 2}
|
||||
!12 = !MDLocation(line: 4, scope: !4)
|
||||
!12 = !DILocation(line: 4, scope: !4)
|
||||
|
||||
; WARN: warning: ignoring debug info with an invalid version (0)
|
||||
; CHECK-NOT: !dbg
|
||||
|
@ -7,21 +7,21 @@
|
||||
; CHECK: !0 = !{}
|
||||
!0 = !{}
|
||||
|
||||
; CHECK-NEXT: !1 = !GenericDebugNode(tag: DW_TAG_entry_point, header: "some\00header", operands: {!0, !2, !2})
|
||||
!1 = !GenericDebugNode(tag: 3, header: "some\00header", operands: {!0, !3, !4})
|
||||
!2 = !GenericDebugNode(tag: 3, header: "some\00header", operands: {!{}, !3, !4})
|
||||
; CHECK-NEXT: !1 = !GenericDINode(tag: DW_TAG_entry_point, header: "some\00header", operands: {!0, !2, !2})
|
||||
!1 = !GenericDINode(tag: 3, header: "some\00header", operands: {!0, !3, !4})
|
||||
!2 = !GenericDINode(tag: 3, header: "some\00header", operands: {!{}, !3, !4})
|
||||
|
||||
; CHECK-NEXT: !2 = !GenericDebugNode(tag: DW_TAG_entry_point)
|
||||
!3 = !GenericDebugNode(tag: 3)
|
||||
!4 = !GenericDebugNode(tag: 3, header: "")
|
||||
!5 = !GenericDebugNode(tag: 3, operands: {})
|
||||
!6 = !GenericDebugNode(tag: 3, header: "", operands: {})
|
||||
; CHECK-NEXT: !2 = !GenericDINode(tag: DW_TAG_entry_point)
|
||||
!3 = !GenericDINode(tag: 3)
|
||||
!4 = !GenericDINode(tag: 3, header: "")
|
||||
!5 = !GenericDINode(tag: 3, operands: {})
|
||||
!6 = !GenericDINode(tag: 3, header: "", operands: {})
|
||||
|
||||
; CHECK-NEXT: !3 = distinct !GenericDebugNode(tag: DW_TAG_entry_point)
|
||||
!7 = distinct !GenericDebugNode(tag: 3)
|
||||
; CHECK-NEXT: !3 = distinct !GenericDINode(tag: DW_TAG_entry_point)
|
||||
!7 = distinct !GenericDINode(tag: 3)
|
||||
|
||||
; CHECK-NEXT: !4 = !GenericDebugNode(tag: 65535)
|
||||
!8 = !GenericDebugNode(tag: 65535)
|
||||
; CHECK-NEXT: !4 = !GenericDINode(tag: 65535)
|
||||
!8 = !GenericDINode(tag: 65535)
|
||||
|
||||
; CHECK-NOT: !
|
||||
!9 = !GenericDebugNode(tag: DW_TAG_entry_point)
|
||||
!9 = !GenericDINode(tag: DW_TAG_entry_point)
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:29: error: invalid DWARF tag 'DW_TAG_badtag'
|
||||
!0 = !GenericDebugNode(tag: DW_TAG_badtag)
|
||||
; CHECK: <stdin>:[[@LINE+1]]:26: error: invalid DWARF tag 'DW_TAG_badtag'
|
||||
!0 = !GenericDINode(tag: DW_TAG_badtag)
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:47: error: missing required field 'tag'
|
||||
!0 = !GenericDebugNode(header: "some\00header")
|
||||
; CHECK: <stdin>:[[@LINE+1]]:44: error: missing required field 'tag'
|
||||
!0 = !GenericDINode(header: "some\00header")
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK-NOT: error:
|
||||
!0 = !GenericDebugNode(tag: 65535)
|
||||
!0 = !GenericDINode(tag: 65535)
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:29: error: value for 'tag' too large, limit is 65535
|
||||
!1 = !GenericDebugNode(tag: 65536)
|
||||
; CHECK: <stdin>:[[@LINE+1]]:26: error: value for 'tag' too large, limit is 65535
|
||||
!1 = !GenericDINode(tag: 65536)
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:29: error: expected DWARF tag
|
||||
!0 = !GenericDebugNode(tag: "string")
|
||||
; CHECK: <stdin>:[[@LINE+1]]:26: error: expected DWARF tag
|
||||
!0 = !GenericDINode(tag: "string")
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:31: error: invalid DWARF language 'DW_LANG_NoSuchLanguage'
|
||||
!0 = !MDCompileUnit(language: DW_LANG_NoSuchLanguage,
|
||||
file: !MDFile(filename: "a", directory: "b"))
|
||||
!0 = !DICompileUnit(language: DW_LANG_NoSuchLanguage,
|
||||
file: !DIFile(filename: "a", directory: "b"))
|
||||
|
@ -1,9 +1,9 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK-NOT: error:
|
||||
!0 = !MDCompileUnit(language: 65535,
|
||||
file: !MDFile(filename: "a", directory: "b"))
|
||||
!0 = !DICompileUnit(language: 65535,
|
||||
file: !DIFile(filename: "a", directory: "b"))
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:31: error: value for 'language' too large, limit is 65535
|
||||
!1 = !MDCompileUnit(language: 65536,
|
||||
file: !MDFile(filename: "a", directory: "b"))
|
||||
!1 = !DICompileUnit(language: 65536,
|
||||
file: !DIFile(filename: "a", directory: "b"))
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:65: error: missing required field 'language'
|
||||
!0 = !MDCompileUnit(file: !MDFile(filename: "a", directory: "b"))
|
||||
!0 = !DICompileUnit(file: !DIFile(filename: "a", directory: "b"))
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:27: error: 'file' cannot be null
|
||||
!0 = !MDCompileUnit(file: null)
|
||||
!0 = !DICompileUnit(file: null)
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:36: error: missing required field 'tag'
|
||||
!25 = !MDCompositeType(name: "Type")
|
||||
!25 = !DICompositeType(name: "Type")
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:45: error: missing required field 'baseType'
|
||||
!0 = !MDDerivedType(tag: DW_TAG_pointer_type)
|
||||
!0 = !DIDerivedType(tag: DW_TAG_pointer_type)
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:34: error: missing required field 'tag'
|
||||
!0 = !MDDerivedType(baseType: !{})
|
||||
!0 = !DIDerivedType(baseType: !{})
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:28: error: missing required field 'name'
|
||||
!0 = !MDEnumerator(value: 7)
|
||||
!0 = !DIEnumerator(value: 7)
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:32: error: missing required field 'value'
|
||||
!0 = !MDEnumerator(name: "name")
|
||||
!0 = !DIEnumerator(name: "name")
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK-NOT: error:
|
||||
!0 = !MDExpression(18446744073709551615)
|
||||
!0 = !DIExpression(18446744073709551615)
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:20: error: element too large, limit is 18446744073709551615
|
||||
!1 = !MDExpression(18446744073709551616)
|
||||
!1 = !DIExpression(18446744073709551616)
|
||||
|
@ -4,6 +4,6 @@
|
||||
; NOVERIFY: !named = !{!0}
|
||||
!named = !{!0}
|
||||
|
||||
; NOVERIFY: !0 = !MDExpression(0, 1, 9, 7, 2)
|
||||
; NOVERIFY: !0 = !DIExpression(0, 1, 9, 7, 2)
|
||||
; VERIFY: assembly parsed, but does not verify
|
||||
!0 = !MDExpression(0, 1, 9, 7, 2)
|
||||
!0 = !DIExpression(0, 1, 9, 7, 2)
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:30: error: missing required field 'directory'
|
||||
!0 = !MDFile(filename: "file")
|
||||
!0 = !DIFile(filename: "file")
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:30: error: missing required field 'filename'
|
||||
!0 = !MDFile(directory: "dir")
|
||||
!0 = !DIFile(directory: "dir")
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:30: error: 'name' cannot be empty
|
||||
!0 = !MDGlobalVariable(name: "")
|
||||
!0 = !DIGlobalVariable(name: "")
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:24: error: missing required field 'name'
|
||||
!0 = !MDGlobalVariable()
|
||||
!0 = !DIGlobalVariable()
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:51: error: missing required field 'scope'
|
||||
!3 = !MDImportedEntity(tag: DW_TAG_imported_module)
|
||||
!3 = !DIImportedEntity(tag: DW_TAG_imported_module)
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:33: error: missing required field 'tag'
|
||||
!3 = !MDImportedEntity(scope: !0)
|
||||
!3 = !DIImportedEntity(scope: !0)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user