diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-11-09 05:52:02 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-11-09 05:52:02 +0000 |
commit | 27a31fe6fac7eb98ece172bf83af93a3a103f5b4 (patch) | |
tree | 280c5aef102e79f0c5ab5fe7e4f4fa1174a8688d /tools/libclang/CIndex.cpp | |
parent | 6665ffbfc397f68e3fb15844597674d5861995b6 (diff) |
Revert r118492, which didn't update all of its tests accordingly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118494 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndex.cpp')
-rw-r--r-- | tools/libclang/CIndex.cpp | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 42617f0ce4..496833c723 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -104,9 +104,8 @@ CXSourceRange cxloc::translateSourceRange(const SourceManager &SM, const CharSourceRange &R) { // We want the last character in this location, so we will adjust the // location accordingly. + // FIXME: How do do this with a macro instantiation location? SourceLocation EndLoc = R.getEnd(); - if (EndLoc.isValid() && EndLoc.isMacroID()) - EndLoc = SM.getSpellingLoc(EndLoc); if (R.isTokenRange() && !EndLoc.isInvalid() && EndLoc.isFileID()) { unsigned Length = Lexer::MeasureTokenLength(EndLoc, SM, LangOpts); EndLoc = EndLoc.getFileLocWithOffset(Length); @@ -2456,42 +2455,6 @@ void clang_getInstantiationLocation(CXSourceLocation location, *offset = SM.getDecomposedLoc(InstLoc).second; } -void clang_getSpellingLocation(CXSourceLocation location, - CXFile *file, - unsigned *line, - unsigned *column, - unsigned *offset) { - SourceLocation Loc = SourceLocation::getFromRawEncoding(location.int_data); - - if (!location.ptr_data[0] || Loc.isInvalid()) { - if (file) - *file = 0; - if (line) - *line = 0; - if (column) - *column = 0; - if (offset) - *offset = 0; - return; - } - - const SourceManager &SM = - *static_cast<const SourceManager*>(location.ptr_data[0]); - SourceLocation SpellLoc = SM.getSpellingLoc(Loc); - std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(SpellLoc); - FileID FID = LocInfo.first; - unsigned FileOffset = LocInfo.second; - - if (file) - *file = (void *)SM.getFileEntryForID(FID); - if (line) - *line = SM.getLineNumber(FID, FileOffset); - if (column) - *column = SM.getColumnNumber(FID, FileOffset); - if (offset) - *offset = FileOffset; -} - CXSourceLocation clang_getRangeStart(CXSourceRange range) { CXSourceLocation Result = { { range.ptr_data[0], range.ptr_data[1] }, range.begin_int_data }; |