forked from OSchip/llvm-project
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
This commit is contained in:
parent
8d38ac4536
commit
5414027020
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue