diff options
author | Devang Patel <dpatel@apple.com> | 2012-02-06 23:24:13 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2012-02-06 23:24:13 +0000 |
commit | f93d0b8b2819f7b4fe8b3cadbc3f94be99aa67f7 (patch) | |
tree | febbb5b1af053ae3189a4db27c4f8030cc9f2d73 /clang/lib/CodeGen | |
parent | 02cb1715eca56489f9450aef13b818d832f24794 (diff) | |
download | bcm5719-llvm-f93d0b8b2819f7b4fe8b3cadbc3f94be99aa67f7.tar.gz bcm5719-llvm-f93d0b8b2819f7b4fe8b3cadbc3f94be99aa67f7.zip |
Relax valid location check. This fixes a clang crash while emitting debug info for properties that are synthesized by the compiler by default.
llvm-svn: 149929
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index addc254128a..9a0121ea50c 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -233,7 +233,8 @@ llvm::DIFile CGDebugInfo::getOrCreateMainFile() { /// getLineNumber - Get line number for the location. If location is invalid /// then use current location. unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) { - assert((Loc.isValid() || CurLoc.isValid()) && "Invalid current location!"); + if (Loc.isInvalid() && CurLoc.isInvalid()) + return 0; SourceManager &SM = CGM.getContext().getSourceManager(); PresumedLoc PLoc = SM.getPresumedLoc(Loc.isValid() ? Loc : CurLoc); return PLoc.isValid()? PLoc.getLine() : 0; @@ -242,7 +243,8 @@ unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) { /// getColumnNumber - Get column number for the location. If location is /// invalid then use current location. unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc) { - assert((Loc.isValid() || CurLoc.isValid()) && "Invalid current location!"); + 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; |