aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libclang')
-rw-r--r--tools/libclang/CIndex.cpp39
-rw-r--r--tools/libclang/CIndexDiagnostic.cpp14
-rw-r--r--tools/libclang/libclang.darwin.exports1
-rw-r--r--tools/libclang/libclang.exports1
4 files changed, 8 insertions, 47 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 };
diff --git a/tools/libclang/CIndexDiagnostic.cpp b/tools/libclang/CIndexDiagnostic.cpp
index 036a28b538..0766548418 100644
--- a/tools/libclang/CIndexDiagnostic.cpp
+++ b/tools/libclang/CIndexDiagnostic.cpp
@@ -64,8 +64,8 @@ CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, unsigned Options) {
// and source ranges.
CXFile File;
unsigned Line, Column;
- clang_getSpellingLocation(clang_getDiagnosticLocation(Diagnostic),
- &File, &Line, &Column, 0);
+ clang_getInstantiationLocation(clang_getDiagnosticLocation(Diagnostic),
+ &File, &Line, &Column, 0);
if (File) {
CXString FName = clang_getFileName(File);
Out << clang_getCString(FName) << ":" << Line << ":";
@@ -81,11 +81,11 @@ CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, unsigned Options) {
CXSourceRange Range = clang_getDiagnosticRange(Diagnostic, I);
unsigned StartLine, StartColumn, EndLine, EndColumn;
- clang_getSpellingLocation(clang_getRangeStart(Range),
- &StartFile, &StartLine, &StartColumn,
- 0);
- clang_getSpellingLocation(clang_getRangeEnd(Range),
- &EndFile, &EndLine, &EndColumn, 0);
+ clang_getInstantiationLocation(clang_getRangeStart(Range),
+ &StartFile, &StartLine, &StartColumn,
+ 0);
+ clang_getInstantiationLocation(clang_getRangeEnd(Range),
+ &EndFile, &EndLine, &EndColumn, 0);
if (StartFile != EndFile || StartFile != File)
continue;
diff --git a/tools/libclang/libclang.darwin.exports b/tools/libclang/libclang.darwin.exports
index 09f3cf7d21..7d5ae8b732 100644
--- a/tools/libclang/libclang.darwin.exports
+++ b/tools/libclang/libclang.darwin.exports
@@ -88,7 +88,6 @@ _clang_getRangeEnd
_clang_getRangeStart
_clang_getResultType
_clang_getSpecializedCursorTemplate
-_clang_getSpellingLocation
_clang_getTemplateCursorKind
_clang_getTokenExtent
_clang_getTokenKind
diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports
index 6cbd2c63b7..da7f9c851f 100644
--- a/tools/libclang/libclang.exports
+++ b/tools/libclang/libclang.exports
@@ -88,7 +88,6 @@ clang_getRangeEnd
clang_getRangeStart
clang_getResultType
clang_getSpecializedCursorTemplate
-clang_getSpellingLocation
clang_getTemplateCursorKind
clang_getTokenExtent
clang_getTokenKind