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/CGClass.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/CGClass.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index e2af17c2759..dfd980f6e86 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -597,17 +597,19 @@ static void EmitMemberInitializer(CodeGenFunction &CGF, ArrayRef<VarDecl *> ArrayIndexes; if (MemberInit->getNumArrayIndices()) ArrayIndexes = MemberInit->getArrayIndexes(); - CGF.EmitInitializerForField(Field, LHS, MemberInit->getInit(), ArrayIndexes); + CGF.EmitInitializerForField(Field, LHS, MemberInit->getInit(), ArrayIndexes, + MemberInit->getMemberLocation()); } -void CodeGenFunction::EmitInitializerForField(FieldDecl *Field, - LValue LHS, Expr *Init, - ArrayRef<VarDecl *> ArrayIndexes) { +void CodeGenFunction::EmitInitializerForField(FieldDecl *Field, LValue LHS, + Expr *Init, + ArrayRef<VarDecl *> ArrayIndexes, + SourceLocation DbgLoc) { QualType FieldType = Field->getType(); switch (getEvaluationKind(FieldType)) { case TEK_Scalar: if (LHS.isSimple()) { - EmitExprAsInit(Init, Field, LHS, false); + EmitExprAsInit(Init, Field, LHS, false, DbgLoc); } else { RValue RHS = RValue::get(EmitScalarExpr(Init)); EmitStoreThroughLValue(RHS, LHS); |