diff options
| author | David Blaikie <dblaikie@gmail.com> | 2014-12-09 00:32:22 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2014-12-09 00:32:22 +0000 |
| commit | 73ca56942dc55c29c4dfa4a7ce64e466fe43c891 (patch) | |
| tree | b4f5873b49923490ad235a0d42afd7a07097d9ef /clang/lib/CodeGen/CGDecl.cpp | |
| parent | 0dd4dd3adba6576ccf49839a840e6c9d115dd553 (diff) | |
| download | bcm5719-llvm-73ca56942dc55c29c4dfa4a7ce64e466fe43c891.tar.gz bcm5719-llvm-73ca56942dc55c29c4dfa4a7ce64e466fe43c891.zip | |
DebugInfo: Correctly identify the location of C++ member initializer list elements
This particularly helps the fidelity of ASan reports (which can occur
even in these examples - if, for example, one uses placement new over a
buffer of insufficient size - now ASan will correctly identify which
member's initialization went over the end of the buffer).
This doesn't cover all types of members - more coming.
llvm-svn: 223726
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 959ac9a8d7e..97da9ef307b 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -596,16 +596,15 @@ static void drillIntoBlockVariable(CodeGenFunction &CGF, lvalue.setAddress(CGF.BuildBlockByrefAddress(lvalue.getAddress(), var)); } -void CodeGenFunction::EmitScalarInit(const Expr *init, - const ValueDecl *D, - LValue lvalue, - bool capturedByInit) { +void CodeGenFunction::EmitScalarInit(const Expr *init, const ValueDecl *D, + LValue lvalue, bool capturedByInit, + SourceLocation DbgLoc) { Qualifiers::ObjCLifetime lifetime = lvalue.getObjCLifetime(); if (!lifetime) { llvm::Value *value = EmitScalarExpr(init); if (capturedByInit) drillIntoBlockVariable(*this, lvalue, cast<VarDecl>(D)); - EmitStoreThroughLValue(RValue::get(value), lvalue, true); + EmitStoreThroughLValue(RValue::get(value), lvalue, true, DbgLoc); return; } @@ -1192,22 +1191,21 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) { /// \param alignment the alignment of the address /// \param capturedByInit true if the variable is a __block variable /// whose address is potentially changed by the initializer -void CodeGenFunction::EmitExprAsInit(const Expr *init, - const ValueDecl *D, - LValue lvalue, - bool capturedByInit) { +void CodeGenFunction::EmitExprAsInit(const Expr *init, const ValueDecl *D, + LValue lvalue, bool capturedByInit, + SourceLocation DbgLoc) { QualType type = D->getType(); if (type->isReferenceType()) { RValue rvalue = EmitReferenceBindingToExpr(init); if (capturedByInit) drillIntoBlockVariable(*this, lvalue, cast<VarDecl>(D)); - EmitStoreThroughLValue(rvalue, lvalue, true); + EmitStoreThroughLValue(rvalue, lvalue, true, DbgLoc); return; } switch (getEvaluationKind(type)) { case TEK_Scalar: - EmitScalarInit(init, D, lvalue, capturedByInit); + EmitScalarInit(init, D, lvalue, capturedByInit, DbgLoc); return; case TEK_Complex: { ComplexPairTy complex = EmitComplexExpr(init); |

