diff --git a/include/llvm/IR/DIBuilder.h b/include/llvm/IR/DIBuilder.h index 411aac96904..3a50609d685 100644 --- a/include/llvm/IR/DIBuilder.h +++ b/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/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index 1df54e55098..227de0a04c3 100644 --- a/lib/IR/DIBuilder.cpp +++ b/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)> 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)> 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 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 Elts) {