<br><br><div class="gmail_quote">On Thu Nov 06 2014 at 3:17:40 PM Frédéric Riss <<a href="mailto:friss@apple.com">friss@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div>On Nov 6, 2014, at 2:57 PM, Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>> wrote:</div><br><div>Hrm. Testcase? Where were you seeing it?<br></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>Unfortunately there is nothing here to test, because it actually worked. As you know, you can wrap any DIDescriptor into any other type of DIDescriptor as long as you don’t access the fields or .verify() the result. Here the resulting DIScope was just used to pass along the DbgNode (look at r221466 for a tiny bit more context).</div><div><br></div><div>I’ve noticed it while working on debug info generation for forward declarations (review to come soonish). getDeclarationOrDefinition takes the result of the DeclMap lookup and puts it into a DIScope, even if what was came out of the map wasn’t a DIScope (and it’s a sure thing that the DIGlobalVariable stored there aren’t DIScopes).</div><div><br></div></div></div></blockquote><div><br></div><div>Sounds good.</div><div><br></div><div>Thanks!</div><div><br></div><div>-eric</div><div> </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"><div><div></div><div>Fred</div></div></div><div style="word-wrap:break-word"><div><div><br></div><blockquote type="cite"><div>-eric<br><br><div class="gmail_quote">On Thu Nov 06 2014 at 1:30:34 PM Frederic Riss <<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: friss<br>
Date: Thu Nov  6 15:12:06 2014<br>
New Revision: 221481<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=221481&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=221481&view=rev</a><br>
Log:<br>
Return a DIDescriptor from CGDebugInfo::<u></u>getDeclarationOrDefinition...<br>
<br>
... instead of a DIScope that might wrap something that's not actually<br>
a DIScope (eg. a DIGlobalVariable);<br>
<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/<u></u>CGDebugInfo.cpp<br>
    cfe/trunk/lib/CodeGen/<u></u>CGDebugInfo.h<br>
<br>
Modified: cfe/trunk/lib/CodeGen/<u></u>CGDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=221481&r1=221480&r2=221481&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/lib/CodeGen/<u></u>CGDebugInfo.cpp?rev=221481&r1=<u></u>221480&r2=221481&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- cfe/trunk/lib/CodeGen/<u></u>CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/<u></u>CGDebugInfo.cpp Thu Nov  6 15:12:06 2014<br>
@@ -2307,7 +2307,7 @@ llvm::DIType CGDebugInfo::CreateMemberTy<br>
   return Ty;<br>
 }<br>
<br>
-llvm::DIScope CGDebugInfo::<u></u>getDeclarationOrDefinition(<u></u>const Decl *D) {<br>
+llvm::DIDescriptor CGDebugInfo::<u></u>getDeclarationOrDefinition(<u></u>const Decl *D) {<br>
   // We only need a declaration (not a definition) of the type - so use whatever<br>
   // we would otherwise do to get a type for a pointee. (forward declarations in<br>
   // limited debug info, full definitions (if the type definition is available)<br>
@@ -2327,7 +2327,7 @@ llvm::DIScope CGDebugInfo::getDeclaratio<br>
   if (I == DeclCache.end())<br>
     return llvm::DIScope();<br>
   llvm::Value *V = I->second;<br>
-  return llvm::DIScope(dyn_cast_or_<u></u>null<llvm::MDNode>(V));<br>
+  return llvm::DIDescriptor(dyn_cast_<u></u>or_null<llvm::MDNode>(V));<br>
 }<br>
<br>
 /// getFunctionDeclaration - Return debug info descriptor to describe method<br>
@@ -3239,7 +3239,7 @@ void CGDebugInfo::EmitUsingDecl(<u></u>const Us<br>
   // Emitting one decl is sufficient - debuggers can detect that this is an<br>
   // overloaded name & provide lookup for all the overloads.<br>
   const UsingShadowDecl &USD = **UD.shadow_begin();<br>
-  if (llvm::DIScope Target =<br>
+  if (llvm::DIDescriptor Target =<br>
           getDeclarationOrDefinition(<u></u>USD.getUnderlyingDecl()))<br>
     DBuilder.<u></u>createImportedDeclaration(<br>
         getCurrentContextDescriptor(<u></u>cast<Decl>(USD.getDeclContext(<u></u>))), Target,<br>
<br>
Modified: cfe/trunk/lib/CodeGen/<u></u>CGDebugInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=221481&r1=221480&r2=221481&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/lib/CodeGen/<u></u>CGDebugInfo.h?rev=221481&r1=<u></u>221480&r2=221481&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- cfe/trunk/lib/CodeGen/<u></u>CGDebugInfo.h (original)<br>
+++ cfe/trunk/lib/CodeGen/<u></u>CGDebugInfo.h Thu Nov  6 15:12:06 2014<br>
@@ -363,9 +363,9 @@ private:<br>
   llvm::DIType CreateMemberType(llvm::DIFile Unit, QualType FType,<br>
                                 StringRef Name, uint64_t *Offset);<br>
<br>
-  /// \brief Retrieve the DIScope, if any, for the canonical form of this<br>
+  /// \brief Retrieve the DIDescriptor, if any, for the canonical form of this<br>
   /// declaration.<br>
-  llvm::DIScope getDeclarationOrDefinition(<u></u>const Decl *D);<br>
+  llvm::DIDescriptor getDeclarationOrDefinition(<u></u>const Decl *D);<br>
<br>
   /// getFunctionDeclaration - Return debug info descriptor to describe method<br>
   /// declaration for the given method definition.<br>
<br>
<br>
______________________________<u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><br>
</blockquote></div>
</div></blockquote></div></div></blockquote></div>