diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-06-03 15:52:32 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-06-03 15:52:32 +0000 |
commit | df432e338c68e0e06dd7644c43f3f218750b3d58 (patch) | |
tree | 5516cdf4dbb3b8317146c234005a54147cd620f2 | |
parent | e9a05b7fd6ece68310707d10bc747a702a9af4a8 (diff) |
Return a proper null CXSourceLocation from clang_getLocation() when the SourceLocation is invalid. Fixes <rdar://problem/8056640>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105392 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/libclang/CIndex.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 21396ad1c5..ae126676fc 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -1416,7 +1416,9 @@ CXSourceLocation clang_getLocation(CXTranslationUnit tu, static_cast<const FileEntry *>(file), line, column); - return cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc); + return SLoc.isInvalid() ? + clang_getNullLocation() : + cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc); } CXSourceRange clang_getNullRange() { |