[llvm] r209602 - DebugInfo: Fix inlining with #file directives a little harder

David Blaikie dblaikie at gmail.com
Sun May 25 11:11:36 PDT 2014


Author: dblaikie
Date: Sun May 25 13:11:35 2014
New Revision: 209602

URL: http://llvm.org/viewvc/llvm-project?rev=209602&view=rev
Log:
DebugInfo: Fix inlining with #file directives a little harder

Seems my previous fix was insufficient - we were still not adding the
inlined function to the abstract scope list. Which meant it wasn't
flagged as inline, didn't have nested lexical scopes in the abstract
definition, and didn't have abstract variables - so the inlined variable
didn't reference an abstract variable, instead being described
completely inline.

Modified:
    llvm/trunk/lib/CodeGen/LexicalScopes.cpp
    llvm/trunk/test/DebugInfo/inline-scopes.ll

Modified: llvm/trunk/lib/CodeGen/LexicalScopes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LexicalScopes.cpp?rev=209602&r1=209601&r2=209602&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LexicalScopes.cpp (original)
+++ llvm/trunk/lib/CodeGen/LexicalScopes.cpp Sun May 25 13:11:35 2014
@@ -210,21 +210,21 @@ LexicalScope *LexicalScopes::getOrCreate
   DIDescriptor Scope(N);
   if (Scope.isLexicalBlockFile())
     Scope = DILexicalBlockFile(Scope).getScope();
-  auto I = AbstractScopeMap.find(N);
+  auto I = AbstractScopeMap.find(Scope);
   if (I != AbstractScopeMap.end())
     return &I->second;
 
   LexicalScope *Parent = nullptr;
   if (Scope.isLexicalBlock()) {
-    DILexicalBlock DB(N);
+    DILexicalBlock DB(Scope);
     DIDescriptor ParentDesc = DB.getContext();
     Parent = getOrCreateAbstractScope(ParentDesc);
   }
   I = AbstractScopeMap.emplace(std::piecewise_construct,
-                               std::forward_as_tuple(N),
-                               std::forward_as_tuple(Parent, DIDescriptor(N),
+                               std::forward_as_tuple(Scope),
+                               std::forward_as_tuple(Parent, Scope,
                                                      nullptr, true)).first;
-  if (DIDescriptor(N).isSubprogram())
+  if (Scope.isSubprogram())
     AbstractScopesList.push_back(&I->second);
   return &I->second;
 }

Modified: llvm/trunk/test/DebugInfo/inline-scopes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/inline-scopes.ll?rev=209602&r1=209601&r2=209602&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/inline-scopes.ll (original)
+++ llvm/trunk/test/DebugInfo/inline-scopes.ll Sun May 25 13:11:35 2014
@@ -32,6 +32,9 @@
 ; Ensure that file changes don't interfere with creating inlined subroutines.
 ; (see the line directive inside 'f2' in thesource)
 ; CHECK: DW_TAG_inlined_subroutine
+; CHECK:   DW_TAG_variable
+; CHECK-NOT: DW_TAG
+; CHECK:     DW_AT_abstract_origin
 
 ; Function Attrs: uwtable
 define i32 @main() #0 {





More information about the llvm-commits mailing list