<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 Jan 9, 2015, at 1:22 PM, 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=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Jan 9, 2015 at 1:04 PM, Adrian Prantl <span dir="ltr" class=""><<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@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"><div style="word-wrap:break-word" class=""><br class=""><div class=""><div class=""><div class="h5"><blockquote type="cite" class=""><div class="">On Jan 9, 2015, at 12:20 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Jan 9, 2015 at 11:52 AM, Adrian Prantl <span dir="ltr" class=""><<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@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"><div style="word-wrap:break-word" class="">FYI: I’m hitting this assertion on today’s ToT with the following program:<div class=""><br class=""></div><div class=""><div class="">@protocol NSObject</div><div class="">@end</div><div class="">@interface NSObject <NSObject></div><div class="">@end</div><div class="">int  printf(const char * __restrict, ...);</div><div class="">struct Foo</div><div class="">{</div><div class="">        int     mId;</div><div class=""><span style="white-space:pre-wrap" class="">       </span>~Foo(){ </div><div class="">          printf("~Foo(%d)\n", mId);</div><div class="">        };</div><div class="">};</div><div class="">@interface TNSObject : NSObject</div><div class="">{</div><div class=""><span style="white-space:pre-wrap" class="">     </span>Foo _cppObjectNonAtomic;</div><div class="">}</div><div class="">@property (assign, readwrite, nonatomic) const Foo& cppObjectNonAtomic;</div><div class="">@end</div><div class="">@implementation TNSObject</div><div class="">- (id)init</div><div class="">{</div><div class=""><span style="white-space:pre-wrap" class="">           </span>Foo cppObject;</div><div class="">                self.cppObjectNonAtomic = cppObject;</div><div class="">}</div><div class="">@end</div><div class=""><br class=""></div><div class="">$ clang "-cc1" "-triple" "x86_64-apple-macosx10.10.0" "-emit-obj"  "-gdwarf-2" "-stdlib=libc++" "-Os"  "-fexceptions" "-x" "objective-c++" <a href="http://test1.mm/" target="_blank" class="">test1.mm</a></div><div class=""><br class=""></div><div class="">Looks like ~Foo() is getting inlined into [TNSObject init] without the scope being updated with an InlinedAt location. I’ll keep digging.</div></div></div></blockquote></div></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">I'll be reverting this shortly - there's a bunch of regressions of a similar flavor recorded on the relevant bug, but any reduced test cases will be handy when trying to ensure everything's covered before I recommit.<br class=""><br class="">The 'root cause' in (almost?) all of these should be something like this:<br class=""><br class="">1) a function with debug info (a function appearing in the CU's subprogram list) calls<br class="">2) another function with debug info through<br class="">3) a call instruction with no debugloc<br class=""></div></div></div></div></div></blockquote><div class=""><br class=""></div></div></div>In the particular case I posted above, the problem appears to be with the call to ~Foo from within the landingpad:</div><div class=""><br class=""></div><div class=""><div class="">lpad:                                             ; preds = %entry</div><div class="">  %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)</div><div class="">          cleanup</div><div class="">  %5 = extractvalue { i8*, i32 } %4, 0</div><div class="">  store i8* %5, i8** %exn.slot</div><div class="">  %6 = extractvalue { i8*, i32 } %4, 1</div><div class="">  store i32 %6, i32* %ehselector.slot</div><div class="">  invoke void @_ZN3FooD1Ev(%struct.Foo* %cppObject)</div><div class="">          to label %invoke.cont1 unwind label %terminate.lpad ; Note that none of the insns in the landingpad have a DebugLoc</div><div class=""><br class=""></div><div class="">which after inlining turns into </div><div class=""><br class=""></div><div class=""><div class="">lpad:                                             ; preds = %entry</div><div class="">  %3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)</div><div class="">          cleanup</div><div class="">  call void @llvm.dbg.value(metadata %struct.Foo* %cppObject, i64 0, metadata !64, metadata !76), !dbg !93</div><div class="">  call void @llvm.dbg.value(metadata %struct.Foo* %cppObject, i64 0, metadata !94, metadata !76), !dbg !96</div><div class="">  %mId.i.i3 = getelementptr inbounds %struct.Foo* %cppObject, i64 0, i32 0, !dbg !97</div><div class="">  %4 = load i32* %mId.i.i3, align 4, !dbg !97, !tbaa !88</div><div class="">  %call.i.i45 = invoke i32 (i8*, ...)* @_Z6printfPKcz(i8* getelementptr inbounds ([10 x i8]* @.str, i64 0, i64 0), i32 %4) #6</div><div class="">          to label %eh.resume unwind label %terminate.lpad, !dbg !97</div><div class=""><br class=""></div><div class="">!97 = !{i32 10, i32 0, !87, !95}</div><div class="">!95 = !{i32 9, i32 0, !62, null} <-- wrong. Should be _ZN3FooD2Ev inlined into _ZN3FooD1Ev</div><div class=""><br class=""></div><div class="">One one hand this is a bug in InlineFunction.cpp:fixupLineNumbers(), </div></div></div></div></blockquote><div class=""><br class="">What should fixupLineNumbers do instead? (but yes, we could put an assert in there to fail sooner rather than creating weird debug info like this & asserting on it later)<br class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class="">but we could also attach DebugLocs to those instructions in CFE in the first place.</div></div></div></div></blockquote><div class=""><br class="">My preference is to keep these assertions in as long as possible, because they find good bugs - the patch that added them took me months to commit due to all the bugs I found each time I tried to commit it, so it seems to have high value.<br class=""></div></div></div></div></div></blockquote><div><br class=""></div><div>Keeping the assertion is fine.</div><div><br class=""></div><div>It turns out that constructing a new scope for that call is not so great, because we’d have to search through the CU to find the right DISubprogram and even that may fail. I think we really should:</div><div><div>  - update CFE to attach DebugLocs to this cleanup code, so fixupLineNumbers works correctly here</div><div>  - make fixupLineNumbers delete all DebugLocs from code inlined into a call that has no DebugLoc.</div></div><div><br class=""></div><div>-- adrian</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class="">- David<br class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">-- adrian</div></font></span></div><div class=""><br class=""></div><div class=""></div></div></div><br class=""><div style="word-wrap:break-word" class=""><div class=""><div class=""></div></div></div><br class=""><div style="word-wrap:break-word" class=""><div class=""><div class=""></div></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class="">When that situation is created and inlining can occur through that call, the debug info doesn't get updated with inlinedAt info and everything else is bad from there on.<br class=""><br class="">If you can produce any short test cases that demonstrate this commit causing such a call (3) to go from having a debugloc to not having a debugloc, that would be great to have.<br class=""><br class="">- David</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">-- adrian</div></font></span><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 7, 2015, at 10:30 AM, Nico Weber <<a href="mailto:thakis@chromium.org" target="_blank" class="">thakis@chromium.org</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 5, 2015 at 9:57 PM, Nico Weber <span dir="ltr" class=""><<a href="mailto:thakis@chromium.org" target="_blank" class="">thakis@chromium.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><span class="">On Mon, Jan 5, 2015 at 9:07 PM, Jiangning Liu <span dir="ltr" class=""><<a href="mailto:liujiangning1@gmail.com" target="_blank" class="">liujiangning1@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr" class="">Hi David,<div class=""><br class=""></div><div class="">This commit introduced a regression for one of my benchmarks, and the failure is an assertion failure.</div><div class=""><br class=""></div><div class="">The failure point is at </div><div class=""><br class=""></div><div class=""><div class="">LexicalScope *LexicalScopes::getOrCreateRegularScope(MDNode *Scope) {</div><div class=""> ...... </div><div class=""> if (!Parent) {</div><div class="">    assert(DIDescriptor(Scope).isSubprogram());</div><div class="">    assert(DISubprogram(Scope).describes(MF->getFunction()));   // Assertion failure here!</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">That looks like something I debugged earlier today. This is <a href="http://llvm.org/PR22096" target="_blank" class="">http://llvm.org/PR22096</a> , which already has a reduction.</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">For me, the problem went away when I reverted r225085 (I landed the revert in r225361), and they were unrelated to this change. Jinangning, does trunk work for you? Are you sure that your problem was caused by this change (r225000)?</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><div class=""><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr" class=""><div class=""><div class="">    assert(!CurrentFnLexicalScope);</div><div class="">    CurrentFnLexicalScope = &I->second;</div><div class="">  }</div><div class=""><br class=""></div><div class="">  return &I->second;</div><div class="">}</div></div><div class=""><br class=""></div><div class="">And the call stack is like,</div><div class=""><br class=""></div><div class=""><div class="">8  libLLVMCodeGen.so       0x00007fc17123eb31 llvm::LexicalScopes::getOrCreateRegularScope(llvm::MDNode*) + 305</div><div class="">9  libLLVMCodeGen.so       0x00007fc17123e986 llvm::LexicalScopes::getOrCreateInlinedScope(llvm::MDNode*, llvm::MDNode*) + 326</div><div class="">10 libLLVMCodeGen.so       0x00007fc17123e979 llvm::LexicalScopes::getOrCreateInlinedScope(llvm::MDNode*, llvm::MDNode*) + 313</div><div class="">11 libLLVMCodeGen.so       0x00007fc17123e95a llvm::LexicalScopes::getOrCreateInlinedScope(llvm::MDNode*, llvm::MDNode*) + 282</div><div class="">12 libLLVMCodeGen.so       0x00007fc17123e979 llvm::LexicalScopes::getOrCreateInlinedScope(llvm::MDNode*, llvm::MDNode*) + 313</div><div class="">13 libLLVMCodeGen.so       0x00007fc17123de78 llvm::LexicalScopes::extractLexicalScopes(llvm::SmallVectorImpl<std::pair<llvm::MachineInstr const*, llvm::MachineInstr const*> >&, llvm::DenseMap<llvm::MachineInstr const*, llvm::LexicalScope*, llvm::DenseMapInfo<llvm::MachineInstr const*>, llvm::detail::DenseMapPair<llvm::MachineInstr const*, llvm::LexicalScope*> >&) + 1064</div><div class="">14 libLLVMCodeGen.so       0x00007fc17123d9ee llvm::LexicalScopes::initialize(llvm::MachineFunction const&) + 78</div><div class="">15 libLLVMCodeGen.so       0x00007fc171240815 llvm::LiveDebugVariables::runOnMachineFunction(llvm::MachineFunction&) + 933</div><div class="">16 libLLVMCodeGen.so       0x00007fc1712a327c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 124</div><div class="">17 libLLVMCore.so          0x00007fc17105ac7a llvm::FPPassManager::runOnFunction(llvm::Function&) + 362</div><div class="">18 libLLVMCore.so          0x00007fc17105af0b llvm::FPPassManager::runOnModule(llvm::Module&) + 43</div><div class="">19 libLLVMCore.so          0x00007fc17105b4a7 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 999</div><div class="">20 libclangCodeGen.so      0x00007fc16fe12c4d clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 7741</div><div class="">21 libclangCodeGen.so      0x00007fc16ff60e85</div><div class="">22 libclangParse.so        0x00007fc16f847da3 clang::ParseAST(clang::Sema&, bool, bool) + 467</div><div class="">23 libclangCodeGen.so      0x00007fc16ff5fbbc clang::CodeGenAction::ExecuteAction() + 204</div><div class="">24 libclangFrontend.so     0x00007fc17047f21e clang::FrontendAction::Execute() + 62</div><div class="">25 libclangFrontend.so     0x00007fc17044e97c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 892</div><div class="">26 libclangFrontendTool.so 0x00007fc1703d603a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3050</div><div class="">27 clang-3.6               0x000000000040cb71 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 577</div><div class="">28 clang-3.6               0x000000000040ba64 main + 12276</div><div class="">29 libc.so.6               0x00007fc16cf91de5 __libc_start_main + 245</div><div class="">30 clang-3.6               0x0000000000408961</div><div class=""><br class=""></div><div class="">....</div><div class="">1.<span style="white-space:pre-wrap" class="">    </span><eof> parser at end of file<br class=""></div><div class="">2.<span style="white-space:pre-wrap" class="">   </span>Code generation</div><div class="">3.<span style="white-space:pre-wrap" class="">  </span>Running pass 'Function Pass Manager' on module '<a href="http://x.i.cc/" target="_blank" class="">x.i.cc</a>'.</div><div class="">4.<span style="white-space:pre-wrap" class=""> </span>Running pass 'Debug Variable Analysis' on function '@__cxx_global_var_init9'</div><div class="">clang-3.6: error: unable to execute command: Aborted (core dumped)</div><div class="">clang-3.6: error: clang frontend command failed due to signal (use -v to see invocation)</div></div><div class=""><br class=""></div><div class="">Since the test case is huge, I'm trying to narrow down to a small test case. But before I can work out that, I want to let you know first, in case you know something about that, and can get it fixed without a test case.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">-Jiangning</div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote"><div class=""><div class="">2015-01-03 3:55 GMT+08:00 Jeroen Ketema <span dir="ltr" class=""><<a href="mailto:j.ketema@imperial.ac.uk" target="_blank" class="">j.ketema@imperial.ac.uk</a>></span>:<br class=""></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class=""><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On 02 Jan 2015, at 20:08, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><br class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Wed, Dec 31, 2014 at 2:52 AM, Jeroen Ketema<span class=""> </span><span dir="ltr" class=""><<a href="mailto:j.ketema@imperial.ac.uk" target="_blank" class="">j.ketema@imperial.ac.uk</a>></span><span class=""> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi David ,<br class=""><br class="">This commit is giving me some problems with the code below when compiled with<br class=""><br class=""> clang -Wall -g -gcolumn-info -emit-llvm -c foo.c<br class=""><br class="">For the first loop the debug information attached to the srem instruction generated for “j % 16” refers to line 10, which is correct. However, for the second loop the debug information refers to line 17 and not to the expected line 18; only the call to __f on line 18 has line 18 attached to it, while the call to __i, the srem instruction, etc. have line 17 attached to it.<br class=""><br class="">void __i(int);<br class="">void __f(void);<br class=""><br class="">#define __fi(X) __f(),__i(X)<br class=""><br class="">void foo()<br class="">{<br class=""> <span class=""> </span>for(int j = 0;<br class="">     <span class=""> </span>__f(), __i(0 <= j),<br class="">     <span class=""> </span>__f(), __i((j % 16) == 0), // line 10<br class="">     <span class=""> </span>j < 1600;<br class="">     <span class=""> </span>j += 16)<br class=""> <span class=""> </span>{<br class=""> <span class=""> </span>}<br class=""><br class=""> <span class=""> </span>for(int j = 0;<br class="">     <span class=""> </span>__fi(0 <= j), // line 17<br class="">     <span class=""> </span>__fi((j % 16) == 0), // line 18<br class="">     <span class=""> </span>j < 1600;<br class="">     <span class=""> </span>j += 16)<br class=""> <span class=""> </span>{<br class=""> <span class=""> </span>}<br class="">}<br class=""><br class=""></blockquote><div class=""><br class="">Thanks for the report/example/etc. This should be fixed in r225083. Let me know if it isn't or you see any other line info quality issues going forward.<br class=""></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Thanks. This indeed fixes things for me.</div><div class=""><br class=""></div><div class="">---</div><div class="">Jeroen</div><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class=""><br class="">- David<br class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">---<br class="">Regards,<br class=""><br class=""> <span class=""> </span>Jeroen<br class=""><div class=""><div class=""><br class="">> On 30 Dec 2014, at 20:39, David Blaikie <dblaikie at<span class=""> </span><a href="http://gmail.com/" target="_blank" class="">gmail.com</a>> wrote:<br class="">><br class="">> Author: dblaikie<br class="">> Date: Tue Dec 30 13:39:33 2014<br class="">> New Revision: 225000<br class="">><br class="">> URL:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project?rev=225000&view=rev" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=225000&view=rev</a><br class="">> Log:<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.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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Tue Dec 30 13:39:33 2014<br class="">> @@ -874,7 +874,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="">> @@ -1175,7 +1175,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="">> @@ -1326,9 +1326,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="">> @@ -1497,9 +1497,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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGClass.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGClass.cpp Tue Dec 30 13:39:33 2014<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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Tue Dec 30 13:39:33 2014<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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Dec 30 13:39:33 2014<br class="">> @@ -52,54 +52,38 @@ 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="">> -  }<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="">> -}<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="">> +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="">> -    Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(0, 0, Scope));<br class="">> +    CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(0, 0, Scope));<br class="">> +  }<br class="">> +}<br class="">> +<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="">> -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="">><br class="">> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h<br class="">> URL:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Tue Dec 30 13:39:33 2014<br class="">> @@ -448,27 +448,16 @@ 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();<br class="">> };<br class="">><br class="">> /// ArtificialLocation - An RAII object that temporarily switches to<br class="">> @@ -482,16 +471,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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Dec 30 13:39:33 2014<br class="">> @@ -597,14 +597,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="">> @@ -1088,6 +1087,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="">> @@ -1126,7 +1126,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="">> @@ -1192,26 +1192,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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Tue Dec 30 13:39:33 2014<br class="">> @@ -474,11 +474,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="">> @@ -525,11 +525,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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGException.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGException.cpp Tue Dec 30 13:39:33 2014<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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Dec 30 13:39:33 2014<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="">> @@ -2408,9 +2404,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="">> @@ -2456,9 +2449,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="">> @@ -2466,8 +2456,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="">> @@ -3024,18 +3012,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="">> @@ -3151,8 +3136,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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Tue Dec 30 13:39:33 2014<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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Tue Dec 30 13:39:33 2014<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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Tue Dec 30 13:39:33 2014<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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Dec 30 13:39:33 2014<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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Tue Dec 30 13:39:33 2014<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.h<br class="">> URL:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)<br class="">> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Tue Dec 30 13:39:33 2014<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="">> @@ -1300,8 +1287,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="">> @@ -1546,7 +1532,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="">> @@ -1833,8 +1819,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="">> @@ -2164,8 +2149,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="">> @@ -2537,12 +2521,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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/PR20038.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/PR20038.cpp?rev=225000&r1=224999&r2=225000&view=diff</a><br class="">> ==============================================================================<br class="">> --- cfe/trunk/test/CodeGenCXX/PR20038.cpp (original)<br class="">> +++ cfe/trunk/test/CodeGenCXX/PR20038.cpp Tue Dec 30 13:39:33 2014<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:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=225000&r1=224999&r2=225000&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 Tue Dec 30 13:39:33 2014<br class="">> @@ -1,4 +1,5 @@<br class="">> // RUN: %clang_cc1 -g -std=c++11 -S -emit-llvm %s -o - | FileCheck %s<br class="">> +// RUN: %clang_cc1 -triple i686-linux-gnu -g -std=c++11 -S -emit-llvm %s -o - | FileCheck %s<br class="">><br class="">> int &src();<br class="">> int *sink();<br class="">> @@ -110,6 +111,23 @@ void f10() {<br class="">>       new (void_src()) int(src()));<br class="">> }<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 i32 {{.*}} !dbg [[DBG_F12:!.*]]<br class="">> +#line 1300<br class="">> +  f12_2();<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="">> @@ -124,3 +142,5 @@ void f10() {<br class="">> // CHECK: [[DBG_F9]] = !{i32 1000,<br class="">> // CHECK: [[DBG_F10_ICMP]] = !{i32 1100,<br class="">> // CHECK: [[DBG_F10_STORE]] = !{i32 1100,<br class="">> +// CHECK: [[DBG_F11]] = !{i32 1200,<br class="">> +// CHECK: [[DBG_F12]] = !{i32 1300,<br class="">><br class="">> Modified: cfe/trunk/test/CodeGenCXX/debug-info-scope.cpp<br class="">> URL:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-scope.cpp?rev=225000&r1=224999&r2=225000&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-scope.cpp?rev=225000&r1=224999&r2=225000&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 Tue Dec 30 13:39:33 2014<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="">></div></div></blockquote></div></div></blockquote></div></div></div><br class=""></div><br class=""></div></div><span 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" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br class="">
<br class=""></span></blockquote></div><br class=""></div>
<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" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br class="">
<br class=""></blockquote></div></div></div><br class=""></div></div>
</blockquote></div><br class=""></div></div>
_______________________________________________<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" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br class=""></div></blockquote></div><br class=""></div></div></div></div></div><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" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br class="">
<br class=""></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></div><br class=""></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>