[llvm] r233580 - DebugInfo: Reflow printDebugLoc() to use early returns, NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Mar 30 11:45:11 PDT 2015
Author: dexonsmith
Date: Mon Mar 30 13:45:11 2015
New Revision: 233580
URL: http://llvm.org/viewvc/llvm-project?rev=233580&view=rev
Log:
DebugInfo: Reflow printDebugLoc() to use early returns, NFC
Modified:
llvm/trunk/lib/IR/DebugInfo.cpp
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=233580&r1=233579&r2=233580&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Mar 30 13:45:11 2015
@@ -889,21 +889,24 @@ void DIDescriptor::print(raw_ostream &OS
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 {
More information about the llvm-commits
mailing list