static_cast<const FileEntry *>(file),
line, column);
- return cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc, false);
+ return cxloc::translateSourceLocation(CXXUnit->getASTContext(), SLoc);
}
CXSourceRange clang_getNullRange() {
unsigned *line,
unsigned *column,
unsigned *offset) {
- cxloc::CXSourceLocationPtr Ptr
- = cxloc::CXSourceLocationPtr::getFromOpaqueValue(location.ptr_data[0]);
SourceLocation Loc = SourceLocation::getFromRawEncoding(location.int_data);
- if (!Ptr.getPointer() || Loc.isInvalid()) {
+ if (!location.ptr_data[0] || Loc.isInvalid()) {
if (file)
*file = 0;
if (line)
return;
}
- const SourceManager &SM = *Ptr.getPointer();
+ const SourceManager &SM =
+ *static_cast<const SourceManager*>(location.ptr_data[0]);
SourceLocation InstLoc = SM.getInstantiationLoc(Loc);
if (file)
}
CXSourceLocation clang_getRangeEnd(CXSourceRange range) {
- cxloc::CXSourceLocationPtr Ptr;
- Ptr.setPointer(static_cast<SourceManager *>(range.ptr_data[0]));
- Ptr.setInt(true);
- CXSourceLocation Result = { { Ptr.getOpaqueValue(), range.ptr_data[1] },
+ CXSourceLocation Result = { { range.ptr_data[0], range.ptr_data[1] },
range.end_int_data };
return Result;
}
class ASTContext;
namespace cxloc {
-
-typedef llvm::PointerIntPair<const SourceManager *, 1, bool>
- CXSourceLocationPtr;
/// \brief Translate a Clang source location into a CIndex source location.
static inline CXSourceLocation
translateSourceLocation(const SourceManager &SM, const LangOptions &LangOpts,
- SourceLocation Loc, bool AtEnd = false) {
- CXSourceLocationPtr Ptr(&SM, AtEnd);
- CXSourceLocation Result = { { Ptr.getOpaqueValue(), (void *)&LangOpts, },
+ SourceLocation Loc) {
+ CXSourceLocation Result = { { (void*) &SM, (void*) &LangOpts, },
Loc.getRawEncoding() };
return Result;
}
/// \brief Translate a Clang source location into a CIndex source location.
static inline CXSourceLocation translateSourceLocation(ASTContext &Context,
- SourceLocation Loc,
- bool AtEnd = false) {
- return translateSourceLocation(Context.getSourceManager(),
+ SourceLocation Loc) {
+ return translateSourceLocation(Context.getSourceManager(),
Context.getLangOptions(),
- Loc, AtEnd);
+ Loc);
}
/// \brief Translate a Clang source range into a CIndex source range.