[llvm] 1bebc31 - [DebugInfo] generate btf_tag annotations for func parameters
Yonghong Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 26 14:19:05 PDT 2021
Author: Yonghong Song
Date: 2021-08-26T14:18:30-07:00
New Revision: 1bebc31c617d1a0773f1d561f02dd17c5e83b23b
URL: https://github.com/llvm/llvm-project/commit/1bebc31c617d1a0773f1d561f02dd17c5e83b23b
DIFF: https://github.com/llvm/llvm-project/commit/1bebc31c617d1a0773f1d561f02dd17c5e83b23b.diff
LOG: [DebugInfo] generate btf_tag annotations for func parameters
Generate btf_tag annotations for function parameters.
A field "annotations" is introduced to DILocalVariable, and
annotations are represented as an DINodeArray, similar to
DIComposite elements. The following example illustrates how
annotations are encoded in IR:
distinct !DILocalVariable(name: "info",, arg: 1, ..., annotations: !10)
!10 = !{!11, !12}
!11 = !{!"btf_tag", !"a"}
!12 = !{!"btf_tag", !"b"}
Differential Revision: https://reviews.llvm.org/D106620
Added:
llvm/test/Bitcode/attr-btf_tag-parameter.ll
Modified:
llvm/include/llvm/IR/DIBuilder.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/unittests/IR/MetadataTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
index 1d1efe8b1bd57..6c7cbc8fb6449 100644
--- a/llvm/include/llvm/IR/DIBuilder.h
+++ b/llvm/include/llvm/IR/DIBuilder.h
@@ -688,7 +688,8 @@ namespace llvm {
createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo,
DIFile *File, unsigned LineNo, DIType *Ty,
bool AlwaysPreserve = false,
- DINode::DIFlags Flags = DINode::FlagZero);
+ DINode::DIFlags Flags = DINode::FlagZero,
+ DINodeArray Annotations = nullptr);
/// Create a new descriptor for the specified
/// variable which has a complex address expression for its address.
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index 12cc72a6ad293..54b2bfafc7603 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -3113,34 +3113,37 @@ class DILocalVariable : public DIVariable {
static DILocalVariable *getImpl(LLVMContext &Context, DIScope *Scope,
StringRef Name, DIFile *File, unsigned Line,
DIType *Type, unsigned Arg, DIFlags Flags,
- uint32_t AlignInBits, StorageType Storage,
- bool ShouldCreate = true) {
+ uint32_t AlignInBits, DINodeArray Annotations,
+ StorageType Storage, bool ShouldCreate = true) {
return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
- Line, Type, Arg, Flags, AlignInBits, Storage, ShouldCreate);
+ Line, Type, Arg, Flags, AlignInBits, Annotations.get(), Storage,
+ ShouldCreate);
}
static DILocalVariable *getImpl(LLVMContext &Context, Metadata *Scope,
MDString *Name, Metadata *File, unsigned Line,
Metadata *Type, unsigned Arg, DIFlags Flags,
- uint32_t AlignInBits, StorageType Storage,
- bool ShouldCreate = true);
+ uint32_t AlignInBits, Metadata *Annotations,
+ StorageType Storage, bool ShouldCreate = true);
TempDILocalVariable cloneImpl() const {
return getTemporary(getContext(), getScope(), getName(), getFile(),
getLine(), getType(), getArg(), getFlags(),
- getAlignInBits());
+ getAlignInBits(), getAnnotations());
}
public:
DEFINE_MDNODE_GET(DILocalVariable,
(DILocalScope * Scope, StringRef Name, DIFile *File,
unsigned Line, DIType *Type, unsigned Arg, DIFlags Flags,
- uint32_t AlignInBits),
- (Scope, Name, File, Line, Type, Arg, Flags, AlignInBits))
+ uint32_t AlignInBits, DINodeArray Annotations),
+ (Scope, Name, File, Line, Type, Arg, Flags, AlignInBits,
+ Annotations))
DEFINE_MDNODE_GET(DILocalVariable,
(Metadata * Scope, MDString *Name, Metadata *File,
unsigned Line, Metadata *Type, unsigned Arg,
- DIFlags Flags, uint32_t AlignInBits),
- (Scope, Name, File, Line, Type, Arg, Flags, AlignInBits))
+ DIFlags Flags, uint32_t AlignInBits, Metadata *Annotations),
+ (Scope, Name, File, Line, Type, Arg, Flags, AlignInBits,
+ Annotations))
TempDILocalVariable clone() const { return cloneImpl(); }
@@ -3155,6 +3158,11 @@ class DILocalVariable : public DIVariable {
unsigned getArg() const { return Arg; }
DIFlags getFlags() const { return Flags; }
+ DINodeArray getAnnotations() const {
+ return cast_or_null<MDTuple>(getRawAnnotations());
+ }
+ Metadata *getRawAnnotations() const { return getOperand(4); }
+
bool isArtificial() const { return getFlags() & FlagArtificial; }
bool isObjectPointer() const { return getFlags() & FlagObjectPointer; }
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index f6f317e24c07e..62c72533398e4 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -4976,13 +4976,15 @@ bool LLParser::parseDILocalVariable(MDNode *&Result, bool IsDistinct) {
OPTIONAL(line, LineField, ); \
OPTIONAL(type, MDField, ); \
OPTIONAL(flags, DIFlagField, ); \
- OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX));
+ OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX)); \
+ OPTIONAL(annotations, MDField, );
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS
Result = GET_OR_DISTINCT(DILocalVariable,
(Context, scope.Val, name.Val, file.Val, line.Val,
- type.Val, arg.Val, flags.Val, align.Val));
+ type.Val, arg.Val, flags.Val, align.Val,
+ annotations.Val));
return false;
}
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 3fc0919fc600a..9ac6358d52e87 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -1961,18 +1961,23 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
bool HasTag = !HasAlignment && Record.size() > 8;
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(Record[7 + HasTag]);
uint32_t AlignInBits = 0;
+ Metadata *Annotations = nullptr;
if (HasAlignment) {
- if (Record[8 + HasTag] > (uint64_t)std::numeric_limits<uint32_t>::max())
+ if (Record[8] > (uint64_t)std::numeric_limits<uint32_t>::max())
return error("Alignment value is too large");
- AlignInBits = Record[8 + HasTag];
+ AlignInBits = Record[8];
+ if (Record.size() > 9)
+ Annotations = getMDOrNull(Record[9]);
}
+
MetadataList.assignValue(
GET_OR_DISTINCT(DILocalVariable,
(Context, getMDOrNull(Record[1 + HasTag]),
getMDString(Record[2 + HasTag]),
getMDOrNull(Record[3 + HasTag]), Record[4 + HasTag],
getDITypeRefOrNull(Record[5 + HasTag]),
- Record[6 + HasTag], Flags, AlignInBits)),
+ Record[6 + HasTag], Flags, AlignInBits,
+ Annotations)),
NextMetadataNo);
NextMetadataNo++;
break;
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index d01273399ac56..a7061c681121e 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1994,6 +1994,7 @@ void ModuleBitcodeWriter::writeDILocalVariable(
Record.push_back(N->getArg());
Record.push_back(N->getFlags());
Record.push_back(N->getAlignInBits());
+ Record.push_back(VE.getMetadataOrNullID(N->getAnnotations().get()));
Stream.EmitRecord(bitc::METADATA_LOCAL_VAR, Record, Abbrev);
Record.clear();
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 9b78f0b610267..4c15827ae4d70 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -2316,6 +2316,7 @@ static void writeDILocalVariable(raw_ostream &Out, const DILocalVariable *N,
Printer.printMetadata("type", N->getRawType());
Printer.printDIFlags("flags", N->getFlags());
Printer.printInt("align", N->getAlignInBits());
+ Printer.printMetadata("annotations", N->getRawAnnotations());
Out << ")";
}
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 9d76ac192d561..7bccaea3d56bf 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -739,7 +739,7 @@ static DILocalVariable *createLocalVariable(
DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> &PreservedVariables,
DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags,
- uint32_t AlignInBits) {
+ uint32_t AlignInBits, DINodeArray Annotations = nullptr) {
// FIXME: Why getNonCompileUnitScope()?
// FIXME: Why is "!Context" okay here?
// FIXME: Why doesn't this check for a subprogram or lexical block (AFAICT
@@ -748,7 +748,8 @@ static DILocalVariable *createLocalVariable(
auto *Node =
DILocalVariable::get(VMContext, cast_or_null<DILocalScope>(Context), Name,
- File, LineNo, Ty, ArgNo, Flags, AlignInBits);
+ File, LineNo, Ty, ArgNo, Flags, AlignInBits,
+ Annotations);
if (AlwaysPreserve) {
// The optimizer may remove local variables. If there is an interest
// to preserve variable info in such situation then stash it in a
@@ -772,11 +773,12 @@ DILocalVariable *DIBuilder::createAutoVariable(DIScope *Scope, StringRef Name,
DILocalVariable *DIBuilder::createParameterVariable(
DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
- unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags) {
+ unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags,
+ DINodeArray Annotations) {
assert(ArgNo && "Expected non-zero argument number for parameter");
return createLocalVariable(VMContext, PreservedVariables, Scope, Name, ArgNo,
File, LineNo, Ty, AlwaysPreserve, Flags,
- /* AlignInBits */0);
+ /* AlignInBits */0, Annotations);
}
DILabel *DIBuilder::createLabel(
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 590020e99f3e7..48e83f4258ec0 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -1011,6 +1011,7 @@ DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
unsigned Line, Metadata *Type,
unsigned Arg, DIFlags Flags,
uint32_t AlignInBits,
+ Metadata *Annotations,
StorageType Storage,
bool ShouldCreate) {
// 64K ought to be enough for any frontend.
@@ -1020,8 +1021,8 @@ DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
assert(isCanonical(Name) && "Expected canonical MDString");
DEFINE_GETIMPL_LOOKUP(DILocalVariable,
(Scope, Name, File, Line, Type, Arg, Flags,
- AlignInBits));
- Metadata *Ops[] = {Scope, Name, File, Type};
+ AlignInBits, Annotations));
+ Metadata *Ops[] = {Scope, Name, File, Type, Annotations};
DEFINE_GETIMPL_STORE(DILocalVariable, (Line, Arg, Flags, AlignInBits), Ops);
}
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 38c8b55606059..e34155c427bb2 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -1042,22 +1042,25 @@ template <> struct MDNodeKeyImpl<DILocalVariable> {
unsigned Arg;
unsigned Flags;
uint32_t AlignInBits;
+ Metadata *Annotations;
MDNodeKeyImpl(Metadata *Scope, MDString *Name, Metadata *File, unsigned Line,
Metadata *Type, unsigned Arg, unsigned Flags,
- uint32_t AlignInBits)
+ uint32_t AlignInBits, Metadata *Annotations)
: Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), Arg(Arg),
- Flags(Flags), AlignInBits(AlignInBits) {}
+ Flags(Flags), AlignInBits(AlignInBits), Annotations(Annotations) {}
MDNodeKeyImpl(const DILocalVariable *N)
: Scope(N->getRawScope()), Name(N->getRawName()), File(N->getRawFile()),
Line(N->getLine()), Type(N->getRawType()), Arg(N->getArg()),
- Flags(N->getFlags()), AlignInBits(N->getAlignInBits()) {}
+ Flags(N->getFlags()), AlignInBits(N->getAlignInBits()),
+ Annotations(N->getRawAnnotations()) {}
bool isKeyOf(const DILocalVariable *RHS) const {
return Scope == RHS->getRawScope() && Name == RHS->getRawName() &&
File == RHS->getRawFile() && Line == RHS->getLine() &&
Type == RHS->getRawType() && Arg == RHS->getArg() &&
- Flags == RHS->getFlags() && AlignInBits == RHS->getAlignInBits();
+ Flags == RHS->getFlags() && AlignInBits == RHS->getAlignInBits() &&
+ Annotations == RHS->getRawAnnotations();
}
unsigned getHashValue() const {
@@ -1068,7 +1071,7 @@ template <> struct MDNodeKeyImpl<DILocalVariable> {
// clang/test/CodeGen/debug-info-257-args.c is an example of this problem,
// generated IR is random for each run and test fails with Align included.
// TODO: make hashing work fine with such situations
- return hash_combine(Scope, Name, File, Line, Type, Arg, Flags);
+ return hash_combine(Scope, Name, File, Line, Type, Arg, Flags, Annotations);
}
};
diff --git a/llvm/test/Bitcode/attr-btf_tag-parameter.ll b/llvm/test/Bitcode/attr-btf_tag-parameter.ll
new file mode 100644
index 0000000000000..a31a19a138ec5
--- /dev/null
+++ b/llvm/test/Bitcode/attr-btf_tag-parameter.ll
@@ -0,0 +1,46 @@
+; REQUIRES: x86-registered-target
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone uwtable willreturn
+define dso_local i32 @f(i32 %a) local_unnamed_addr #0 !dbg !8 {
+entry:
+ call void @llvm.dbg.value(metadata i32 %a, metadata !13, metadata !DIExpression()), !dbg !17
+ ret i32 0, !dbg !18
+}
+
+; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
+declare void @llvm.dbg.value(metadata, metadata, metadata) #1
+
+attributes #0 = { mustprogress nofree norecurse nosync nounwind readnone uwtable willreturn "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4, !5, !6}
+!llvm.ident = !{!7}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git c9e3139e00bcef23b236a02890b909a130d1b3d9)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "func.c", directory: "/home/yhs/work/tests/llvm/btf_tag")
+!2 = !{}
+!3 = !{i32 7, !"Dwarf Version", i32 4}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 4}
+!6 = !{i32 7, !"uwtable", i32 1}
+!7 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git c9e3139e00bcef23b236a02890b909a130d1b3d9)"}
+!8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)
+!9 = !DISubroutineType(types: !10)
+!10 = !{!11, !11}
+!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!12 = !{!13}
+!13 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 1, type: !11, annotations: !14)
+!14 = !{!15, !16}
+!15 = !{!"btf_tag", !"a"}
+!16 = !{!"btf_tag", !"b"}
+
+; CHECK: !DILocalVariable(name: "a", arg: 1,
+; CHECK-SAME: annotations: ![[ANNOT:[0-9]+]]
+; CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
+; CHECK: ![[TAG1]] = !{!"btf_tag", !"a"}
+; CHECK: ![[TAG2]] = !{!"btf_tag", !"b"}
+
+!17 = !DILocation(line: 0, scope: !8)
+!18 = !DILocation(line: 1, column: 76, scope: !8)
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index d500823773cee..88863cde3788b 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -1171,7 +1171,7 @@ TEST_F(DISubrangeTest, getVariableCount) {
DIType *Type = getDerivedType();
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7);
auto *VlaExpr = DILocalVariable::get(Context, Scope, "vla_expr", File, 8,
- Type, 2, Flags, 8);
+ Type, 2, Flags, 8, nullptr);
auto *N = DISubrange::get(Context, VlaExpr, 0);
auto Count = N->getCount();
@@ -1199,7 +1199,7 @@ TEST_F(DISubrangeTest, fortranAllocatableInt) {
auto *UIother = ConstantAsMetadata::get(
ConstantInt::getSigned(Type::getInt64Ty(Context), 20));
auto *UVother = DILocalVariable::get(Context, Scope, "ubother", File, 8, Type,
- 2, Flags, 8);
+ 2, Flags, 8, nullptr);
auto *UEother = DIExpression::get(Context, {5, 6});
auto *LIZero = ConstantAsMetadata::get(
ConstantInt::getSigned(Type::getInt64Ty(Context), 0));
@@ -1242,13 +1242,16 @@ TEST_F(DISubrangeTest, fortranAllocatableVar) {
DIType *Type = getDerivedType();
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7);
auto *LV =
- DILocalVariable::get(Context, Scope, "lb", File, 8, Type, 2, Flags, 8);
+ DILocalVariable::get(Context, Scope, "lb", File, 8, Type, 2, Flags, 8,
+ nullptr);
auto *UV =
- DILocalVariable::get(Context, Scope, "ub", File, 8, Type, 2, Flags, 8);
+ DILocalVariable::get(Context, Scope, "ub", File, 8, Type, 2, Flags, 8,
+ nullptr);
auto *SV =
- DILocalVariable::get(Context, Scope, "st", File, 8, Type, 2, Flags, 8);
+ DILocalVariable::get(Context, Scope, "st", File, 8, Type, 2, Flags, 8,
+ nullptr);
auto *SVother = DILocalVariable::get(Context, Scope, "stother", File, 8, Type,
- 2, Flags, 8);
+ 2, Flags, 8, nullptr);
auto *SIother = ConstantAsMetadata::get(
ConstantInt::getSigned(Type::getInt64Ty(Context), 20));
auto *SEother = DIExpression::get(Context, {5, 6});
@@ -1289,7 +1292,7 @@ TEST_F(DISubrangeTest, fortranAllocatableExpr) {
auto *LIother = ConstantAsMetadata::get(
ConstantInt::getSigned(Type::getInt64Ty(Context), 20));
auto *LVother = DILocalVariable::get(Context, Scope, "lbother", File, 8, Type,
- 2, Flags, 8);
+ 2, Flags, 8, nullptr);
auto *N = DISubrange::get(Context, nullptr, LE, UE, SE);
@@ -1328,7 +1331,7 @@ TEST_F(DIGenericSubrangeTest, fortranAssumedRankInt) {
auto *SI = DIExpression::get(Context, {dwarf::DW_OP_consts, 4});
auto *UIother = DIExpression::get(Context, {dwarf::DW_OP_consts, 20});
auto *UVother = DILocalVariable::get(Context, Scope, "ubother", File, 8, Type,
- 2, Flags, 8);
+ 2, Flags, 8, nullptr);
auto *UEother = DIExpression::get(Context, {5, 6});
auto *LIZero = DIExpression::get(Context, {dwarf::DW_OP_consts, 0});
auto *UIZero = DIExpression::get(Context, {dwarf::DW_OP_consts, 0});
@@ -1371,13 +1374,16 @@ TEST_F(DIGenericSubrangeTest, fortranAssumedRankVar) {
DIType *Type = getDerivedType();
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7);
auto *LV =
- DILocalVariable::get(Context, Scope, "lb", File, 8, Type, 2, Flags, 8);
+ DILocalVariable::get(Context, Scope, "lb", File, 8, Type, 2, Flags, 8,
+ nullptr);
auto *UV =
- DILocalVariable::get(Context, Scope, "ub", File, 8, Type, 2, Flags, 8);
+ DILocalVariable::get(Context, Scope, "ub", File, 8, Type, 2, Flags, 8,
+ nullptr);
auto *SV =
- DILocalVariable::get(Context, Scope, "st", File, 8, Type, 2, Flags, 8);
+ DILocalVariable::get(Context, Scope, "st", File, 8, Type, 2, Flags, 8,
+ nullptr);
auto *SVother = DILocalVariable::get(Context, Scope, "stother", File, 8, Type,
- 2, Flags, 8);
+ 2, Flags, 8, nullptr);
auto *SIother = DIExpression::get(
Context, {dwarf::DW_OP_consts, static_cast<uint64_t>(-1)});
auto *SEother = DIExpression::get(Context, {5, 6});
@@ -1412,12 +1418,12 @@ TEST_F(DIGenericSubrangeTest, useDIBuilder) {
DIType *Type = getDerivedType();
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7);
auto *LV =
- DILocalVariable::get(Context, Scope, "lb", File, 8, Type, 2, Flags, 8);
+ DILocalVariable::get(Context, Scope, "lb", File, 8, Type, 2, Flags, 8, nullptr);
auto *UE = DIExpression::get(Context, {2, 3});
auto *SE = DIExpression::get(Context, {3, 4});
auto *LVother = DILocalVariable::get(Context, Scope, "lbother", File, 8, Type,
- 2, Flags, 8);
+ 2, Flags, 8, nullptr);
auto *LIother = DIExpression::get(
Context, {dwarf::DW_OP_consts, static_cast<uint64_t>(-1)});
@@ -1917,9 +1923,9 @@ TEST_F(DICompositeTypeTest, dynamicArray) {
StringRef Identifier = "some id";
DIType *Type = getDerivedType();
Metadata *DlVar1 = DILocalVariable::get(Context, Scope, "dl_var1", File, 8,
- Type, 2, Flags, 8);
+ Type, 2, Flags, 8, nullptr);
Metadata *DlVar2 = DILocalVariable::get(Context, Scope, "dl_var2", File, 8,
- Type, 2, Flags, 8);
+ Type, 2, Flags, 8, nullptr);
uint64_t Elements1[] = {dwarf::DW_OP_push_object_address, dwarf::DW_OP_deref};
Metadata *DataLocation1 = DIExpression::get(Context, Elements1);
@@ -2697,7 +2703,7 @@ TEST_F(DILocalVariableTest, get) {
auto *N =
DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg, Flags,
- AlignInBits);
+ AlignInBits, nullptr);
EXPECT_TRUE(N->isParameter());
EXPECT_EQ(Scope, N->getScope());
EXPECT_EQ(Name, N->getName());
@@ -2708,25 +2714,26 @@ TEST_F(DILocalVariableTest, get) {
EXPECT_EQ(Flags, N->getFlags());
EXPECT_EQ(AlignInBits, N->getAlignInBits());
EXPECT_EQ(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg,
- Flags, AlignInBits));
+ Flags, AlignInBits, nullptr));
EXPECT_FALSE(
DILocalVariable::get(Context, Scope, Name, File, Line, Type, 0, Flags,
- AlignInBits)->isParameter());
+ AlignInBits, nullptr)->isParameter());
EXPECT_NE(N, DILocalVariable::get(Context, getSubprogram(), Name, File, Line,
- Type, Arg, Flags, AlignInBits));
+ Type, Arg, Flags, AlignInBits, nullptr));
EXPECT_NE(N, DILocalVariable::get(Context, Scope, "other", File, Line, Type,
- Arg, Flags, AlignInBits));
+ Arg, Flags, AlignInBits, nullptr));
EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, getFile(), Line, Type,
- Arg, Flags, AlignInBits));
+ Arg, Flags, AlignInBits, nullptr));
EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line + 1, Type,
- Arg, Flags, AlignInBits));
+ Arg, Flags, AlignInBits, nullptr));
EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line,
- getDerivedType(), Arg, Flags, AlignInBits));
+ getDerivedType(), Arg, Flags, AlignInBits,
+ nullptr));
EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type,
- Arg + 1, Flags, AlignInBits));
+ Arg + 1, Flags, AlignInBits, nullptr));
EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type,
- Arg, Flags, (AlignInBits << 1)));
+ Arg, Flags, (AlignInBits << 1), nullptr));
TempDILocalVariable Temp = N->clone();
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
@@ -2734,17 +2741,21 @@ TEST_F(DILocalVariableTest, get) {
TEST_F(DILocalVariableTest, getArg256) {
EXPECT_EQ(255u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
- 0, nullptr, 255, DINode::FlagZero, 0)
+ 0, nullptr, 255, DINode::FlagZero, 0,
+ nullptr)
->getArg());
EXPECT_EQ(256u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
- 0, nullptr, 256, DINode::FlagZero, 0)
+ 0, nullptr, 256, DINode::FlagZero, 0,
+ nullptr)
->getArg());
EXPECT_EQ(257u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
- 0, nullptr, 257, DINode::FlagZero, 0)
+ 0, nullptr, 257, DINode::FlagZero, 0,
+ nullptr)
->getArg());
unsigned Max = UINT16_MAX;
EXPECT_EQ(Max, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
- 0, nullptr, Max, DINode::FlagZero, 0)
+ 0, nullptr, Max, DINode::FlagZero, 0,
+ nullptr)
->getArg());
}
@@ -3456,9 +3467,9 @@ TEST_F(DebugVariableTest, DenseMap) {
DILocation *InlinedLoc = DILocation::get(Context, 2, 7, Scope);
DILocalVariable *VarA =
- DILocalVariable::get(Context, Scope, "A", File, 5, Type, 2, Flags, 8);
+ DILocalVariable::get(Context, Scope, "A", File, 5, Type, 2, Flags, 8, nullptr);
DILocalVariable *VarB =
- DILocalVariable::get(Context, Scope, "B", File, 7, Type, 3, Flags, 8);
+ DILocalVariable::get(Context, Scope, "B", File, 7, Type, 3, Flags, 8, nullptr);
DebugVariable DebugVariableA(VarA, NoneType(), nullptr);
DebugVariable DebugVariableInlineA(VarA, NoneType(), InlinedLoc);
More information about the llvm-commits
mailing list