aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/CIndexDiagnostic.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-11-09 06:24:54 +0000
committerDouglas Gregor <dgregor@apple.com>2010-11-09 06:24:54 +0000
commita9b06d4c246d6c301e3dd1844f5dba669ed9c631 (patch)
tree250b364482b355d61c7306c371105fd26e031519 /tools/libclang/CIndexDiagnostic.cpp
parent27a31fe6fac7eb98ece172bf83af93a3a103f5b4 (diff)
ntroduce clang_getSpellingLocation() into libclang, to provide the
location where we're spelling a token even within a macro. clang_getInstantiationLocation() tells where we instantiated the macro. I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs, since they gloss over macro-instantiation information. Take 2: this time, adjusted tests appropriately and used a "simple" approach to the spelling location. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118495 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndexDiagnostic.cpp')
-rw-r--r--tools/libclang/CIndexDiagnostic.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/libclang/CIndexDiagnostic.cpp b/tools/libclang/CIndexDiagnostic.cpp
index 0766548418..036a28b538 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_getInstantiationLocation(clang_getDiagnosticLocation(Diagnostic),
- &File, &Line, &Column, 0);
+ clang_getSpellingLocation(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_getInstantiationLocation(clang_getRangeStart(Range),
- &StartFile, &StartLine, &StartColumn,
- 0);
- clang_getInstantiationLocation(clang_getRangeEnd(Range),
- &EndFile, &EndLine, &EndColumn, 0);
+ clang_getSpellingLocation(clang_getRangeStart(Range),
+ &StartFile, &StartLine, &StartColumn,
+ 0);
+ clang_getSpellingLocation(clang_getRangeEnd(Range),
+ &EndFile, &EndLine, &EndColumn, 0);
if (StartFile != EndFile || StartFile != File)
continue;