DebugInfo: Reflow printDebugLoc() to use early returns, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233580 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-03-30 18:45:11 +00:00
parent 70c2586498
commit 770661092f

View File

@ -889,21 +889,24 @@ void DIDescriptor::print(raw_ostream &OS) const {
static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS, static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS,
const LLVMContext &Ctx) { const LLVMContext &Ctx) {
if (!DL.isUnknown()) { // Print source line info. if (DL.isUnknown())
DIScope Scope(DL.getScope(Ctx)); return;
assert(Scope.isScope() && "Scope of a DebugLoc should be a DIScope.");
// Omit the directory, because it's likely to be long and uninteresting. DIScope Scope(DL.getScope(Ctx));
CommentOS << Scope.getFilename(); assert(Scope.isScope() && "Scope of a DebugLoc should be a DIScope.");
CommentOS << ':' << DL.getLine(); // Omit the directory, because it's likely to be long and uninteresting.
if (DL.getCol() != 0) CommentOS << Scope.getFilename();
CommentOS << ':' << DL.getCol(); CommentOS << ':' << DL.getLine();
DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(DL.getInlinedAt(Ctx)); if (DL.getCol() != 0)
if (!InlinedAtDL.isUnknown()) { CommentOS << ':' << DL.getCol();
CommentOS << " @[ ";
printDebugLoc(InlinedAtDL, CommentOS, Ctx); DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(DL.getInlinedAt(Ctx));
CommentOS << " ]"; if (InlinedAtDL.isUnknown())
} return;
}
CommentOS << " @[ ";
printDebugLoc(InlinedAtDL, CommentOS, Ctx);
CommentOS << " ]";
} }
void DIVariable::printExtendedName(raw_ostream &OS) const { void DIVariable::printExtendedName(raw_ostream &OS) const {