diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-30 18:45:11 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-30 18:45:11 +0000 |
commit | 51306ef9bc0f0e33cf6ec76f2ebd0922125d5ae2 (patch) | |
tree | 9dcdda3d1c9f242ee6fd0c8720c13817d19f9ad5 /llvm/lib/IR/DebugInfo.cpp | |
parent | 3c9e20de2e38fff16447f1b4b1bf1ae9c707c708 (diff) | |
download | bcm5719-llvm-51306ef9bc0f0e33cf6ec76f2ebd0922125d5ae2.tar.gz bcm5719-llvm-51306ef9bc0f0e33cf6ec76f2ebd0922125d5ae2.zip |
DebugInfo: Reflow printDebugLoc() to use early returns, NFC
llvm-svn: 233580
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index e16ac8c20f6..d2956d58e2c 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/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 { |