summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-07-31 17:56:14 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-07-31 17:56:14 +0000
commite430654fd85a04f04c93eab40ba7fe87d8657130 (patch)
treea69b6d46a9715d6fd1bb1b2a60becd68e1cd6b86
parent1e40dc42cd1bff905323186bc0184f260902f6dd (diff)
downloadbcm5719-llvm-e430654fd85a04f04c93eab40ba7fe87d8657130.tar.gz
bcm5719-llvm-e430654fd85a04f04c93eab40ba7fe87d8657130.zip
DI: Update for LLVM API change for local variables
Adjust to LLVM DIBuilder API changes in r243764, using `createAutoVariable()` and `createParameterVariable()` in place of `createLocalVariable()`. No real functionality change here. llvm-svn: 243765
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp41
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.h7
2 files changed, 26 insertions, 22 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index d993b112f58..276b21a82d1 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2738,8 +2738,8 @@ llvm::DIType *CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
nullptr, Elements);
}
-void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::dwarf::Tag Tag,
- llvm::Value *Storage, unsigned ArgNo,
+void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::Value *Storage,
+ llvm::Optional<unsigned> ArgNo,
CGBuilderTy &Builder) {
assert(DebugKind >= CodeGenOptions::LimitedDebugInfo);
assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");
@@ -2778,7 +2778,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::dwarf::Tag Tag,
// FIXME: There has to be a better way to do this, but for static
// functions there won't be an implicit param at arg1 and
// otherwise it is 'self' or 'this'.
- if (isa<ImplicitParamDecl>(VD) && ArgNo == 1)
+ if (isa<ImplicitParamDecl>(VD) && ArgNo && *ArgNo == 1)
Flags |= llvm::DINode::FlagObjectPointer;
if (llvm::Argument *Arg = dyn_cast<llvm::Argument>(Storage))
if (Arg->getType()->isPointerTy() && !Arg->hasByValAttr() &&
@@ -2803,8 +2803,11 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::dwarf::Tag Tag,
Expr.push_back(offset.getQuantity());
// Create the descriptor for the variable.
- auto *D = DBuilder.createLocalVariable(Tag, Scope, VD->getName(), Unit,
- Line, Ty, ArgNo);
+ auto *D = ArgNo
+ ? DBuilder.createParameterVariable(Scope, VD->getName(),
+ *ArgNo, Unit, Line, Ty)
+ : DBuilder.createAutoVariable(Scope, VD->getName(), Unit,
+ Line, Ty);
// Insert an llvm.dbg.declare into the current block.
DBuilder.insertDeclare(Storage, D, DBuilder.createExpression(Expr),
@@ -2834,10 +2837,9 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::dwarf::Tag Tag,
continue;
// Use VarDecl's Tag, Scope and Line number.
- auto *D = DBuilder.createLocalVariable(
- Tag, Scope, FieldName, Unit, Line, FieldTy,
- CGM.getLangOpts().Optimize, Flags | llvm::DINode::FlagArtificial,
- ArgNo);
+ auto *D = DBuilder.createAutoVariable(
+ Scope, FieldName, Unit, Line, FieldTy, CGM.getLangOpts().Optimize,
+ Flags | llvm::DINode::FlagArtificial);
// Insert an llvm.dbg.declare into the current block.
DBuilder.insertDeclare(Storage, D, DBuilder.createExpression(Expr),
@@ -2849,8 +2851,12 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::dwarf::Tag Tag,
// Create the descriptor for the variable.
auto *D =
- DBuilder.createLocalVariable(Tag, Scope, Name, Unit, Line, Ty,
- CGM.getLangOpts().Optimize, Flags, ArgNo);
+ ArgNo
+ ? DBuilder.createParameterVariable(Scope, Name, *ArgNo, Unit, Line,
+ Ty, CGM.getLangOpts().Optimize,
+ Flags)
+ : DBuilder.createAutoVariable(Scope, Name, Unit, Line, Ty,
+ CGM.getLangOpts().Optimize, Flags);
// Insert an llvm.dbg.declare into the current block.
DBuilder.insertDeclare(Storage, D, DBuilder.createExpression(Expr),
@@ -2862,7 +2868,7 @@ void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *VD,
llvm::Value *Storage,
CGBuilderTy &Builder) {
assert(DebugKind >= CodeGenOptions::LimitedDebugInfo);
- EmitDeclare(VD, llvm::dwarf::DW_TAG_auto_variable, Storage, 0, Builder);
+ EmitDeclare(VD, Storage, llvm::None, Builder);
}
llvm::DIType *CGDebugInfo::CreateSelfType(const QualType &QualTy,
@@ -2927,8 +2933,7 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
}
// Create the descriptor for the variable.
- auto *D = DBuilder.createLocalVariable(
- llvm::dwarf::DW_TAG_auto_variable,
+ auto *D = DBuilder.createAutoVariable(
cast<llvm::DILocalScope>(LexicalBlockStack.back()), VD->getName(), Unit,
Line, Ty);
@@ -2946,7 +2951,7 @@ void CGDebugInfo::EmitDeclareOfArgVariable(const VarDecl *VD, llvm::Value *AI,
unsigned ArgNo,
CGBuilderTy &Builder) {
assert(DebugKind >= CodeGenOptions::LimitedDebugInfo);
- EmitDeclare(VD, llvm::dwarf::DW_TAG_arg_variable, AI, ArgNo, Builder);
+ EmitDeclare(VD, AI, ArgNo, Builder);
}
namespace {
@@ -3088,9 +3093,9 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block,
auto *scope = cast<llvm::DILocalScope>(LexicalBlockStack.back());
// Create the descriptor for the parameter.
- auto *debugVar = DBuilder.createLocalVariable(
- llvm::dwarf::DW_TAG_arg_variable, scope, Arg->getName(), tunit, line,
- type, CGM.getLangOpts().Optimize, flags, ArgNo);
+ auto *debugVar = DBuilder.createParameterVariable(
+ scope, Arg->getName(), ArgNo, tunit, line, type,
+ CGM.getLangOpts().Optimize, flags);
if (LocalAddr) {
// Insert an llvm.dbg.value into the current block.
diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index 29254835439..72cdac3e93b 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -20,6 +20,7 @@
#include "clang/Basic/SourceLocation.h"
#include "clang/Frontend/CodeGenOptions.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/ValueHandle.h"
@@ -351,10 +352,8 @@ public:
private:
/// Emit call to llvm.dbg.declare for a variable declaration.
- /// Tag accepts custom types DW_TAG_arg_variable and DW_TAG_auto_variable,
- /// otherwise would be of type llvm::dwarf::Tag.
- void EmitDeclare(const VarDecl *decl, llvm::dwarf::Tag Tag, llvm::Value *AI,
- unsigned ArgNo, CGBuilderTy &Builder);
+ void EmitDeclare(const VarDecl *decl, llvm::Value *AI,
+ llvm::Optional<unsigned> ArgNo, CGBuilderTy &Builder);
/// Build up structure info for the byref. See \a BuildByRefType.
llvm::DIType *EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
OpenPOWER on IntegriCloud