Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
DebugInfo: New metadata representation for global variables.
Browse files Browse the repository at this point in the history
This patch reverses the edge from DIGlobalVariable to GlobalVariable.
This will allow us to more easily preserve debug info metadata when
manipulating global variables.

Fixes PR30362. A program for upgrading test cases is attached to that
bug.

Differential Revision: http://reviews.llvm.org/D20147

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281284 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
pcc committed Sep 13, 2016
1 parent 8d684ca commit 5420de3
Show file tree
Hide file tree
Showing 159 changed files with 922 additions and 796 deletions.
14 changes: 11 additions & 3 deletions include/llvm/IR/DIBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,20 +454,21 @@ namespace llvm {
/// \param Ty Variable Type.
/// \param isLocalToUnit Boolean flag indicate whether this variable is
/// externally visible or not.
/// \param Val llvm::Value of the variable.
/// \param Expr The location of the global relative to the attached
/// GlobalVariable.
/// \param Decl Reference to the corresponding declaration.
DIGlobalVariable *createGlobalVariable(DIScope *Context, StringRef Name,
StringRef LinkageName, DIFile *File,
unsigned LineNo, DIType *Ty,
bool isLocalToUnit,
llvm::Constant *Val,
DIExpression *Expr = nullptr,
MDNode *Decl = nullptr);

/// Identical to createGlobalVariable
/// except that the resulting DbgNode is temporary and meant to be RAUWed.
DIGlobalVariable *createTempGlobalVariableFwdDecl(
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
unsigned LineNo, DIType *Ty, bool isLocalToUnit, llvm::Constant *Val,
unsigned LineNo, DIType *Ty, bool isLocalToUnit, DIExpression *Expr,
MDNode *Decl = nullptr);

/// Create a new descriptor for an auto variable. This is a local variable
Expand Down Expand Up @@ -514,6 +515,13 @@ namespace llvm {
DIExpression *createBitPieceExpression(unsigned OffsetInBits,
unsigned SizeInBits);

/// Create an expression for a variable that does not have an address, but
/// does have a constant value.
DIExpression *createConstantValueExpression(uint64_t Val) {
return DIExpression::get(
VMContext, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_stack_value});
}

/// Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram* for descriptions of these fields.
/// \param Scope Function scope.
Expand Down
Loading

0 comments on commit 5420de3

Please sign in to comment.