summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-04-08 20:18:57 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-04-08 20:18:57 +0000
commit0b9c7bb9fce116d35824c3732b4780f229b76820 (patch)
tree2c6e3f799817e146dc6e95add1d5b59eea8601da
parente70edce22b138b35d403fd1a86ad844c0ff87a51 (diff)
downloadbcm5719-llvm-0b9c7bb9fce116d35824c3732b4780f229b76820.tar.gz
bcm5719-llvm-0b9c7bb9fce116d35824c3732b4780f229b76820.zip
Go bindings: make various DIBuilder arguments optional.
r234262 changed some code in DIBuilderBindings.cpp to use the unwrap function to unwrap debug metadata. The problem with this is that unwrap asserts that its argument is non-null, which is not what we want in a number of places in DIBuilder where the argument is optional. This change makes certain arguments optional by adding null checks in places where it is required, fixing the llgo build. llvm-svn: 234428
-rw-r--r--llvm/bindings/go/llvm/DIBuilderBindings.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/llvm/bindings/go/llvm/DIBuilderBindings.cpp b/llvm/bindings/go/llvm/DIBuilderBindings.cpp
index ed583a8f76a..ee2e70a579b 100644
--- a/llvm/bindings/go/llvm/DIBuilderBindings.cpp
+++ b/llvm/bindings/go/llvm/DIBuilderBindings.cpp
@@ -83,9 +83,9 @@ LLVMMetadataRef LLVMDIBuilderCreateFunction(
DIBuilder *D = unwrap(Dref);
DISubprogram SP = D->createFunction(
DIDescriptor(unwrap<MDScope>(Scope)), Name, LinkageName,
- unwrap<MDFile>(File), Line, unwrap<MDCompositeTypeBase>(CompositeType),
- IsLocalToUnit, IsDefinition, ScopeLine, Flags, IsOptimized,
- unwrap<Function>(Func));
+ File ? unwrap<MDFile>(File) : nullptr, Line,
+ unwrap<MDCompositeTypeBase>(CompositeType), IsLocalToUnit, IsDefinition,
+ ScopeLine, Flags, IsOptimized, unwrap<Function>(Func));
return wrap(SP);
}
@@ -125,8 +125,9 @@ LLVMMetadataRef
LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Dref, LLVMMetadataRef File,
LLVMMetadataRef ParameterTypes) {
DIBuilder *D = unwrap(Dref);
- DICompositeType CT = D->createSubroutineType(
- unwrap<MDFile>(File), DITypeArray(unwrap<MDTuple>(ParameterTypes)));
+ DICompositeType CT =
+ D->createSubroutineType(File ? unwrap<MDFile>(File) : nullptr,
+ DITypeArray(unwrap<MDTuple>(ParameterTypes)));
return wrap(CT);
}
@@ -137,9 +138,10 @@ LLVMMetadataRef LLVMDIBuilderCreateStructType(
LLVMMetadataRef ElementTypes) {
DIBuilder *D = unwrap(Dref);
DICompositeType CT = D->createStructType(
- DIDescriptor(unwrap<MDScope>(Scope)), Name, unwrap<MDFile>(File), Line,
- SizeInBits, AlignInBits, Flags, unwrap<MDType>(DerivedFrom),
- DIArray(unwrap<MDTuple>(ElementTypes)));
+ DIDescriptor(unwrap<MDScope>(Scope)), Name,
+ File ? unwrap<MDFile>(File) : nullptr, Line, SizeInBits, AlignInBits,
+ Flags, DerivedFrom ? unwrap<MDType>(DerivedFrom) : nullptr,
+ ElementTypes ? DIArray(unwrap<MDTuple>(ElementTypes)) : nullptr);
return wrap(CT);
}
@@ -150,8 +152,9 @@ LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType(
unsigned Flags) {
DIBuilder *D = unwrap(Dref);
DICompositeType CT = D->createReplaceableCompositeType(
- Tag, Name, DIDescriptor(unwrap<MDScope>(Scope)), unwrap<MDFile>(File),
- Line, RuntimeLang, SizeInBits, AlignInBits, Flags);
+ Tag, Name, DIDescriptor(unwrap<MDScope>(Scope)),
+ File ? unwrap<MDFile>(File) : nullptr, Line, RuntimeLang, SizeInBits,
+ AlignInBits, Flags);
return wrap(CT);
}
@@ -163,8 +166,9 @@ LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef Dref, LLVMMetadataRef Scope,
unsigned Flags, LLVMMetadataRef Ty) {
DIBuilder *D = unwrap(Dref);
DIDerivedType DT = D->createMemberType(
- DIDescriptor(unwrap<MDScope>(Scope)), Name, unwrap<MDFile>(File), Line,
- SizeInBits, AlignInBits, OffsetInBits, Flags, unwrap<MDType>(Ty));
+ DIDescriptor(unwrap<MDScope>(Scope)), Name,
+ File ? unwrap<MDFile>(File) : nullptr, Line, SizeInBits, AlignInBits,
+ OffsetInBits, Flags, unwrap<MDType>(Ty));
return wrap(DT);
}
@@ -185,9 +189,9 @@ LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Dref,
LLVMMetadataRef File, unsigned Line,
LLVMMetadataRef Context) {
DIBuilder *D = unwrap(Dref);
- DIDerivedType DT =
- D->createTypedef(unwrap<MDType>(Ty), Name, unwrap<MDFile>(File), Line,
- DIDescriptor(unwrap<MDScope>(Context)));
+ DIDerivedType DT = D->createTypedef(
+ unwrap<MDType>(Ty), Name, File ? unwrap<MDFile>(File) : nullptr, Line,
+ Context ? DIDescriptor(unwrap<MDScope>(Context)) : DIDescriptor());
return wrap(DT);
}
OpenPOWER on IntegriCloud