aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2012-10-18 22:08:02 +0000
committerEric Christopher <echristo@gmail.com>2012-10-18 22:08:02 +0000
commit25dfaacde51df0834f10e3ab1646e6de9e229788 (patch)
tree6d5859800f3f344ee802c64004cc5d87e26fa5ce /lib/CodeGen/CGDebugInfo.cpp
parent25c9bc117d8825dce7911f6fddf3725d1914a7c6 (diff)
Fix up comment and invert order. Most simple check first.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index e6e7ecf571..b183cdba27 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -254,13 +254,15 @@ unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) {
return PLoc.isValid()? PLoc.getLine() : 0;
}
-/// getColumnNumber - Get column number for the location. If location is
-/// invalid then use current location.
+/// getColumnNumber - Get column number for the location.
unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc) {
- if (Loc.isInvalid() && CurLoc.isInvalid())
- return 0;
+ // We may not want column information at all.
if (!CGM.getCodeGenOpts().DebugColumnInfo)
return 0;
+
+ // If the location is invalid then use the current column.
+ if (Loc.isInvalid() && CurLoc.isInvalid())
+ return 0;
SourceManager &SM = CGM.getContext().getSourceManager();
PresumedLoc PLoc = SM.getPresumedLoc(Loc.isValid() ? Loc : CurLoc);
return PLoc.isValid()? PLoc.getColumn() : 0;