<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 25, 2015, at 10:19 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Oops, replied intsead of reply-all'd.<br class=""><div class="gmail_quote">---------- Forwarded message ----------<br class="">From: <b class="gmail_sendername">David Blaikie</b> <span dir="ltr" class=""><<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>></span><br class="">Date: Thu, Jun 25, 2015 at 10:18 AM<br class="">Subject: Re: r225956 - Reapply r225000 (reverted in r225555): DebugInfo: Generalize debug info location handling (and follow-up commits).<br class="">To: Frédéric Riss <<a href="mailto:friss@apple.com" class="">friss@apple.com</a>><br class=""><br class=""><br class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote"><span class="">On Wed, Jun 17, 2015 at 5:03 PM, Frédéric Riss <span dir="ltr" class=""><<a href="mailto:friss@apple.com" target="_blank" class="">friss@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sorry for the thread necrology. I was investigating compile time regressions, and I noticed that this commit alone would cause a 25% slowdown on the “-O0 -g” irgen phase. </blockquote></span><div class=""><br class="">Hmm, curious. Good to know, though.<br class=""></div></div></div></div></div></div></div></blockquote><div><br class=""></div><div>Take it with a grain of salt. The slowdown I measured is definitely real and reproducible, but it’s on one test case. I haven’t had time to characterize it more thoroughly, it might be kind of a worst case scenario for the patch (like a macro heavy file). We definitely have other tests that show slowdown, but not of the same magnitude.</div><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_quote"><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Any idea on how to improve on that? </blockquote></span><div class=""><br class="">Nothing that springs immediately to mind (though equally I'm not immediately sure why it should create /that/ much slowdown)<br class=""></div></div></div></div></div></div></blockquote><div><br class=""></div><div>From the initial profiling I did, there isn’t one spot that jumps out. But the ApplyDebugLocation devices are all over the place and called very frequently during irgen.</div><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_quote"><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I’ll profile a bit to see if I can pinpoint how particular path, but I thought I’d reach out early in case you have ideas.<br class=""></blockquote></span><div class=""><br class="">Yeah, sorry - but I'll be curious to see any profiles/data & throw around some ideas.<br class=""><br class="">Thanks for noticing/looking into it. (not sure why this wouldn't've shown up for our own performance measurements - perhaps the irgen portion is dwarfed by other parts of compilation (parsing, LLVM opt/codegen/etc))<span class="HOEnZb"><font color="#888888" class=""><br class=""></font></span></div></div></div></div></div></div></blockquote><div><br class=""></div><div>I’ll try to get more data today if other things don’t get in the way.</div><div><br class=""></div><div>Fred</div><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_quote"><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><span class="HOEnZb"><font color="#888888" class="">- David<br class=""> </font></span></div><div class=""><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="">
Fred<br class="">
<span class=""><br class="">
> On Jan 13, 2015, at 11:38 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:<br class="">
><br class="">
</span><div class=""><div class="">> Author: dblaikie<br class="">
> Date: Wed Jan 14 01:38:27 2015<br class="">
> New Revision: 225956<br class="">
><br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D225956-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=5dC0zt1--QFsVxiEhcyDiSWrB-iTiDDnEY-ZaEI58DU&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=225956&view=rev</a><br class="">
> Log:<br class="">
> Reapply r225000 (reverted in r225555): DebugInfo: Generalize debug info location handling (and follow-up commits).<br class="">
><br class="">
> Several pieces of code were relying on implicit debug location setting<br class="">
> which usually lead to incorrect line information anyway. So I've fixed<br class="">
> those (in r225955 and r225845) separately which should pave the way for<br class="">
> this commit to be cleanly reapplied.<br class="">
><br class="">
> The reason these implicit dependencies resulted in crashes with this<br class="">
> patch is that the debug location would no longer implicitly leak from<br class="">
> one place to another, but be set back to invalid. Once a call with<br class="">
> no/invalid location was emitted, if that call was ever inlined it could<br class="">
> produce invalid debugloc chains and assert during LLVM's codegen.<br class="">
><br class="">
> There may be further cases of such bugs in this patch - they're hard to<br class="">
> flush out with regression testing, so I'll keep an eye out for reports<br class="">
> and investigate/fix them ASAP if they come up.<br class="">
><br class="">
> Original commit message:<br class="">
><br class="">
> Reapply "DebugInfo: Generalize debug info location handling"<br class="">
><br class="">
> Originally committed in r224385 and reverted in r224441 due to concerns<br class="">
> this change might've introduced a crash. Turns out this change fixes the<br class="">
> crash introduced by one of my earlier more specific location handling<br class="">
> changes (those specific fixes are reverted by this patch, in favor of<br class="">
> the more general solution).<br class="">
><br class="">
> Recommitted in r224941 and reverted in r224970 after it caused a crash<br class="">
> when building compiler-rt. Looks to be due to this change zeroing out<br class="">
> the debug location when emitting default arguments (which were meant to<br class="">
> inherit their outer expression's location) thus creating call<br class="">
> instructions without locations - these create problems for inlining and<br class="">
> must not be created. That is fixed and tested in this version of the<br class="">
> change.<br class="">
><br class="">
> Original commit message:<br class="">
><br class="">
> This is a more scalable (fixed in mostly one place, rather than many<br class="">
> places that will need constant improvement/maintenance) solution to<br class="">
> several commits I've made recently to increase source fidelity for<br class="">
> subexpressions.<br class="">
><br class="">
> This resetting had to be done at the DebugLoc level (not the<br class="">
> SourceLocation level) to preserve scoping information (if the resetting<br class="">
> was done with CGDebugInfo::EmitLocation, it would've caused the tail end<br class="">
> of an expression's codegen to end up in a potentially different scope<br class="">
> than the start, even though it was at the same source location). The<br class="">
> drawback to this is that it might leave CGDebugInfo out of sync. Ideally<br class="">
> CGDebugInfo shouldn't have a duplicate sense of the current<br class="">
> SourceLocation, but for now it seems it does... - I don't think I'm<br class="">
> going to tackle removing that just now.<br class="">
><br class="">
> I expect this'll probably cause some more buildbot fallout & I'll<br class="">
> investigate that as it comes up.<br class="">
><br class="">
> Also these sort of improvements might be starting to show a weakness/bug<br class="">
> in LLVM's line table handling: we don't correctly emit is_stmt for<br class="">
> statements, we just put it on every line table entry. This means one<br class="">
> statement split over multiple lines appears as multiple 'statements' and<br class="">
> two statements on one line (without column info) are treated as one<br class="">
> statement.<br class="">
><br class="">
> I don't think we have any IR representation of statements that would<br class="">
> help us distinguish these cases and identify the beginning of each<br class="">
> statement - so that might be something we need to add (possibly to the<br class="">
> lexical scope chain - a scope for each statement). This does cause some<br class="">
> problems for GDB and possibly other DWARF consumers.<br class="">
><br class="">
> Modified:<br class="">
> cfe/trunk/lib/CodeGen/CGBlocks.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGClass.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGCleanup.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGDebugInfo.h<br class="">
> cfe/trunk/lib/CodeGen/CGDecl.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGDeclCXX.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGException.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGExpr.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGExprCXX.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGExprComplex.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGExprScalar.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGStmt.cpp<br class="">
> cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp<br class="">
> cfe/trunk/lib/CodeGen/CodeGenFunction.cpp<br class="">
> cfe/trunk/lib/CodeGen/CodeGenFunction.h<br class="">
> cfe/trunk/test/CodeGenCXX/PR20038.cpp<br class="">
> cfe/trunk/test/CodeGenCXX/debug-info-line.cpp<br class="">
> cfe/trunk/test/CodeGenCXX/debug-info-scope.cpp<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGBlocks.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=8injuSMpiu3Nfyi14DSBCVeYCTlBBXv5GRffuIY7WtU&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -875,7 +875,7 @@ llvm::Value *CodeGenFunction::EmitBlockL<br class="">
> // locations of subexpressions in the initialization.<br class="">
> EmitExprAsInit(&l2r, &blockFieldPseudoVar,<br class="">
> MakeAddrLValue(blockField, type, align),<br class="">
> - /*captured by init*/ false, SourceLocation());<br class="">
> + /*captured by init*/ false);<br class="">
> }<br class="">
><br class="">
> // Activate the cleanup if layout pushed one.<br class="">
> @@ -1178,7 +1178,7 @@ CodeGenFunction::GenerateBlockFunction(G<br class="">
> Alloca->setAlignment(Align);<br class="">
> // Set the DebugLocation to empty, so the store is recognized as a<br class="">
> // frame setup instruction by llvm::DwarfDebug::beginFunction().<br class="">
> - NoLocation NL(*this, Builder);<br class="">
> + ApplyDebugLocation NL(*this);<br class="">
> Builder.CreateAlignedStore(BlockPointer, Alloca, Align);<br class="">
> BlockPointerDbgLoc = Alloca;<br class="">
> }<br class="">
> @@ -1329,9 +1329,9 @@ CodeGenFunction::GenerateCopyHelperFunct<br class="">
> false,<br class="">
> false);<br class="">
> // Create a scope with an artificial location for the body of this function.<br class="">
> - ArtificialLocation AL(*this, Builder);<br class="">
> + ApplyDebugLocation NL(*this);<br class="">
> StartFunction(FD, C.VoidTy, Fn, FI, args);<br class="">
> - AL.Emit();<br class="">
> + ArtificialLocation AL(*this);<br class="">
><br class="">
> llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();<br class="">
><br class="">
> @@ -1500,9 +1500,9 @@ CodeGenFunction::GenerateDestroyHelperFu<br class="">
> nullptr, SC_Static,<br class="">
> false, false);<br class="">
> // Create a scope with an artificial location for the body of this function.<br class="">
> - ArtificialLocation AL(*this, Builder);<br class="">
> + ApplyDebugLocation NL(*this);<br class="">
> StartFunction(FD, C.VoidTy, Fn, FI, args);<br class="">
> - AL.Emit();<br class="">
> + ArtificialLocation AL(*this);<br class="">
><br class="">
> llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();<br class="">
><br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGClass.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGClass.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=QjZYNlEGMGNY6o0RZDVG_wGTQ7QzVCJQldkN-NK88ao&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGClass.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGClass.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -544,6 +544,7 @@ static void EmitMemberInitializer(CodeGe<br class="">
> CXXCtorInitializer *MemberInit,<br class="">
> const CXXConstructorDecl *Constructor,<br class="">
> FunctionArgList &Args) {<br class="">
> + ApplyDebugLocation Loc(CGF, MemberInit->getMemberLocation());<br class="">
> assert(MemberInit->isAnyMemberInitializer() &&<br class="">
> "Must have member initializer!");<br class="">
> assert(MemberInit->getInit() && "Must have initializer!");<br class="">
> @@ -597,26 +598,25 @@ static void EmitMemberInitializer(CodeGe<br class="">
> ArrayRef<VarDecl *> ArrayIndexes;<br class="">
> if (MemberInit->getNumArrayIndices())<br class="">
> ArrayIndexes = MemberInit->getArrayIndexes();<br class="">
> - CGF.EmitInitializerForField(Field, LHS, MemberInit->getInit(), ArrayIndexes,<br class="">
> - MemberInit->getMemberLocation());<br class="">
> + ApplyDebugLocation DL(CGF, MemberInit->getMemberLocation());<br class="">
> + CGF.EmitInitializerForField(Field, LHS, MemberInit->getInit(), ArrayIndexes);<br class="">
> }<br class="">
><br class="">
> -void CodeGenFunction::EmitInitializerForField(FieldDecl *Field, LValue LHS,<br class="">
> - Expr *Init,<br class="">
> - ArrayRef<VarDecl *> ArrayIndexes,<br class="">
> - SourceLocation DbgLoc) {<br class="">
> +void CodeGenFunction::EmitInitializerForField(<br class="">
> + FieldDecl *Field, LValue LHS, Expr *Init,<br class="">
> + ArrayRef<VarDecl *> ArrayIndexes) {<br class="">
> QualType FieldType = Field->getType();<br class="">
> switch (getEvaluationKind(FieldType)) {<br class="">
> case TEK_Scalar:<br class="">
> if (LHS.isSimple()) {<br class="">
> - EmitExprAsInit(Init, Field, LHS, false, DbgLoc);<br class="">
> + EmitExprAsInit(Init, Field, LHS, false);<br class="">
> } else {<br class="">
> RValue RHS = RValue::get(EmitScalarExpr(Init));<br class="">
> EmitStoreThroughLValue(RHS, LHS);<br class="">
> }<br class="">
> break;<br class="">
> case TEK_Complex:<br class="">
> - EmitComplexExprIntoLValue(Init, LHS, /*isInit*/ true, DbgLoc);<br class="">
> + EmitComplexExprIntoLValue(Init, LHS, /*isInit*/ true);<br class="">
> break;<br class="">
> case TEK_Aggregate: {<br class="">
> llvm::Value *ArrayIndexVar = nullptr;<br class="">
> @@ -783,8 +783,6 @@ void CodeGenFunction::EmitConstructorBod<br class="">
> // delegation optimization.<br class="">
> if (CtorType == Ctor_Complete && IsConstructorDelegationValid(Ctor) &&<br class="">
> CGM.getTarget().getCXXABI().hasConstructorVariants()) {<br class="">
> - if (CGDebugInfo *DI = getDebugInfo())<br class="">
> - DI->EmitLocation(Builder, Ctor->getLocEnd());<br class="">
> EmitDelegateCXXConstructorCall(Ctor, Ctor_Base, Args, Ctor->getLocEnd());<br class="">
> return;<br class="">
> }<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGCleanup.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=UrvGyJ9UMN8jC5GXCKtTJwlJ4_778oIsRRbZ9SuFVJY&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -861,10 +861,7 @@ void CodeGenFunction::PopCleanupBlock(bo<br class="">
><br class="">
> // Emit the EH cleanup if required.<br class="">
> if (RequiresEHCleanup) {<br class="">
> - CGDebugInfo *DI = getDebugInfo();<br class="">
> - SaveAndRestoreLocation AutoRestoreLocation(*this, Builder);<br class="">
> - if (DI)<br class="">
> - DI->EmitLocation(Builder, CurEHLocation);<br class="">
> + ApplyDebugLocation AutoRestoreLocation(*this, CurEHLocation);<br class="">
><br class="">
> CGBuilderTy::InsertPoint SavedIP = Builder.saveAndClearIP();<br class="">
><br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGDebugInfo.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=nNOGIAmjlwra69kkleEgrqPHytM6y57LJOa26TbFX-w&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -52,54 +52,47 @@ CGDebugInfo::~CGDebugInfo() {<br class="">
> "Region stack mismatch, stack not empty!");<br class="">
> }<br class="">
><br class="">
> -SaveAndRestoreLocation::SaveAndRestoreLocation(CodeGenFunction &CGF,<br class="">
> - CGBuilderTy &B)<br class="">
> - : DI(CGF.getDebugInfo()), Builder(B) {<br class="">
> - if (DI) {<br class="">
> - SavedLoc = DI->getLocation();<br class="">
> - DI->CurLoc = SourceLocation();<br class="">
> +ArtificialLocation::ArtificialLocation(CodeGenFunction &CGF)<br class="">
> + : ApplyDebugLocation(CGF) {<br class="">
> + if (auto *DI = CGF.getDebugInfo()) {<br class="">
> + // Construct a location that has a valid scope, but no line info.<br class="">
> + assert(!DI->LexicalBlockStack.empty());<br class="">
> + llvm::DIDescriptor Scope(DI->LexicalBlockStack.back());<br class="">
> + CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(0, 0, Scope));<br class="">
> }<br class="">
> }<br class="">
><br class="">
> -SaveAndRestoreLocation::~SaveAndRestoreLocation() {<br class="">
> - if (DI)<br class="">
> - DI->EmitLocation(Builder, SavedLoc);<br class="">
> -}<br class="">
> -<br class="">
> -NoLocation::NoLocation(CodeGenFunction &CGF, CGBuilderTy &B)<br class="">
> - : SaveAndRestoreLocation(CGF, B) {<br class="">
> - if (DI)<br class="">
> - Builder.SetCurrentDebugLocation(llvm::DebugLoc());<br class="">
> -}<br class="">
> -<br class="">
> -NoLocation::~NoLocation() {<br class="">
> - if (DI)<br class="">
> - assert(Builder.getCurrentDebugLocation().isUnknown());<br class="">
> -}<br class="">
> -<br class="">
> -ArtificialLocation::ArtificialLocation(CodeGenFunction &CGF, CGBuilderTy &B)<br class="">
> - : SaveAndRestoreLocation(CGF, B) {<br class="">
> - if (DI)<br class="">
> - Builder.SetCurrentDebugLocation(llvm::DebugLoc());<br class="">
> +ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF,<br class="">
> + SourceLocation TemporaryLocation,<br class="">
> + bool ForceColumnInfo)<br class="">
> + : CGF(CGF) {<br class="">
> + if (auto *DI = CGF.getDebugInfo()) {<br class="">
> + OriginalLocation = CGF.Builder.getCurrentDebugLocation();<br class="">
> + if (TemporaryLocation.isInvalid())<br class="">
> + CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc());<br class="">
> + else<br class="">
> + DI->EmitLocation(CGF.Builder, TemporaryLocation, ForceColumnInfo);<br class="">
> + }<br class="">
> }<br class="">
><br class="">
> -void ArtificialLocation::Emit() {<br class="">
> - if (DI) {<br class="">
> - // Sync the Builder.<br class="">
> - DI->EmitLocation(Builder, SavedLoc);<br class="">
> - DI->CurLoc = SourceLocation();<br class="">
> - // Construct a location that has a valid scope, but no line info.<br class="">
> - assert(!DI->LexicalBlockStack.empty());<br class="">
> - llvm::DIDescriptor Scope(DI->LexicalBlockStack.back());<br class="">
> - Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(0, 0, Scope));<br class="">
> +ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc)<br class="">
> + : CGF(CGF) {<br class="">
> + if (CGF.getDebugInfo()) {<br class="">
> + OriginalLocation = CGF.Builder.getCurrentDebugLocation();<br class="">
> + if (!Loc.isUnknown())<br class="">
> + CGF.Builder.SetCurrentDebugLocation(Loc);<br class="">
> }<br class="">
> }<br class="">
><br class="">
> -ArtificialLocation::~ArtificialLocation() {<br class="">
> - if (DI)<br class="">
> - assert(Builder.getCurrentDebugLocation().getLine() == 0);<br class="">
> +ApplyDebugLocation::~ApplyDebugLocation() {<br class="">
> + // Query CGF so the location isn't overwritten when location updates are<br class="">
> + // temporarily disabled (for C++ default function arguments)<br class="">
> + if (CGF.getDebugInfo())<br class="">
> + CGF.Builder.SetCurrentDebugLocation(OriginalLocation);<br class="">
> }<br class="">
><br class="">
> +/// ArtificialLocation - An RAII object that temporarily switches to<br class="">
> +/// an artificial debug location that has a valid scope, but no line<br class="">
> void CGDebugInfo::setLocation(SourceLocation Loc) {<br class="">
> // If the new location isn't valid return.<br class="">
> if (Loc.isInvalid())<br class="">
> @@ -2644,20 +2637,6 @@ void CGDebugInfo::EmitLocation(CGBuilder<br class="">
> if (CurLoc.isInvalid() || CurLoc.isMacroID())<br class="">
> return;<br class="">
><br class="">
> - // Don't bother if things are the same as last time.<br class="">
> - SourceManager &SM = CGM.getContext().getSourceManager();<br class="">
> - assert(!LexicalBlockStack.empty());<br class="">
> - if (CurLoc == PrevLoc ||<br class="">
> - SM.getExpansionLoc(CurLoc) == SM.getExpansionLoc(PrevLoc))<br class="">
> - // New Builder may not be in sync with CGDebugInfo.<br class="">
> - if (!Builder.getCurrentDebugLocation().isUnknown() &&<br class="">
> - Builder.getCurrentDebugLocation().getScope(CGM.getLLVMContext()) ==<br class="">
> - LexicalBlockStack.back())<br class="">
> - return;<br class="">
> -<br class="">
> - // Update last state.<br class="">
> - PrevLoc = CurLoc;<br class="">
> -<br class="">
> llvm::MDNode *Scope = LexicalBlockStack.back();<br class="">
> Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(<br class="">
> getLineNumber(CurLoc), getColumnNumber(CurLoc, ForceColumnInfo), Scope));<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGDebugInfo.h-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=S4NSRBjnX7VHgVnxIQDoDweofgIBLMSWRuoOMesaKIU&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Jan 14 01:38:27 2015<br class="">
> @@ -53,7 +53,7 @@ class CGDebugInfo {<br class="">
> const CodeGenOptions::DebugInfoKind DebugKind;<br class="">
> llvm::DIBuilder DBuilder;<br class="">
> llvm::DICompileUnit TheCU;<br class="">
> - SourceLocation CurLoc, PrevLoc;<br class="">
> + SourceLocation CurLoc;<br class="">
> llvm::DIType VTablePtrType;<br class="">
> llvm::DIType ClassTy;<br class="">
> llvm::DICompositeType ObjTy;<br class="">
> @@ -448,27 +448,17 @@ private:<br class="">
> }<br class="">
> };<br class="">
><br class="">
> -/// SaveAndRestoreLocation - An RAII object saves the current location<br class="">
> -/// and automatically restores it to the original value.<br class="">
> -class SaveAndRestoreLocation {<br class="">
> +class ApplyDebugLocation {<br class="">
> protected:<br class="">
> - SourceLocation SavedLoc;<br class="">
> - CGDebugInfo *DI;<br class="">
> - CGBuilderTy &Builder;<br class="">
> -public:<br class="">
> - SaveAndRestoreLocation(CodeGenFunction &CGF, CGBuilderTy &B);<br class="">
> - /// Autorestore everything back to normal.<br class="">
> - ~SaveAndRestoreLocation();<br class="">
> -};<br class="">
> + llvm::DebugLoc OriginalLocation;<br class="">
> + CodeGenFunction &CGF;<br class="">
><br class="">
> -/// NoLocation - An RAII object that temporarily disables debug<br class="">
> -/// locations. This is useful for emitting instructions that should be<br class="">
> -/// counted towards the function prologue.<br class="">
> -class NoLocation : public SaveAndRestoreLocation {<br class="">
> public:<br class="">
> - NoLocation(CodeGenFunction &CGF, CGBuilderTy &B);<br class="">
> - /// Autorestore everything back to normal.<br class="">
> - ~NoLocation();<br class="">
> + ApplyDebugLocation(CodeGenFunction &CGF,<br class="">
> + SourceLocation TemporaryLocation = SourceLocation(),<br class="">
> + bool ForceColumnInfo = false);<br class="">
> + ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc);<br class="">
> + ~ApplyDebugLocation();<br class="">
> };<br class="">
><br class="">
> /// ArtificialLocation - An RAII object that temporarily switches to<br class="">
> @@ -482,16 +472,9 @@ public:<br class="">
> /// This is necessary because passing an empty SourceLocation to<br class="">
> /// CGDebugInfo::setLocation() will result in the last valid location<br class="">
> /// being reused.<br class="">
> -class ArtificialLocation : public SaveAndRestoreLocation {<br class="">
> +class ArtificialLocation : public ApplyDebugLocation {<br class="">
> public:<br class="">
> - ArtificialLocation(CodeGenFunction &CGF, CGBuilderTy &B);<br class="">
> -<br class="">
> - /// Set the current location to line 0, but within the current scope<br class="">
> - /// (= the top of the LexicalBlockStack).<br class="">
> - void Emit();<br class="">
> -<br class="">
> - /// Autorestore everything back to normal.<br class="">
> - ~ArtificialLocation();<br class="">
> + ArtificialLocation(CodeGenFunction &CGF);<br class="">
> };<br class="">
><br class="">
><br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGDecl.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=L-yzGl4a_aFXpYCgjIoxMMkHEmORLuiXOaenToWI1AU&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGDecl.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -600,14 +600,13 @@ static void drillIntoBlockVariable(CodeG<br class="">
> }<br class="">
><br class="">
> void CodeGenFunction::EmitScalarInit(const Expr *init, const ValueDecl *D,<br class="">
> - LValue lvalue, bool capturedByInit,<br class="">
> - SourceLocation DbgLoc) {<br class="">
> + LValue lvalue, bool capturedByInit) {<br class="">
> Qualifiers::ObjCLifetime lifetime = lvalue.getObjCLifetime();<br class="">
> if (!lifetime) {<br class="">
> llvm::Value *value = EmitScalarExpr(init);<br class="">
> if (capturedByInit)<br class="">
> drillIntoBlockVariable(*this, lvalue, cast<VarDecl>(D));<br class="">
> - EmitStoreThroughLValue(RValue::get(value), lvalue, true, DbgLoc);<br class="">
> + EmitStoreThroughLValue(RValue::get(value), lvalue, true);<br class="">
> return;<br class="">
> }<br class="">
><br class="">
> @@ -1091,6 +1090,7 @@ void CodeGenFunction::EmitAutoVarInit(co<br class="">
> if (emission.wasEmittedAsGlobal()) return;<br class="">
><br class="">
> const VarDecl &D = *emission.Variable;<br class="">
> + ApplyDebugLocation DL(*this, D.getLocation());<br class="">
> QualType type = D.getType();<br class="">
><br class="">
> // If this local has an initializer, emit it now.<br class="">
> @@ -1129,7 +1129,7 @@ void CodeGenFunction::EmitAutoVarInit(co<br class="">
> if (!constant) {<br class="">
> LValue lv = MakeAddrLValue(Loc, type, alignment);<br class="">
> lv.setNonGC(true);<br class="">
> - return EmitExprAsInit(Init, &D, lv, capturedByInit, D.getLocation());<br class="">
> + return EmitExprAsInit(Init, &D, lv, capturedByInit);<br class="">
> }<br class="">
><br class="">
> if (!emission.IsConstantAggregate) {<br class="">
> @@ -1195,26 +1195,25 @@ void CodeGenFunction::EmitAutoVarInit(co<br class="">
> /// \param capturedByInit true if the variable is a __block variable<br class="">
> /// whose address is potentially changed by the initializer<br class="">
> void CodeGenFunction::EmitExprAsInit(const Expr *init, const ValueDecl *D,<br class="">
> - LValue lvalue, bool capturedByInit,<br class="">
> - SourceLocation DbgLoc) {<br class="">
> + LValue lvalue, bool capturedByInit) {<br class="">
> QualType type = D->getType();<br class="">
><br class="">
> if (type->isReferenceType()) {<br class="">
> RValue rvalue = EmitReferenceBindingToExpr(init);<br class="">
> if (capturedByInit)<br class="">
> drillIntoBlockVariable(*this, lvalue, cast<VarDecl>(D));<br class="">
> - EmitStoreThroughLValue(rvalue, lvalue, true, DbgLoc);<br class="">
> + EmitStoreThroughLValue(rvalue, lvalue, true);<br class="">
> return;<br class="">
> }<br class="">
> switch (getEvaluationKind(type)) {<br class="">
> case TEK_Scalar:<br class="">
> - EmitScalarInit(init, D, lvalue, capturedByInit, DbgLoc);<br class="">
> + EmitScalarInit(init, D, lvalue, capturedByInit);<br class="">
> return;<br class="">
> case TEK_Complex: {<br class="">
> ComplexPairTy complex = EmitComplexExpr(init);<br class="">
> if (capturedByInit)<br class="">
> drillIntoBlockVariable(*this, lvalue, cast<VarDecl>(D));<br class="">
> - EmitStoreOfComplex(complex, lvalue, /*init*/ true, DbgLoc);<br class="">
> + EmitStoreOfComplex(complex, lvalue, /*init*/ true);<br class="">
> return;<br class="">
> }<br class="">
> case TEK_Aggregate:<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGDeclCXX.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=zHmfs-mgGYGGw4IzRcpWqu67nSkTqpkM4FxLz265tEU&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -469,11 +469,11 @@ CodeGenFunction::GenerateCXXGlobalInitFu<br class="">
> ArrayRef<llvm::Function *> Decls,<br class="">
> llvm::GlobalVariable *Guard) {<br class="">
> {<br class="">
> - ArtificialLocation AL(*this, Builder);<br class="">
> + ApplyDebugLocation NL(*this);<br class="">
> StartFunction(GlobalDecl(), getContext().VoidTy, Fn,<br class="">
> getTypes().arrangeNullaryFunction(), FunctionArgList());<br class="">
> // Emit an artificial location for this function.<br class="">
> - AL.Emit();<br class="">
> + ArtificialLocation AL(*this);<br class="">
><br class="">
> llvm::BasicBlock *ExitBlock = nullptr;<br class="">
> if (Guard) {<br class="">
> @@ -520,11 +520,11 @@ void CodeGenFunction::GenerateCXXGlobalD<br class="">
> const std::vector<std::pair<llvm::WeakVH, llvm::Constant*> ><br class="">
> &DtorsAndObjects) {<br class="">
> {<br class="">
> - ArtificialLocation AL(*this, Builder);<br class="">
> + ApplyDebugLocation NL(*this);<br class="">
> StartFunction(GlobalDecl(), getContext().VoidTy, Fn,<br class="">
> getTypes().arrangeNullaryFunction(), FunctionArgList());<br class="">
> // Emit an artificial location for this function.<br class="">
> - AL.Emit();<br class="">
> + ArtificialLocation AL(*this);<br class="">
><br class="">
> // Emit the dtors, in reverse order from construction.<br class="">
> for (unsigned i = 0, e = DtorsAndObjects.size(); i != e; ++i) {<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGException.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGException.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=T-QOWoIeidaw1hEpZfPt0vx-8Dlt9o4rCGbtk7D2_Pc&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGException.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGException.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -734,9 +734,7 @@ llvm::BasicBlock *CodeGenFunction::EmitL<br class="">
><br class="">
> // Save the current IR generation state.<br class="">
> CGBuilderTy::InsertPoint savedIP = Builder.saveAndClearIP();<br class="">
> - SaveAndRestoreLocation AutoRestoreLocation(*this, Builder);<br class="">
> - if (CGDebugInfo *DI = getDebugInfo())<br class="">
> - DI->EmitLocation(Builder, CurEHLocation);<br class="">
> + ApplyDebugLocation AutoRestoreLocation(*this, CurEHLocation);<br class="">
><br class="">
> const EHPersonality &personality = EHPersonality::get(CGM);<br class="">
><br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGExpr.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=x9_AXxVCv22DziStaNmHIK4g9NoczDaDKLZdwpL9tRA&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -1438,11 +1438,7 @@ RValue CodeGenFunction::EmitLoadOfGlobal<br class="">
> /// lvalue, where both are guaranteed to the have the same type, and that type<br class="">
> /// is 'Ty'.<br class="">
> void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,<br class="">
> - bool isInit,<br class="">
> - SourceLocation DbgLoc) {<br class="">
> - if (auto *DI = getDebugInfo())<br class="">
> - DI->EmitLocation(Builder, DbgLoc);<br class="">
> -<br class="">
> + bool isInit) {<br class="">
> if (!Dst.isSimple()) {<br class="">
> if (Dst.isVectorElt()) {<br class="">
> // Read/modify/write the vector, inserting the new element.<br class="">
> @@ -2455,9 +2451,6 @@ LValue CodeGenFunction::EmitArraySubscri<br class="">
> // The element count here is the total number of non-VLA elements.<br class="">
> llvm::Value *numElements = getVLASize(vla).first;<br class="">
><br class="">
> - if (auto *DI = getDebugInfo())<br class="">
> - DI->EmitLocation(Builder, E->getLocStart());<br class="">
> -<br class="">
> // Effectively, the multiply by the VLA size is part of the GEP.<br class="">
> // GEP indexes are signed, and scaling an index isn't permitted to<br class="">
> // signed-overflow, so we use the same semantics for our explicit<br class="">
> @@ -2503,9 +2496,6 @@ LValue CodeGenFunction::EmitArraySubscri<br class="">
> // Propagate the alignment from the array itself to the result.<br class="">
> ArrayAlignment = ArrayLV.getAlignment();<br class="">
><br class="">
> - if (auto *DI = getDebugInfo())<br class="">
> - DI->EmitLocation(Builder, E->getLocStart());<br class="">
> -<br class="">
> if (getLangOpts().isSignedOverflowDefined())<br class="">
> Address = Builder.CreateGEP(ArrayPtr, Args, "arrayidx");<br class="">
> else<br class="">
> @@ -2513,8 +2503,6 @@ LValue CodeGenFunction::EmitArraySubscri<br class="">
> } else {<br class="">
> // The base must be a pointer, which is not an aggregate. Emit it.<br class="">
> llvm::Value *Base = EmitScalarExpr(E->getBase());<br class="">
> - if (auto *DI = getDebugInfo())<br class="">
> - DI->EmitLocation(Builder, E->getLocStart());<br class="">
> if (getLangOpts().isSignedOverflowDefined())<br class="">
> Address = Builder.CreateGEP(Base, Idx, "arrayidx");<br class="">
> else<br class="">
> @@ -3071,18 +3059,15 @@ RValue CodeGenFunction::EmitRValueForFie<br class="">
><br class="">
> RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,<br class="">
> ReturnValueSlot ReturnValue) {<br class="">
> - if (CGDebugInfo *DI = getDebugInfo()) {<br class="">
> - SourceLocation Loc = E->getLocStart();<br class="">
> - // Force column info to be generated so we can differentiate<br class="">
> - // multiple call sites on the same line in the debug info.<br class="">
> - // FIXME: This is insufficient. Two calls coming from the same macro<br class="">
> - // expansion will still get the same line/column and break debug info. It's<br class="">
> - // possible that LLVM can be fixed to not rely on this uniqueness, at which<br class="">
> - // point this workaround can be removed.<br class="">
> - const FunctionDecl* Callee = E->getDirectCallee();<br class="">
> - bool ForceColumnInfo = Callee && Callee->isInlineSpecified();<br class="">
> - DI->EmitLocation(Builder, Loc, ForceColumnInfo);<br class="">
> - }<br class="">
> + // Force column info to be generated so we can differentiate<br class="">
> + // multiple call sites on the same line in the debug info.<br class="">
> + // FIXME: This is insufficient. Two calls coming from the same macro<br class="">
> + // expansion will still get the same line/column and break debug info. It's<br class="">
> + // possible that LLVM can be fixed to not rely on this uniqueness, at which<br class="">
> + // point this workaround can be removed.<br class="">
> + ApplyDebugLocation DL(*this, E->getLocStart(),<br class="">
> + E->getDirectCallee() &&<br class="">
> + E->getDirectCallee()->isInlineSpecified());<br class="">
><br class="">
> // Builtins never have block type.<br class="">
> if (E->getCallee()->getType()->isBlockPointerType())<br class="">
> @@ -3198,8 +3183,6 @@ LValue CodeGenFunction::EmitBinaryOperat<br class="">
><br class="">
> RValue RV = EmitAnyExpr(E->getRHS());<br class="">
> LValue LV = EmitCheckedLValue(E->getLHS(), TCK_Store);<br class="">
> - if (CGDebugInfo *DI = getDebugInfo())<br class="">
> - DI->EmitLocation(Builder, E->getLocStart());<br class="">
> EmitStoreThroughLValue(RV, LV);<br class="">
> return LV;<br class="">
> }<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGExprCXX.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=-DIMtDC-slX8gl-y2iSrmBtFhXmwiTSLVKmT9kFmX38&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -187,8 +187,6 @@ RValue CodeGenFunction::EmitCXXMemberOrO<br class="">
> unsigned ArgsToSkip = isa<CXXOperatorCallExpr>(CE) ? 1 : 0;<br class="">
> llvm::Value *RHS =<br class="">
> EmitLValue(*(CE->arg_begin() + ArgsToSkip)).getAddress();<br class="">
> - if (auto *DI = getDebugInfo())<br class="">
> - DI->EmitLocation(Builder, CE->getLocStart());<br class="">
> EmitAggregateAssign(This, RHS, CE->getType());<br class="">
> return RValue::get(This);<br class="">
> }<br class="">
> @@ -754,15 +752,13 @@ static llvm::Value *EmitCXXNewAllocSize(<br class="">
> }<br class="">
><br class="">
> static void StoreAnyExprIntoOneUnit(CodeGenFunction &CGF, const Expr *Init,<br class="">
> - QualType AllocType, llvm::Value *NewPtr,<br class="">
> - SourceLocation DbgLoc = SourceLocation()) {<br class="">
> + QualType AllocType, llvm::Value *NewPtr) {<br class="">
> // FIXME: Refactor with EmitExprAsInit.<br class="">
> CharUnits Alignment = CGF.getContext().getTypeAlignInChars(AllocType);<br class="">
> switch (CGF.getEvaluationKind(AllocType)) {<br class="">
> case TEK_Scalar:<br class="">
> CGF.EmitScalarInit(Init, nullptr,<br class="">
> - CGF.MakeAddrLValue(NewPtr, AllocType, Alignment), false,<br class="">
> - DbgLoc);<br class="">
> + CGF.MakeAddrLValue(NewPtr, AllocType, Alignment), false);<br class="">
> return;<br class="">
> case TEK_Complex:<br class="">
> CGF.EmitComplexExprIntoLValue(Init, CGF.MakeAddrLValue(NewPtr, AllocType,<br class="">
> @@ -1020,12 +1016,12 @@ static void EmitNewInitializer(CodeGenFu<br class="">
> llvm::Value *NewPtr,<br class="">
> llvm::Value *NumElements,<br class="">
> llvm::Value *AllocSizeWithoutCookie) {<br class="">
> + ApplyDebugLocation DL(CGF, E->getStartLoc());<br class="">
> if (E->isArray())<br class="">
> CGF.EmitNewArrayInitializer(E, ElementType, NewPtr, NumElements,<br class="">
> AllocSizeWithoutCookie);<br class="">
> else if (const Expr *Init = E->getInitializer())<br class="">
> - StoreAnyExprIntoOneUnit(CGF, Init, E->getAllocatedType(), NewPtr,<br class="">
> - E->getStartLoc());<br class="">
> + StoreAnyExprIntoOneUnit(CGF, Init, E->getAllocatedType(), NewPtr);<br class="">
> }<br class="">
><br class="">
> /// Emit a call to an operator new or operator delete function, as implicitly<br class="">
> @@ -1269,9 +1265,6 @@ llvm::Value *CodeGenFunction::EmitCXXNew<br class="">
> E->placement_arg_end(), /* CalleeDecl */ nullptr,<br class="">
> /*ParamsToSkip*/ 1);<br class="">
><br class="">
> - if (auto *DI = getDebugInfo())<br class="">
> - DI->EmitLocation(Builder, E->getLocStart());<br class="">
> -<br class="">
> // Emit the allocation call. If the allocator is a global placement<br class="">
> // operator, just "inline" it directly.<br class="">
> RValue RV;<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGExprComplex.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=cxcVoVoZluIu7_Ze13yq-o4_AeKCXS6sNDAiyD5xKbA&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -81,8 +81,7 @@ public:<br class="">
><br class="">
> /// EmitStoreOfComplex - Store the specified real/imag parts into the<br class="">
> /// specified value pointer.<br class="">
> - void EmitStoreOfComplex(ComplexPairTy Val, LValue LV, bool isInit,<br class="">
> - SourceLocation DbgLoc);<br class="">
> + void EmitStoreOfComplex(ComplexPairTy Val, LValue LV, bool isInit);<br class="">
><br class="">
> /// EmitComplexToComplexCast - Emit a cast from complex value Val to DestType.<br class="">
> ComplexPairTy EmitComplexToComplexCast(ComplexPairTy Val, QualType SrcType,<br class="">
> @@ -335,11 +334,7 @@ ComplexPairTy ComplexExprEmitter::EmitLo<br class="">
> /// EmitStoreOfComplex - Store the specified real/imag parts into the<br class="">
> /// specified value pointer.<br class="">
> void ComplexExprEmitter::EmitStoreOfComplex(ComplexPairTy Val, LValue lvalue,<br class="">
> - bool isInit,<br class="">
> - SourceLocation DbgLoc) {<br class="">
> - if (auto *DI = CGF.getDebugInfo())<br class="">
> - DI->EmitLocation(CGF.Builder, DbgLoc);<br class="">
> -<br class="">
> + bool isInit) {<br class="">
> if (lvalue.getType()->isAtomicType())<br class="">
> return CGF.EmitAtomicStore(RValue::getComplex(Val), lvalue, isInit);<br class="">
><br class="">
> @@ -869,7 +864,7 @@ EmitCompoundAssignLValue(const CompoundA<br class="">
> // Truncate the result and store it into the LHS lvalue.<br class="">
> if (LHSTy->isAnyComplexType()) {<br class="">
> ComplexPairTy ResVal = EmitComplexToComplexCast(Result, OpInfo.Ty, LHSTy);<br class="">
> - EmitStoreOfComplex(ResVal, LHS, /*isInit*/ false, E->getLocStart());<br class="">
> + EmitStoreOfComplex(ResVal, LHS, /*isInit*/ false);<br class="">
> Val = RValue::getComplex(ResVal);<br class="">
> } else {<br class="">
> llvm::Value *ResVal =<br class="">
> @@ -914,7 +909,7 @@ LValue ComplexExprEmitter::EmitBinAssign<br class="">
> LValue LHS = CGF.EmitLValue(E->getLHS());<br class="">
><br class="">
> // Store the result value into the LHS lvalue.<br class="">
> - EmitStoreOfComplex(Val, LHS, /*isInit*/ false, E->getLocStart());<br class="">
> + EmitStoreOfComplex(Val, LHS, /*isInit*/ false);<br class="">
><br class="">
> return LHS;<br class="">
> }<br class="">
> @@ -1042,19 +1037,18 @@ ComplexPairTy CodeGenFunction::EmitCompl<br class="">
> }<br class="">
><br class="">
> void CodeGenFunction::EmitComplexExprIntoLValue(const Expr *E, LValue dest,<br class="">
> - bool isInit,<br class="">
> - SourceLocation DbgLoc) {<br class="">
> + bool isInit) {<br class="">
> assert(E && getComplexType(E->getType()) &&<br class="">
> "Invalid complex expression to emit");<br class="">
> ComplexExprEmitter Emitter(*this);<br class="">
> ComplexPairTy Val = Emitter.Visit(const_cast<Expr*>(E));<br class="">
> - Emitter.EmitStoreOfComplex(Val, dest, isInit, DbgLoc);<br class="">
> + Emitter.EmitStoreOfComplex(Val, dest, isInit);<br class="">
> }<br class="">
><br class="">
> /// EmitStoreOfComplex - Store a complex number into the specified l-value.<br class="">
> void CodeGenFunction::EmitStoreOfComplex(ComplexPairTy V, LValue dest,<br class="">
> - bool isInit, SourceLocation DbgLoc) {<br class="">
> - ComplexExprEmitter(*this).EmitStoreOfComplex(V, dest, isInit, DbgLoc);<br class="">
> + bool isInit) {<br class="">
> + ComplexExprEmitter(*this).EmitStoreOfComplex(V, dest, isInit);<br class="">
> }<br class="">
><br class="">
> /// EmitLoadOfComplex - Load a complex number from the specified address.<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGExprScalar.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=vLiXX_q8lu-b_fd7yLfagy-D8ZkaNHJMMsreIDJyw8o&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -196,6 +196,7 @@ public:<br class="">
> //===--------------------------------------------------------------------===//<br class="">
><br class="">
> Value *Visit(Expr *E) {<br class="">
> + ApplyDebugLocation DL(CGF, E->getLocStart());<br class="">
> return StmtVisitor<ScalarExprEmitter, Value*>::Visit(E);<br class="">
> }<br class="">
><br class="">
> @@ -3042,7 +3043,7 @@ Value *ScalarExprEmitter::VisitBinLAnd(c<br class="">
> // Emit an unconditional branch from this block to ContBlock.<br class="">
> {<br class="">
> // There is no need to emit line number for unconditional branch.<br class="">
> - SuppressDebugLocation S(Builder);<br class="">
> + ApplyDebugLocation DL(CGF);<br class="">
> CGF.EmitBlock(ContBlock);<br class="">
> }<br class="">
> // Insert an entry into the phi node for the edge with the value of RHSCond.<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGStmt.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=7qLEOjlKlWmL8HhhgdagERJzgiRqnYrFeAXnWfHV1ns&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -565,7 +565,7 @@ void CodeGenFunction::EmitIfStmt(const I<br class="">
> if (const Stmt *Else = S.getElse()) {<br class="">
> {<br class="">
> // There is no need to emit line number for unconditional branch.<br class="">
> - SuppressDebugLocation S(Builder);<br class="">
> + ApplyDebugLocation DL(*this);<br class="">
> EmitBlock(ElseBlock);<br class="">
> }<br class="">
> {<br class="">
> @@ -574,7 +574,7 @@ void CodeGenFunction::EmitIfStmt(const I<br class="">
> }<br class="">
> {<br class="">
> // There is no need to emit line number for unconditional branch.<br class="">
> - SuppressDebugLocation S(Builder);<br class="">
> + ApplyDebugLocation DL(*this);<br class="">
> EmitBranch(ContBlock);<br class="">
> }<br class="">
> }<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CGStmtOpenMP.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=Lu8MELdyVFR9cE9XqEZg3LEap80jEz3FZev3qgYZ1cQ&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -86,13 +86,13 @@ static void EmitOMPIfClause(CodeGenFunct<br class="">
> // Emit the 'else' code if present.<br class="">
> {<br class="">
> // There is no need to emit line number for unconditional branch.<br class="">
> - SuppressDebugLocation SDL(CGF.Builder);<br class="">
> + ApplyDebugLocation DL(CGF);<br class="">
> CGF.EmitBlock(ElseBlock);<br class="">
> }<br class="">
> CodeGen(/*ThenBlock*/ false);<br class="">
> {<br class="">
> // There is no need to emit line number for unconditional branch.<br class="">
> - SuppressDebugLocation SDL(CGF.Builder);<br class="">
> + ApplyDebugLocation DL(CGF);<br class="">
> CGF.EmitBranch(ContBlock);<br class="">
> }<br class="">
> // Emit the continuation block for code after the if.<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CodeGenFunction.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=e3TeZL0nhW8MXUjnm4mJ6ViHZlOE5XIUehZIf0_INuE&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -158,7 +158,7 @@ TypeEvaluationKind CodeGenFunction::getE<br class="">
> }<br class="">
> }<br class="">
><br class="">
> -void CodeGenFunction::EmitReturnBlock() {<br class="">
> +llvm::DebugLoc CodeGenFunction::EmitReturnBlock() {<br class="">
> // For cleanliness, we try to avoid emitting the return block for<br class="">
> // simple cases.<br class="">
> llvm::BasicBlock *CurBB = Builder.GetInsertBlock();<br class="">
> @@ -173,7 +173,7 @@ void CodeGenFunction::EmitReturnBlock()<br class="">
> delete ReturnBlock.getBlock();<br class="">
> } else<br class="">
> EmitBlock(ReturnBlock.getBlock());<br class="">
> - return;<br class="">
> + return llvm::DebugLoc();<br class="">
> }<br class="">
><br class="">
> // Otherwise, if the return block is the target of a single direct<br class="">
> @@ -184,15 +184,13 @@ void CodeGenFunction::EmitReturnBlock()<br class="">
> dyn_cast<llvm::BranchInst>(*ReturnBlock.getBlock()->user_begin());<br class="">
> if (BI && BI->isUnconditional() &&<br class="">
> BI->getSuccessor(0) == ReturnBlock.getBlock()) {<br class="">
> - // Reset insertion point, including debug location, and delete the<br class="">
> - // branch. This is really subtle and only works because the next change<br class="">
> - // in location will hit the caching in CGDebugInfo::EmitLocation and not<br class="">
> - // override this.<br class="">
> - Builder.SetCurrentDebugLocation(BI->getDebugLoc());<br class="">
> + // Record/return the DebugLoc of the simple 'return' expression to be used<br class="">
> + // later by the actual 'ret' instruction.<br class="">
> + llvm::DebugLoc Loc = BI->getDebugLoc();<br class="">
> Builder.SetInsertPoint(BI->getParent());<br class="">
> BI->eraseFromParent();<br class="">
> delete ReturnBlock.getBlock();<br class="">
> - return;<br class="">
> + return Loc;<br class="">
> }<br class="">
> }<br class="">
><br class="">
> @@ -201,6 +199,7 @@ void CodeGenFunction::EmitReturnBlock()<br class="">
> // region.end for now.<br class="">
><br class="">
> EmitBlock(ReturnBlock.getBlock());<br class="">
> + return llvm::DebugLoc();<br class="">
> }<br class="">
><br class="">
> static void EmitIfUsed(CodeGenFunction &CGF, llvm::BasicBlock *BB) {<br class="">
> @@ -254,16 +253,18 @@ void CodeGenFunction::FinishFunction(Sou<br class="">
> }<br class="">
><br class="">
> // Emit function epilog (to return).<br class="">
> - EmitReturnBlock();<br class="">
> + llvm::DebugLoc Loc = EmitReturnBlock();<br class="">
><br class="">
> if (ShouldInstrumentFunction())<br class="">
> EmitFunctionInstrumentation("__cyg_profile_func_exit");<br class="">
><br class="">
> // Emit debug descriptor for function end.<br class="">
> - if (CGDebugInfo *DI = getDebugInfo()) {<br class="">
> + if (CGDebugInfo *DI = getDebugInfo())<br class="">
> DI->EmitFunctionEnd(Builder);<br class="">
> - }<br class="">
><br class="">
> + // Reset the debug location to that of the simple 'return' expression, if any<br class="">
> + // rather than that of the end of the function's scope '}'.<br class="">
> + ApplyDebugLocation AL(*this, Loc);<br class="">
> EmitFunctionEpilog(*CurFnInfo, EmitRetDbgLoc, EndLoc);<br class="">
> EmitEndEHSpec(CurCodeDecl);<br class="">
><br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_CodeGen_CodeGenFunction.h-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=RaGaRnqvBoycrGYAknd33kx8dkNN7hDC26RaXjDX5WU&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Jan 14 01:38:27 2015<br class="">
> @@ -93,19 +93,6 @@ enum TypeEvaluationKind {<br class="">
> TEK_Aggregate<br class="">
> };<br class="">
><br class="">
> -class SuppressDebugLocation {<br class="">
> - llvm::DebugLoc CurLoc;<br class="">
> - llvm::IRBuilderBase &Builder;<br class="">
> -public:<br class="">
> - SuppressDebugLocation(llvm::IRBuilderBase &Builder)<br class="">
> - : CurLoc(Builder.getCurrentDebugLocation()), Builder(Builder) {<br class="">
> - Builder.SetCurrentDebugLocation(llvm::DebugLoc());<br class="">
> - }<br class="">
> - ~SuppressDebugLocation() {<br class="">
> - Builder.SetCurrentDebugLocation(CurLoc);<br class="">
> - }<br class="">
> -};<br class="">
> -<br class="">
> /// CodeGenFunction - This class organizes the per-function state that is used<br class="">
> /// while generating LLVM code.<br class="">
> class CodeGenFunction : public CodeGenTypeCache {<br class="">
> @@ -1273,7 +1260,7 @@ public:<br class="">
><br class="">
> /// EmitReturnBlock - Emit the unified return block, trying to avoid its<br class="">
> /// emission when possible.<br class="">
> - void EmitReturnBlock();<br class="">
> + llvm::DebugLoc EmitReturnBlock();<br class="">
><br class="">
> /// FinishFunction - Complete IR generation of the current function. It is<br class="">
> /// legal to call this function even if there is no current insertion point.<br class="">
> @@ -1298,8 +1285,7 @@ public:<br class="">
> FunctionArgList &Args);<br class="">
><br class="">
> void EmitInitializerForField(FieldDecl *Field, LValue LHS, Expr *Init,<br class="">
> - ArrayRef<VarDecl *> ArrayIndexes,<br class="">
> - SourceLocation DbgLoc = SourceLocation());<br class="">
> + ArrayRef<VarDecl *> ArrayIndexes);<br class="">
><br class="">
> /// InitializeVTablePointer - Initialize the vtable pointer of the given<br class="">
> /// subobject.<br class="">
> @@ -1544,7 +1530,7 @@ public:<br class="">
> /// EmitExprAsInit - Emits the code necessary to initialize a<br class="">
> /// location in memory with the given initializer.<br class="">
> void EmitExprAsInit(const Expr *init, const ValueDecl *D, LValue lvalue,<br class="">
> - bool capturedByInit, SourceLocation DbgLoc);<br class="">
> + bool capturedByInit);<br class="">
><br class="">
> /// hasVolatileMember - returns true if aggregate type has a volatile<br class="">
> /// member.<br class="">
> @@ -1831,8 +1817,7 @@ public:<br class="">
> void EmitVarDecl(const VarDecl &D);<br class="">
><br class="">
> void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue,<br class="">
> - bool capturedByInit,<br class="">
> - SourceLocation DbgLoc = SourceLocation());<br class="">
> + bool capturedByInit);<br class="">
> void EmitScalarInit(llvm::Value *init, LValue lvalue);<br class="">
><br class="">
> typedef void SpecialInitFn(CodeGenFunction &Init, const VarDecl &D,<br class="">
> @@ -2162,8 +2147,7 @@ public:<br class="">
> /// EmitStoreThroughLValue - Store the specified rvalue into the specified<br class="">
> /// lvalue, where both are guaranteed to the have the same type, and that type<br class="">
> /// is 'Ty'.<br class="">
> - void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit = false,<br class="">
> - SourceLocation DbgLoc = SourceLocation());<br class="">
> + void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit = false);<br class="">
> void EmitStoreThroughExtVectorComponentLValue(RValue Src, LValue Dst);<br class="">
> void EmitStoreThroughGlobalRegLValue(RValue Src, LValue Dst);<br class="">
><br class="">
> @@ -2535,12 +2519,10 @@ public:<br class="">
><br class="">
> /// EmitComplexExprIntoLValue - Emit the given expression of complex<br class="">
> /// type and place its result into the specified l-value.<br class="">
> - void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit,<br class="">
> - SourceLocation DbgLoc = SourceLocation());<br class="">
> + void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit);<br class="">
><br class="">
> /// EmitStoreOfComplex - Store a complex number into the specified l-value.<br class="">
> - void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit,<br class="">
> - SourceLocation DbgLoc = SourceLocation());<br class="">
> + void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit);<br class="">
><br class="">
> /// EmitLoadOfComplex - Load a complex number from the specified l-value.<br class="">
> ComplexPairTy EmitLoadOfComplex(LValue src, SourceLocation loc);<br class="">
><br class="">
> Modified: cfe/trunk/test/CodeGenCXX/PR20038.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_CodeGenCXX_PR20038.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=Eka7cXR_H3bG5DUt05QitO01EbroJBpjPFKxkoTJWR8&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/PR20038.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/test/CodeGenCXX/PR20038.cpp (original)<br class="">
> +++ cfe/trunk/test/CodeGenCXX/PR20038.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -1,4 +1,4 @@<br class="">
> -// RUN: %clang_cc1 -triple %itanium_abi_triple -g -emit-llvm %s -o - | FileCheck %s<br class="">
> +// RUN: %clang_cc1 -triple %itanium_abi_triple -g -mllvm -no-discriminators -emit-llvm %s -o - | FileCheck %s<br class="">
><br class="">
> struct C {<br class="">
> ~C();<br class="">
> @@ -8,9 +8,7 @@ extern bool b;<br class="">
> // CHECK: call {{.*}}, !dbg [[DTOR_CALL2_LOC:![0-9]*]]<br class="">
> // CHECK: [[FUN1:.*]] = {{.*}}; [ DW_TAG_subprogram ] {{.*}} [def] [fun1]<br class="">
> // CHECK: [[FUN2:.*]] = {{.*}}; [ DW_TAG_subprogram ] {{.*}} [def] [fun2]<br class="">
> -// CHECK: [[DTOR_CALL1_LOC]] = !{i32 [[@LINE+2]], i32 0, [[FUN1_BLOCK:.*]], null}<br class="">
> -// CHECK: [[FUN1_BLOCK]] = !{!"0xb{{[^,]*}}", {{[^,]*}}, [[FUN1]]}<br class="">
> +// CHECK: [[DTOR_CALL1_LOC]] = !{i32 [[@LINE+1]], i32 0, [[FUN1]], null}<br class="">
> void fun1() { b && (C(), 1); }<br class="">
> -// CHECK: [[DTOR_CALL2_LOC]] = !{i32 [[@LINE+2]], i32 0, [[FUN2_BLOCK1:.*]], null}<br class="">
> -// CHECK: [[FUN2_BLOCK1]] = !{!"0xb{{[^,]*}}", {{[^,]*}}, [[FUN2]]}<br class="">
> +// CHECK: [[DTOR_CALL2_LOC]] = !{i32 [[@LINE+1]], i32 0, [[FUN2]], null}<br class="">
> bool fun2() { return (C(), b) && 0; }<br class="">
><br class="">
> Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_CodeGenCXX_debug-2Dinfo-2Dline.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=gZisGVUDZ2TpMsimSACP-t7NFc2y-fDoJs5_ZYV85l4&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)<br class="">
> +++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -1,4 +1,7 @@<br class="">
> -// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -g -std=c++11 -S -emit-llvm %s -o - | FileCheck %s<br class="">
> +// RUN: %clang_cc1 -gline-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s<br class="">
> +// RUN: %clang_cc1 -gline-tables-only -std=c++11 -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - -triple i686-linux-gnu | FileCheck %s<br class="">
> +<br class="">
> +// XFAIL: win32<br class="">
><br class="">
> int &src();<br class="">
> int *sink();<br class="">
> @@ -123,6 +126,10 @@ struct bar {<br class="">
> // CHECK: invoke{{ }}<br class="">
> // CHECK: invoke{{ }}<br class="">
> // CHECK: to label {{.*}}, !dbg [[DBG_GLBL_CTOR_B:!.*]]<br class="">
> +<br class="">
> +// terminate caller<br class="">
> +// CHECK-LABEL: define<br class="">
> +<br class="">
> // global dtor cleanup<br class="">
> // CHECK-LABEL: define<br class="">
> // CHECK: invoke{{ }}<br class="">
> @@ -133,6 +140,32 @@ bar b[1] = { //<br class="">
> (fn(), //<br class="">
> bar())};<br class="">
><br class="">
> +// CHECK-LABEL: define<br class="">
> +__complex double f11() {<br class="">
> + __complex double f;<br class="">
> +// CHECK: store {{.*}} !dbg [[DBG_F11:!.*]]<br class="">
> +#line 1200<br class="">
> + return f;<br class="">
> +}<br class="">
> +<br class="">
> +// CHECK-LABEL: define<br class="">
> +void f12() {<br class="">
> + int f12_1();<br class="">
> + void f12_2(int = f12_1());<br class="">
> +// CHECK: call {{(signext )?}}i32 {{.*}} !dbg [[DBG_F12:!.*]]<br class="">
> +#line 1300<br class="">
> + f12_2();<br class="">
> +}<br class="">
> +<br class="">
> +// CHECK-LABEL: define<br class="">
> +void f13() {<br class="">
> +// CHECK: call {{.*}} !dbg [[DBG_F13:!.*]]<br class="">
> +#define F13_IMPL 1, src()<br class="">
> + 1,<br class="">
> +#line 1400<br class="">
> + F13_IMPL;<br class="">
> +}<br class="">
> +<br class="">
> // CHECK: [[DBG_F1]] = !{i32 100,<br class="">
> // CHECK: [[DBG_FOO_VALUE]] = !{i32 200,<br class="">
> // CHECK: [[DBG_FOO_REF]] = !{i32 202,<br class="">
> @@ -149,3 +182,6 @@ bar b[1] = { //<br class="">
> // CHECK: [[DBG_F10_STORE]] = !{i32 1100,<br class="">
> // CHECK: [[DBG_GLBL_CTOR_B]] = !{i32 1500,<br class="">
> // CHECK: [[DBG_GLBL_DTOR_B]] = !{i32 1500,<br class="">
> +// CHECK: [[DBG_F11]] = !{i32 1200,<br class="">
> +// CHECK: [[DBG_F12]] = !{i32 1300,<br class="">
> +// CHECK: [[DBG_F13]] = !{i32 1400,<br class="">
><br class="">
> Modified: cfe/trunk/test/CodeGenCXX/debug-info-scope.cpp<br class="">
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_CodeGenCXX_debug-2Dinfo-2Dscope.cpp-3Frev-3D225956-26r1-3D225955-26r2-3D225956-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=d3wsGLSl2Rl571dCej-fy8ELAQo6RLcv3DWQ-kpWReo&s=eYHOyQJ0WkiElEf1edZH02bF_xMn8qbfxM_JD9lwGCI&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-scope.cpp?rev=225956&r1=225955&r2=225956&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/test/CodeGenCXX/debug-info-scope.cpp (original)<br class="">
> +++ cfe/trunk/test/CodeGenCXX/debug-info-scope.cpp Wed Jan 14 01:38:27 2015<br class="">
> @@ -36,12 +36,12 @@ void func() {<br class="">
> // CHECK: = !{!"0x100\00{{.*}}", [[FOR:![0-9]*]], {{.*}} ; [ DW_TAG_auto_variable ] [i] [line [[@LINE+2]]]<br class="">
> // CHECK: [[FOR]] = !{!"0xb\00[[@LINE+1]]\00{{.*}}", !{{.*}}} ; [ DW_TAG_lexical_block ]<br class="">
> for (int i = 0; i != 10; ++i) {<br class="">
> - // FIXME: Do not include scopes that have only other scopes (and no variables<br class="">
> - // or using declarations) as direct children, they just waste<br class="">
> - // space/relocations/etc.<br class="">
> - // CHECK: = !{!"0x100\00{{.*}}", [[FOR_COMPOUND:![0-9]*]], {{.*}} ; [ DW_TAG_auto_variable ] [b] [line [[@LINE+3]]]<br class="">
> - // CHECK: [[FOR_COMPOUND]] = !{!"0xb\00[[@LINE-5]]\00{{.*}}", !{{[0-9]+}}, [[FOR_BODY:![0-9]+]]} ; [ DW_TAG_lexical_block ]<br class="">
> - // CHECK: [[FOR_BODY]] = !{!"0xb\00[[@LINE-6]]\00{{.*}}", !{{[0-9]+}}, [[FOR]]} ; [ DW_TAG_lexical_block ]<br class="">
> + // FIXME: Do not include scopes that have only other scopes (and no variables<br class="">
> + // or using declarations) as direct children, they just waste<br class="">
> + // space/relocations/etc.<br class="">
> + // CHECK: [[FOR_LOOP_INCLUDING_COND:!.*]] = !{!"0xb\00[[@LINE-4]]\00{{.*}}", !{{[0-9]+}}, [[FOR]]} ; [ DW_TAG_lexical_block ]<br class="">
> + // CHECK: = !{!"0x100\00{{.*}}", [[FOR_COMPOUND:![0-9]*]], {{.*}} ; [ DW_TAG_auto_variable ] [b] [line [[@LINE+2]]]<br class="">
> + // CHECK: [[FOR_COMPOUND]] = !{!"0xb\00[[@LINE-6]]\00{{.*}}", !{{[0-9]+}}, [[FOR_LOOP_INCLUDING_COND]]} ; [ DW_TAG_lexical_block ]<br class="">
> bool b = i % 2;<br class="">
> }<br class="">
><br class="">
><br class="">
><br class="">
> _______________________________________________<br class="">
> cfe-commits mailing list<br class="">
> <a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank" class="">cfe-commits@cs.uiuc.edu</a><br class="">
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br class="">
<br class="">
</div></div></blockquote></div></div></div><br class=""></div></div>
</div><br class=""></div>
</blockquote></div><br class=""></body></html>