OLD | NEW |
1 //===- LexicalScopes.cpp - Collecting lexical scope info ------------------===// | 1 //===- LexicalScopes.cpp - Collecting lexical scope info ------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements LexicalScopes analysis. | 10 // This file implements LexicalScopes analysis. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 if (D.isLexicalBlock()) | 169 if (D.isLexicalBlock()) |
170 Parent = getOrCreateLexicalScope(DebugLoc::getFromDILexicalBlock(Scope)); | 170 Parent = getOrCreateLexicalScope(DebugLoc::getFromDILexicalBlock(Scope)); |
171 // FIXME: Use forward_as_tuple instead of make_tuple, once MSVC2012 | 171 // FIXME: Use forward_as_tuple instead of make_tuple, once MSVC2012 |
172 // compatibility is no longer required. | 172 // compatibility is no longer required. |
173 I = LexicalScopeMap.emplace(std::piecewise_construct, std::make_tuple(Scope), | 173 I = LexicalScopeMap.emplace(std::piecewise_construct, std::make_tuple(Scope), |
174 std::make_tuple(Parent, DIDescriptor(Scope), | 174 std::make_tuple(Parent, DIDescriptor(Scope), |
175 nullptr, false)).first; | 175 nullptr, false)).first; |
176 | 176 |
177 if (!Parent) { | 177 if (!Parent) { |
178 assert(DIDescriptor(Scope).isSubprogram()); | 178 assert(DIDescriptor(Scope).isSubprogram()); |
179 assert(DISubprogram(Scope).describes(MF->getFunction())); | 179 // @LOCALMOD-BEGIN |
180 assert(!CurrentFnLexicalScope); | 180 // This currently asserts when mixing -g and -g0 compilation |
| 181 // units + LTO. Debug info from a few inlined functions are not |
| 182 // marked as inline, so we end up in getOrCreateRegularScope |
| 183 // instead of getOrCreateInlinedScope. |
| 184 // This is reproducible w/ the pnacl-llc.nexe build and |
| 185 // setting the env var PNACL_PRUNE=false. |
| 186 // https://code.google.com/p/nativeclient/issues/detail?id=4026 |
| 187 //assert(DISubprogram(Scope).describes(MF->getFunction())); |
| 188 //assert(!CurrentFnLexicalScope); |
| 189 // @LOCALMOD-END |
181 CurrentFnLexicalScope = &I->second; | 190 CurrentFnLexicalScope = &I->second; |
182 } | 191 } |
183 | 192 |
184 return &I->second; | 193 return &I->second; |
185 } | 194 } |
186 | 195 |
187 /// getOrCreateInlinedScope - Find or create an inlined lexical scope. | 196 /// getOrCreateInlinedScope - Find or create an inlined lexical scope. |
188 LexicalScope *LexicalScopes::getOrCreateInlinedScope(MDNode *ScopeNode, | 197 LexicalScope *LexicalScopes::getOrCreateInlinedScope(MDNode *ScopeNode, |
189 MDNode *InlinedAt) { | 198 MDNode *InlinedAt) { |
190 std::pair<const MDNode*, const MDNode*> P(ScopeNode, InlinedAt); | 199 std::pair<const MDNode*, const MDNode*> P(ScopeNode, InlinedAt); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 if (AbstractScope) | 356 if (AbstractScope) |
348 err << std::string(Indent, ' ') << "Abstract Scope\n"; | 357 err << std::string(Indent, ' ') << "Abstract Scope\n"; |
349 | 358 |
350 if (!Children.empty()) | 359 if (!Children.empty()) |
351 err << std::string(Indent + 2, ' ') << "Children ...\n"; | 360 err << std::string(Indent + 2, ' ') << "Children ...\n"; |
352 for (unsigned i = 0, e = Children.size(); i != e; ++i) | 361 for (unsigned i = 0, e = Children.size(); i != e; ++i) |
353 if (Children[i] != this) | 362 if (Children[i] != this) |
354 Children[i]->dump(Indent + 2); | 363 Children[i]->dump(Indent + 2); |
355 #endif | 364 #endif |
356 } | 365 } |
OLD | NEW |