summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-11-15 00:23:49 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-11-15 00:23:49 +0000
commitdbf64acd29814f910338e814d68ff7d9531302c4 (patch)
tree8f796964d1f7d0b2bff2980f88a1c90be4e154c8
parent3196805321b0a6b99209317802df4fb0ccc8dcde (diff)
downloadbcm5719-llvm-dbf64acd29814f910338e814d68ff7d9531302c4.tar.gz
bcm5719-llvm-dbf64acd29814f910338e814d68ff7d9531302c4.zip
DIBuilder: Use Constant instead of Value
Make explicit the requirement that most IR values in `DIBuilder` are `Constant`. This requires a follow-up change in clang. Part of PR21532. llvm-svn: 222070
-rw-r--r--llvm/include/llvm/IR/DIBuilder.h35
-rw-r--r--llvm/lib/IR/DIBuilder.cpp49
2 files changed, 37 insertions, 47 deletions
diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
index 411aac96904..3a50609d685 100644
--- a/llvm/include/llvm/IR/DIBuilder.h
+++ b/llvm/include/llvm/IR/DIBuilder.h
@@ -27,6 +27,7 @@ namespace llvm {
class Function;
class Module;
class Value;
+ class Constant;
class LLVMContext;
class MDNode;
class StringRef;
@@ -211,10 +212,10 @@ 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.
- DIDerivedType
- createStaticMemberType(DIDescriptor Scope, StringRef Name,
- DIFile File, unsigned LineNo, DIType Ty,
- unsigned Flags, llvm::Value *Val);
+ DIDerivedType createStaticMemberType(DIDescriptor Scope, StringRef Name,
+ DIFile File, unsigned LineNo,
+ DIType Ty, unsigned Flags,
+ llvm::Constant *Val);
/// createObjCIVar - Create debugging information entry for Objective-C
/// instance variable.
@@ -333,8 +334,8 @@ namespace llvm {
/// @param LineNo Line number.
/// @param ColumnNo Column Number.
DITemplateValueParameter
- createTemplateValueParameter(DIDescriptor Scope, StringRef Name,
- DIType Ty, Value *Val, MDNode *File = nullptr,
+ createTemplateValueParameter(DIDescriptor Scope, StringRef Name, DIType Ty,
+ Constant *Val, MDNode *File = nullptr,
unsigned LineNo = 0, unsigned ColumnNo = 0);
/// \brief Create debugging information for a template template parameter.
@@ -458,21 +459,19 @@ namespace llvm {
/// externally visible or not.
/// @param Val llvm::Value of the variable.
/// @param Decl Reference to the corresponding declaration.
- DIGlobalVariable
- createGlobalVariable(DIDescriptor Context, StringRef Name,
- StringRef LinkageName, DIFile File, unsigned LineNo,
- DITypeRef Ty, bool isLocalToUnit, llvm::Value *Val,
- MDNode *Decl = nullptr);
+ DIGlobalVariable createGlobalVariable(DIDescriptor Context, StringRef Name,
+ StringRef LinkageName, DIFile File,
+ unsigned LineNo, DITypeRef 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.
- DIGlobalVariable
- createTempGlobalVariableFwdDecl(DIDescriptor Context, StringRef Name,
- StringRef LinkageName, DIFile File,
- unsigned LineNo, DITypeRef Ty,
- bool isLocalToUnit, llvm::Value *Val,
- MDNode *Decl = nullptr);
-
+ DIGlobalVariable createTempGlobalVariableFwdDecl(
+ DIDescriptor Context, StringRef Name, StringRef LinkageName,
+ DIFile File, unsigned LineNo, DITypeRef Ty, bool isLocalToUnit,
+ llvm::Constant *Val, MDNode *Decl = nullptr);
/// createLocalVariable - Create a new descriptor for the specified
/// local variable.
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 1df54e55098..227de0a04c3 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -406,11 +406,11 @@ DIDerivedType DIBuilder::createMemberType(DIDescriptor Scope, StringRef Name,
return DIDerivedType(MDNode::get(VMContext, Elts));
}
-DIDerivedType
-DIBuilder::createStaticMemberType(DIDescriptor Scope, StringRef Name,
- DIFile File, unsigned LineNumber,
- DIType Ty, unsigned Flags,
- llvm::Value *Val) {
+DIDerivedType DIBuilder::createStaticMemberType(DIDescriptor Scope,
+ StringRef Name, DIFile File,
+ unsigned LineNumber, DIType Ty,
+ unsigned Flags,
+ llvm::Constant *Val) {
// TAG_member is encoded in DIDerivedType format.
Flags |= DIDescriptor::FlagStaticMember;
Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_member)
@@ -489,9 +489,8 @@ static DITemplateValueParameter createTemplateValueParameterHelper(
DITemplateValueParameter
DIBuilder::createTemplateValueParameter(DIDescriptor Context, StringRef Name,
- DIType Ty, Value *Val,
- MDNode *File, unsigned LineNo,
- unsigned ColumnNo) {
+ DIType Ty, Constant *Val, MDNode *File,
+ unsigned LineNo, unsigned ColumnNo) {
return createTemplateValueParameterHelper(
VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty, Val,
File, LineNo, ColumnNo);
@@ -832,12 +831,11 @@ DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
return DISubrange(MDNode::get(VMContext, Elts));
}
-static DIGlobalVariable
-createGlobalVariableHelper(LLVMContext &VMContext, DIDescriptor Context,
- StringRef Name, StringRef LinkageName, DIFile F,
- unsigned LineNumber, DITypeRef Ty, bool isLocalToUnit,
- Value *Val, MDNode *Decl, bool isDefinition,
- std::function<MDNode *(ArrayRef<Value *>)> CreateFunc) {
+static DIGlobalVariable createGlobalVariableHelper(
+ LLVMContext &VMContext, DIDescriptor Context, StringRef Name,
+ StringRef LinkageName, DIFile F, unsigned LineNumber, DITypeRef Ty,
+ bool isLocalToUnit, Constant *Val, MDNode *Decl, bool isDefinition,
+ std::function<MDNode *(ArrayRef<Value *>)> CreateFunc) {
Value *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_variable)
.concat(Name)
.concat(Name)
@@ -852,13 +850,10 @@ createGlobalVariableHelper(LLVMContext &VMContext, DIDescriptor Context,
return DIGlobalVariable(CreateFunc(Elts));
}
-DIGlobalVariable DIBuilder::createGlobalVariable(DIDescriptor Context,
- StringRef Name,
- StringRef LinkageName,
- DIFile F, unsigned LineNumber,
- DITypeRef Ty,
- bool isLocalToUnit,
- Value *Val, MDNode *Decl) {
+DIGlobalVariable DIBuilder::createGlobalVariable(
+ DIDescriptor Context, StringRef Name, StringRef LinkageName, DIFile F,
+ unsigned LineNumber, DITypeRef Ty, bool isLocalToUnit, Constant *Val,
+ MDNode *Decl) {
return createGlobalVariableHelper(VMContext, Context, Name, LinkageName, F,
LineNumber, Ty, isLocalToUnit, Val, Decl, true,
[&] (ArrayRef<Value *> Elts) -> MDNode * {
@@ -868,14 +863,10 @@ DIGlobalVariable DIBuilder::createGlobalVariable(DIDescriptor Context,
});
}
-DIGlobalVariable
-DIBuilder::createTempGlobalVariableFwdDecl(DIDescriptor Context,
- StringRef Name,
- StringRef LinkageName,
- DIFile F, unsigned LineNumber,
- DITypeRef Ty,
- bool isLocalToUnit,
- Value *Val, MDNode *Decl) {
+DIGlobalVariable DIBuilder::createTempGlobalVariableFwdDecl(
+ DIDescriptor Context, StringRef Name, StringRef LinkageName, DIFile F,
+ unsigned LineNumber, DITypeRef Ty, bool isLocalToUnit, Constant *Val,
+ MDNode *Decl) {
return createGlobalVariableHelper(VMContext, Context, Name, LinkageName, F,
LineNumber, Ty, isLocalToUnit, Val, Decl, false,
[&] (ArrayRef<Value *> Elts) {
OpenPOWER on IntegriCloud