- Early exit a nested block.

- Correct comment.
- Whitespace changes.

llvm-svn: 65149
This commit is contained in:
Bill Wendling 2009-02-20 20:40:28 +00:00
parent 01144480fd
commit 2343339644
1 changed files with 27 additions and 23 deletions

View File

@ -1267,6 +1267,7 @@ class DwarfDebug : public Dwarf {
/// MainCU - Some platform prefers one compile unit per .o file. In such /// MainCU - Some platform prefers one compile unit per .o file. In such
/// cases, all dies are inserted in MainCU. /// cases, all dies are inserted in MainCU.
CompileUnit *MainCU; CompileUnit *MainCU;
/// AbbreviationsSet - Used to uniquely define abbreviations. /// AbbreviationsSet - Used to uniquely define abbreviations.
/// ///
FoldingSet<DIEAbbrev> AbbreviationsSet; FoldingSet<DIEAbbrev> AbbreviationsSet;
@ -1278,7 +1279,7 @@ class DwarfDebug : public Dwarf {
/// Directories - Uniquing vector for directories. /// Directories - Uniquing vector for directories.
UniqueVector<std::string> Directories; UniqueVector<std::string> Directories;
/// SourceFiles - Uniquing vector for source files. /// SrcFiles - Uniquing vector for source files.
UniqueVector<SrcFileInfo> SrcFiles; UniqueVector<SrcFileInfo> SrcFiles;
/// Lines - List of of source line correspondence. /// Lines - List of of source line correspondence.
@ -1993,28 +1994,32 @@ private:
/// ///
DbgScope *getOrCreateScope(GlobalVariable *V) { DbgScope *getOrCreateScope(GlobalVariable *V) {
DbgScope *&Slot = DbgScopeMap[V]; DbgScope *&Slot = DbgScopeMap[V];
if (!Slot) { if (Slot) return Slot;
// FIXME - breaks down when the context is an inlined function.
DIDescriptor ParentDesc; // FIXME - breaks down when the context is an inlined function.
DIDescriptor Desc(V); DIDescriptor ParentDesc;
if (Desc.getTag() == dwarf::DW_TAG_lexical_block) { DIDescriptor Desc(V);
DIBlock Block(V);
ParentDesc = Block.getContext(); if (Desc.getTag() == dwarf::DW_TAG_lexical_block) {
} DIBlock Block(V);
DbgScope *Parent = ParentDesc.isNull() ? ParentDesc = Block.getContext();
NULL : getOrCreateScope(ParentDesc.getGV());
Slot = new DbgScope(Parent, Desc);
if (Parent) {
Parent->AddScope(Slot);
} else if (RootDbgScope) {
// FIXME - Add inlined function scopes to the root so we can delete
// them later. Long term, handle inlined functions properly.
RootDbgScope->AddScope(Slot);
} else {
// First function is top level function.
RootDbgScope = Slot;
}
} }
DbgScope *Parent = ParentDesc.isNull() ?
NULL : getOrCreateScope(ParentDesc.getGV());
Slot = new DbgScope(Parent, Desc);
if (Parent) {
Parent->AddScope(Slot);
} else if (RootDbgScope) {
// FIXME - Add inlined function scopes to the root so we can delete them
// later. Long term, handle inlined functions properly.
RootDbgScope->AddScope(Slot);
} else {
// First function is top level function.
RootDbgScope = Slot;
}
return Slot; return Slot;
} }
@ -3087,7 +3092,6 @@ public:
/// ValidDebugInfo - Return true if V represents valid debug info value. /// ValidDebugInfo - Return true if V represents valid debug info value.
bool ValidDebugInfo(Value *V) { bool ValidDebugInfo(Value *V) {
if (!V) if (!V)
return false; return false;