diff options
Diffstat (limited to 'contrib/llvm/tools/clang/tools/libclang/CXSourceLocation.h')
-rw-r--r-- | contrib/llvm/tools/clang/tools/libclang/CXSourceLocation.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/llvm/tools/clang/tools/libclang/CXSourceLocation.h b/contrib/llvm/tools/clang/tools/libclang/CXSourceLocation.h index 66566c1..7a50205 100644 --- a/contrib/llvm/tools/clang/tools/libclang/CXSourceLocation.h +++ b/contrib/llvm/tools/clang/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; @@ -50,14 +53,14 @@ static inline CXSourceLocation translateSourceLocation(ASTContext &Context, /// does the appropriate translation. CXSourceRange translateSourceRange(const SourceManager &SM, const LangOptions &LangOpts, - SourceRange R); + const CharSourceRange &R); /// \brief Translate a Clang source range into a CIndex source range. static inline CXSourceRange translateSourceRange(ASTContext &Context, SourceRange R) { return translateSourceRange(Context.getSourceManager(), Context.getLangOptions(), - R); + CharSourceRange::getTokenRange(R)); } static inline SourceLocation translateSourceLocation(CXSourceLocation L) { |