From: Duncan P. N. Exon Smith Date: Mon, 30 Mar 2015 18:45:11 +0000 (+0000) Subject: DebugInfo: Reflow printDebugLoc() to use early returns, NFC X-Git-Tag: android-x86-7.1-r4~49801 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=770661092f2e097a84d6758b8e75d7686fefefd7;p=android-x86%2Fexternal-llvm.git 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 --- diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index e16ac8c20f6..d2956d58e2c 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -889,21 +889,24 @@ void DIDescriptor::print(raw_ostream &OS) const { static void printDebugLoc(DebugLoc DL, raw_ostream &CommentOS, const LLVMContext &Ctx) { - if (!DL.isUnknown()) { // Print source line info. - DIScope Scope(DL.getScope(Ctx)); - assert(Scope.isScope() && "Scope of a DebugLoc should be a DIScope."); - // Omit the directory, because it's likely to be long and uninteresting. - CommentOS << Scope.getFilename(); - CommentOS << ':' << DL.getLine(); - if (DL.getCol() != 0) - CommentOS << ':' << DL.getCol(); - DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(DL.getInlinedAt(Ctx)); - if (!InlinedAtDL.isUnknown()) { - CommentOS << " @[ "; - printDebugLoc(InlinedAtDL, CommentOS, Ctx); - CommentOS << " ]"; - } - } + if (DL.isUnknown()) + return; + + DIScope Scope(DL.getScope(Ctx)); + assert(Scope.isScope() && "Scope of a DebugLoc should be a DIScope."); + // Omit the directory, because it's likely to be long and uninteresting. + CommentOS << Scope.getFilename(); + CommentOS << ':' << DL.getLine(); + if (DL.getCol() != 0) + CommentOS << ':' << DL.getCol(); + + DebugLoc InlinedAtDL = DebugLoc::getFromDILocation(DL.getInlinedAt(Ctx)); + if (InlinedAtDL.isUnknown()) + return; + + CommentOS << " @[ "; + printDebugLoc(InlinedAtDL, CommentOS, Ctx); + CommentOS << " ]"; } void DIVariable::printExtendedName(raw_ostream &OS) const {