diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-06-28 23:54:17 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-06-28 23:54:17 +0000 |
commit | 1a9a0bc472ee4fec72ee8be8b575fb66ca600d1b (patch) | |
tree | 561b4fa917b4b706331b3f01b1307809a631ae99 | |
parent | ce70016434ff82a29a60ef82894d934b8a23f23d (diff) |
Per Doug's suggestion, move check for invalid SourceLocation into
cxloc::translateSourceLocation() (thus causing all clients of this
function to have the same behavior).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107101 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/libclang/CIndex.cpp | 4 | ||||
-rw-r--r-- | tools/libclang/CXSourceLocation.h | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index e19cd4214f..ce9357de33 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -1417,9 +1417,7 @@ CXSourceLocation clang_getLocation(CXTranslationUnit tu, static_cast<const FileEntry *>(file), line, column); - return SLoc.isInvalid() ? - clang_getNullLocation() : - cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc); + return cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc); } CXSourceRange clang_getNullRange() { diff --git a/tools/libclang/CXSourceLocation.h b/tools/libclang/CXSourceLocation.h index 235f78c5a1..7a50205963 100644 --- a/tools/libclang/CXSourceLocation.h +++ b/tools/libclang/CXSourceLocation.h @@ -29,6 +29,9 @@ namespace cxloc { static inline CXSourceLocation translateSourceLocation(const SourceManager &SM, const LangOptions &LangOpts, SourceLocation Loc) { + if (Loc.isInvalid()) + clang_getNullLocation(); + CXSourceLocation Result = { { (void*) &SM, (void*) &LangOpts, }, Loc.getRawEncoding() }; return Result; |