From f353d3ecd0329884110a8bd39f28b5cc111c9a69 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 9 Jan 2015 23:00:28 +0000 Subject: Revert "DebugInfo: Generalize debug info location handling" and related commits This reverts commit r225000, r225021, r225083, r225086, r225090. The root change (r225000) still has several issues where it's caused calls to be emitted without debug locations. This causes assertion failures if/when those calls are inlined. I'll work up some test cases and fixes before recommitting this. llvm-svn: 225555 --- clang/lib/CodeGen/CGClass.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'clang/lib/CodeGen/CGClass.cpp') diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 92c694a76de..5ffab603ac8 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -544,7 +544,6 @@ static void EmitMemberInitializer(CodeGenFunction &CGF, CXXCtorInitializer *MemberInit, const CXXConstructorDecl *Constructor, FunctionArgList &Args) { - ApplyDebugLocation Loc(CGF, MemberInit->getMemberLocation()); assert(MemberInit->isAnyMemberInitializer() && "Must have member initializer!"); assert(MemberInit->getInit() && "Must have initializer!"); @@ -598,25 +597,26 @@ static void EmitMemberInitializer(CodeGenFunction &CGF, ArrayRef ArrayIndexes; if (MemberInit->getNumArrayIndices()) ArrayIndexes = MemberInit->getArrayIndexes(); - ApplyDebugLocation DL(CGF, MemberInit->getMemberLocation()); - 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 ArrayIndexes) { +void CodeGenFunction::EmitInitializerForField(FieldDecl *Field, LValue LHS, + Expr *Init, + ArrayRef 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); } break; case TEK_Complex: - EmitComplexExprIntoLValue(Init, LHS, /*isInit*/ true); + EmitComplexExprIntoLValue(Init, LHS, /*isInit*/ true, DbgLoc); break; case TEK_Aggregate: { llvm::Value *ArrayIndexVar = nullptr; @@ -783,6 +783,8 @@ void CodeGenFunction::EmitConstructorBody(FunctionArgList &Args) { // delegation optimization. if (CtorType == Ctor_Complete && IsConstructorDelegationValid(Ctor) && CGM.getTarget().getCXXABI().hasConstructorVariants()) { + if (CGDebugInfo *DI = getDebugInfo()) + DI->EmitLocation(Builder, Ctor->getLocEnd()); EmitDelegateCXXConstructorCall(Ctor, Ctor_Base, Args, Ctor->getLocEnd()); return; } -- cgit v1.2.3