From df432e338c68e0e06dd7644c43f3f218750b3d58 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 3 Jun 2010 15:52:32 +0000 Subject: [PATCH] Return a proper null CXSourceLocation from clang_getLocation() when the SourceLocation is invalid. Fixes . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105392 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/libclang/CIndex.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(file), line, column); - return cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc); + return SLoc.isInvalid() ? + clang_getNullLocation() : + cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc); } CXSourceRange clang_getNullRange() { -- 2.40.0