Per Doug's suggestion, move check for invalid SourceLocation into
cxloc::translateSourceLocation() (thus causing all clients of this
function to have the same behavior).
llvm-svn: 107101
diff --git a/clang/tools/libclang/CXSourceLocation.h b/clang/tools/libclang/CXSourceLocation.h
index 235f78c..7a50205 100644
--- a/clang/tools/libclang/CXSourceLocation.h
+++ b/clang/tools/libclang/CXSourceLocation.h
@@ -29,6 +29,9 @@
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;