Shouldn't this functionality just go into translateSourceLocation() and translateSourceRange(), so that other callers don't need to do the same thing?
- Doug On Jun 3, 2010, at 8:52 AM, Ted Kremenek wrote: > Author: kremenek > Date: Thu Jun 3 10:52:32 2010 > New Revision: 105392 > > URL: http://llvm.org/viewvc/llvm-project?rev=105392&view=rev > Log: > Return a proper null CXSourceLocation from clang_getLocation() when the > SourceLocation is invalid. Fixes <rdar://problem/8056640>. > > Modified: > cfe/trunk/tools/libclang/CIndex.cpp > > Modified: cfe/trunk/tools/libclang/CIndex.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=105392&r1=105391&r2=105392&view=diff > ============================================================================== > --- cfe/trunk/tools/libclang/CIndex.cpp (original) > +++ cfe/trunk/tools/libclang/CIndex.cpp Thu Jun 3 10:52:32 2010 > @@ -1416,7 +1416,9 @@ > static_cast<const FileEntry *>(file), > line, column); > > - return cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc); > + return SLoc.isInvalid() ? > + clang_getNullLocation() : > + cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc); > } > > CXSourceRange clang_getNullRange() { > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits